flex/tests/Sanity/smoke-check-flex-runs/calc-lexer.l

16 lines
324 B
Plaintext
Raw Normal View History

2021-01-18 21:11:55 +00:00
%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); }
%%