/* -*- fundamental -*- */ %{ #include "record-i.h" %} %option warn %option batch %option noyywrap %option yylineno %option prefix="record_yy" %option header-file="record-l.h" %{ #define STR record_yylval.name= record_tempzone_strdup(yytext); return %} %% train { STR TRAIN; } seg { STR SEG; } is { STR IS; } at { STR AT; } has { STR HAS; } step { STR STEP; } home { STR HOME; } end { STR END; } /* new keywords must be added to %token and ident: in record-y.y */ [A-Za-z][A-Za-z0-9_]+ { STR IDENT; } [0-9]{0,8} { record_yylval.num= strtoul(yytext,0,10); return NUM; } [0-9]{9} { record_yyerror("number too long"); } [-+:=~/] { record_yylval.name= 0; return yytext[0]; } \#.*\n|\n { record_yylval.name= 0; return NL; } [ \t] { } . { record_yyerror("lexically invalid input"); }