1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | /* SI 413 Fall 2012 * Lab 05 * Flex file specifying the scanner */ %{ #include "pat.hpp" using namespace std; string yylval; %} %option noyywrap %% [a-z][a-zA-Z0-9]* { yylval = string(yytext); return SYM; } "*" { return FOLD; } ";" { return STOP; } ":" { return COLON; } [A-Z][a-zA-Z0-9]* { yylval = string(yytext); return NAME; } "_r" { return REV; } "[" { return LB; } "]" { return RB; } <<EOF>> { return 0; } [ \t\n]+ { } . { errout << "Unrecognized token!" << endl; exit(1); } %% |