%option noyywrap %{ #include #include "global.h" #define YY_DECL int lexan() int lineno = 1; int tokenval = NONE; %} %% [t ] {} [n] { lineno++; } [0-9]+ { tokenval = atoi(yytext); return NUM; } [A-za-z][A-za-z0-9]+ { int p = lookup(yytext); if (p == 0) p = insert(yytext, ID); tokenval = p; return symtable[p].token; } <> { yylex_destroy(); return DONE; } . { tokenval = NONE; return yytext[0]; } %%