From d4b977d0904a1dea37922dac60d3bb37f9769230 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Thu, 5 Jan 2012 04:47:56 +1000 Subject: Add a simple flex + btyacc stub. Will be fleshed out soon with LSL grammer. --- LuaSL/src/LuaSL_lexer.l | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 LuaSL/src/LuaSL_lexer.l (limited to 'LuaSL/src/LuaSL_lexer.l') diff --git a/LuaSL/src/LuaSL_lexer.l b/LuaSL/src/LuaSL_lexer.l new file mode 100644 index 0000000..f55d458 --- /dev/null +++ b/LuaSL/src/LuaSL_lexer.l @@ -0,0 +1,31 @@ +%{ + +#include "LuaSL_type_parser.h" +#include "LuaSL_yaccer.tab.h" + +%} + +%option reentrant noyywrap never-interactive nounistd +%option bison-bridge + +LPAREN "(" +RPAREN ")" +PLUS "+" +MULTIPLY "*" + +NUMBER [0-9]+ +WS [ \r\n\t]* + +%% + +{WS} { /* Skip blanks. */ } +{NUMBER} { sscanf(yytext,"%d",&yylval->value); return TOKEN_NUMBER; } + +{MULTIPLY} { return TOKEN_MULTIPLY; } +{PLUS} { return TOKEN_PLUS; } +{LPAREN} { return TOKEN_LPAREN; } +{RPAREN} { return TOKEN_RPAREN; } +. { } + +%% + -- cgit v1.1