diff options
author | marha <marha@users.sourceforge.net> | 2010-11-19 13:18:48 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-11-19 13:18:48 +0000 |
commit | 12f606ce06ef926f366a03079c5e3107c23f18af (patch) | |
tree | 28d7be4328bca9c31c1ab0f7cb5924c196be23a0 /tools/bison++/Example/MyScanner.l | |
parent | 773752eab55047c33bad0d88006bb69f5c601502 (diff) | |
download | vcxsrv-12f606ce06ef926f366a03079c5e3107c23f18af.tar.gz vcxsrv-12f606ce06ef926f366a03079c5e3107c23f18af.tar.bz2 vcxsrv-12f606ce06ef926f366a03079c5e3107c23f18af.zip |
Added tool bison++-1.21.11
Diffstat (limited to 'tools/bison++/Example/MyScanner.l')
-rw-r--r-- | tools/bison++/Example/MyScanner.l | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/bison++/Example/MyScanner.l b/tools/bison++/Example/MyScanner.l new file mode 100644 index 000000000..fd9dde78f --- /dev/null +++ b/tools/bison++/Example/MyScanner.l @@ -0,0 +1,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); +}
\ No newline at end of file |