scanner.l

Sat, 29 Dec 2001 18:59:47 +0000

author
eric
date
Sat, 29 Dec 2001 18:59:47 +0000
changeset 12
c3e2c2344560
parent 11
30d18cf8bb67
child 13
3ab5717225d3
permissions
-rw-r--r--

*** empty log message ***

eric@12 1 /*
eric@12 2 $Id: scanner.l,v 1.6 2001/12/29 10:59:33 eric Exp $
eric@12 3 */
eric@12 4
eric@5 5 %option case-insensitive
eric@5 6
eric@5 7 %{
eric@5 8 #include "parser.tab.h"
eric@12 9 %}
eric@12 10
eric@5 11
eric@5 12 digit [0-9]
eric@5 13 alpha [a-zA-Z]
eric@5 14
eric@5 15 %%
eric@5 16
eric@7 17 \.\. { return (ELIPSIS); }
eric@7 18
eric@5 19 {digit}+ { yylval.integer = atoi (yytext); return (INTEGER); }
eric@12 20 {digit}+.{digit}* { yylval.fp = atof (yytext); return (FLOAT); }
eric@9 21
eric@9 22 a { yylval.size.width = 8.5 * 25.4;
eric@9 23 yylval.size.height = 11.0 * 25.4;
eric@9 24 return (PAGE_SIZE); }
eric@9 25 b { yylval.size.width = 11.0 * 25.4;
eric@9 26 yylval.size.height = 17.0 * 25.4;
eric@9 27 return (PAGE_SIZE); }
eric@9 28 c { yylval.size.width = 17.0 * 25.4;
eric@9 29 yylval.size.height = 22.0 * 25.4;
eric@9 30 return (PAGE_SIZE); }
eric@9 31 d { yylval.size.width = 22.0 * 25.4;
eric@9 32 yylval.size.height = 34.0 * 25.4;
eric@9 33 return (PAGE_SIZE); }
eric@9 34 e { yylval.size.width = 34.0 * 25.4;
eric@9 35 yylval.size.height = 44.0 * 25.4;
eric@9 36 return (PAGE_SIZE); }
eric@5 37
eric@5 38 all { return (ALL); }
eric@5 39 bookmark { return (BOOKMARK); }
eric@9 40 cm { return (CM); }
eric@5 41 crop { return (CROP); }
eric@5 42 even { return (EVEN); }
eric@11 43 file { return (FILE_KEYWORD); }
eric@5 44 image { return (IMAGE); }
eric@9 45 images { return (IMAGES); }
eric@9 46 inch { return (INCH); }
eric@5 47 input { return (INPUT); }
eric@9 48 landscape { return (LANDSCAPE); }
eric@5 49 odd { return (ODD); }
eric@5 50 output { return (OUTPUT); }
eric@5 51 page { return (PAGE); }
eric@8 52 pages { return (PAGES); }
eric@9 53 portrait { return (PORTRAIT) ; }
eric@11 54 resolution { return (RESOLUTION) ; }
eric@5 55 rotate { return (ROTATE); }
eric@5 56 size { return (SIZE); }
eric@5 57
eric@12 58 \".*\" { yylval.string = strdup (yytext); return (STRING); }
eric@9 59
eric@9 60 [ \t\n]+ /* whitespace */
eric@9 61
eric@9 62 --.* /* Ada/VHDL style one-line comment */
eric@9 63
eric@9 64 . { printf( "Unrecognized character: %s\n", yytext ); }
eric@9 65
eric@12 66 %%