1 /* Scanner for "C" assignment statements... sort of. */
2 /* Compile: reflex --bison-locations --bison-bridge --header-file reflexexample8.l */
3 /* Compile: bison -d -y flexexample8.y */
4 /* Example taken from Flex documentation A.2 */
5 /* Bison bridge passes yylval to yylex (which limits yylval's scope to the rule actions) */
6 /* Note: yylval is no longer a pointer with reflex */
7 
8 %top{
9 #include "y.tab.h"  /* Generated by bison. */
10 }
11 
12 %option bison-locations bison-bridge noyywrap
13 
14 %%
15 
16 \d+           { yylval.num = atoi(text());   return NUMBER; }
17 \w+           { yylval.str = strdup(text()); return STRING; }
18 "="|";"       { return text()[0]; }
19 .|\n          {}
20 
21 %%
22