flex/tests/Sanity/smoke-check-flex-runs/calc-lexer.l
2021-02-01 11:12:11 +00:00

16 lines
324 B
Plaintext

%option noyywrap
%{
#include "calc-grammar.tab.h"
%}
%%
"+" { return ADD; }
"-" { return SUB; }
"*" { return MUL; }
"/" { return DIV; }
[0-9]+ { yylval = atoi(yytext); return NUMBER; }
\n { return EOL; }
[ \t] { /* ignore whitespaces */ }
. { yyerror("unexpected character %c", *yytext); }
%%