scanner.l

Sat, 29 Dec 2001 17:45:43 +0000

author
eric
date
Sat, 29 Dec 2001 17:45:43 +0000
changeset 11
30d18cf8bb67
parent 9
de78038d990f
child 12
c3e2c2344560
permissions
-rw-r--r--

*** empty log message ***

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