%option noyywrap %option warn nodefault %{ #include #include #include "parser.tab.hh" #define YY_DECL int \ yylex (yy::parser::semantic_type *yylval) %} %% [-+*/()] { return yytext[0]; } [0-9]+ { yylval->build (atoi (yytext)); return yy::parser::token::NUMBER; } [ \t\n]+ { } . { throw std::runtime_error ("Unknown character"); } %%