aboutsummaryrefslogtreecommitdiff
path: root/tools/bison++/Example/MyScanner.l
blob: fd9dde78f81b2b0ba7c0596fc181c19bc6dd73ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
%{ 
#ifndef FLEXFIX
#define FLEXFIX YY_MyParser_STYPE *val
#define FLEXFIX2 val
#endif
#include "MyParser.h" // Make sure the flexer can communicate with bison++ 
                      //using return values
%}

digit	[0-9]
integer	[1-9]{digit}*
ws	[ \t\n]+
%%
{ws}				{ /* no action */ }
{integer}	{  val->num = atoi(yytext); return MyParser::INTEGER; }
"AND"		{return(MyParser::AND);}
"OR"		{return(MyParser::OR);}
"NOT"		{return(MyParser::NOT);}
"TRUE"	{val->statement=true; return MyParser::BOOLEAN; }
"FALSE"	{val->statement=false; return MyParser::BOOLEAN; }
"-"		{return(MyParser::MINUS);}
"+"		{return(MyParser::PLUS);}
"("		{return(MyParser::LPARA);}
")"		{return(MyParser::RPARA);}

<<EOF>> { yyterminate();}
%%
int yywrap()
{
        return(1);
}