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 ***

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