summaryrefslogtreecommitdiffstats
path: root/util/qlalr/examples/qparser/calc.l
blob: 95181d52135dc28b47805dfcb49e5780effe3b38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

%option noyywrap

%{
#include "calc_parser.h"
#include <cstdlib>

#define YY_DECL int CalcParser::nextToken()
%}

%%

[ \t\n]     { /* eat me */ }
[0-9]+      { sym(1) = atoi (yytext); return Token_number; }
"("         { return Token_lparen; }
")"         { return Token_rparen; }
"+"         { return Token_plus; }
"-"         { return Token_minus; }

%%