diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2016-09-19 22:32:41 +0000 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2016-09-19 22:32:41 +0000 |
commit | cf2eb3dde8d9d49f28b9f91a726c865abe948109 (patch) | |
tree | deff333167b9a132df5903cf629e623f20c9a7e8 /lib/parserel/src/parseRel.ll | |
parent | ad802305ebdc4a3956f90382f7d40a104e8c2f73 (diff) | |
download | chill-cf2eb3dde8d9d49f28b9f91a726c865abe948109.tar.gz chill-cf2eb3dde8d9d49f28b9f91a726c865abe948109.tar.bz2 chill-cf2eb3dde8d9d49f28b9f91a726c865abe948109.zip |
parseRel as lib
Diffstat (limited to 'lib/parserel/src/parseRel.ll')
-rw-r--r-- | lib/parserel/src/parseRel.ll | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/parserel/src/parseRel.ll b/lib/parserel/src/parseRel.ll new file mode 100644 index 0000000..f0cac81 --- /dev/null +++ b/lib/parserel/src/parseRel.ll @@ -0,0 +1,24 @@ +%{ +// some C++ code +#include "parseRel.hh" +#include "parseRel.tab.hh" +%} + +%option noyywrap + +%% +[ \t]+ /*ignore*/ +\n /*ignore*/ +L[0-9]+ { yylval.val = atoi(&yytext[1]); return LEVEL; } +[0-9]+ { yylval.val = atoi(yytext); return NUMBER; } +\<\= return LE; +\>\= return GE; +\=(\=)? return EQ; +[a-zA-Z_][a-zA-Z_0-9]* { + yylval.str_val = new char[yyleng+1]; + strcpy(yylval.str_val, yytext); + return VARIABLE; + } +. return (int)yytext[0]; +%% + |