scanner.l

Sun, 30 Dec 2001 01:54:43 +0000

author
eric
date
Sun, 30 Dec 2001 01:54:43 +0000
changeset 13
3ab5717225d3
parent 12
c3e2c2344560
child 15
dda3d673b82b
permissions
-rw-r--r--

*** empty log message ***

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