Debian Codegraph @

yo/concrete/unrestricted/scanner/lexer

raw
1 %{
2 #define SKIP_FLEXLEXER_
3 #include "scanner.ih"
4
5 #include "../parser/preinclude.h"
6 #include "../parser/parserbase.h"
7 %}
8
9 %option yyclass="Scanner" outfile="yylex.cc"
10 %option c++ 8bit warn noyywrap yylineno
11 %option debug
12
13 %%
14
15 [ \t]+ // skip white space
16 \n // same
17
18 [0-9]+ {
19 *d_semval = Semantic(Semantic::INT, yytext);
20 return Parser::INT;
21 }
22
23 [a-zA-Z_][a-zA-Z0-9_]* {
24 *d_semval = Semantic(Semantic::IDENTIFIER, yytext);
25 return Parser::IDENTIFIER;
26 }
27
28 . return yytext[0];
29
30
31 %%
32
33
34