aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src/LuaSL_lexer.l
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-08 09:01:44 +1000
committerDavid Walter Seikel2012-01-08 09:01:44 +1000
commit0306182b9bcafa7f850dd91aa196ae7d562d2254 (patch)
treec815ac4506e27ed285a67d5ca1f936f40b90b9b6 /LuaSL/src/LuaSL_lexer.l
parentParenthesis and statement parsing. (diff)
downloadSledjHamr-0306182b9bcafa7f850dd91aa196ae7d562d2254.zip
SledjHamr-0306182b9bcafa7f850dd91aa196ae7d562d2254.tar.gz
SledjHamr-0306182b9bcafa7f850dd91aa196ae7d562d2254.tar.bz2
SledjHamr-0306182b9bcafa7f850dd91aa196ae7d562d2254.tar.xz
Use character classes, some clean up. Tried to add space storing, but it did not work.
Diffstat (limited to 'LuaSL/src/LuaSL_lexer.l')
-rw-r--r--LuaSL/src/LuaSL_lexer.l19
1 files changed, 7 insertions, 12 deletions
diff --git a/LuaSL/src/LuaSL_lexer.l b/LuaSL/src/LuaSL_lexer.l
index 91e4264..2166743 100644
--- a/LuaSL/src/LuaSL_lexer.l
+++ b/LuaSL/src/LuaSL_lexer.l
@@ -19,22 +19,17 @@
19%option backup debug perf-report perf-report verbose warn 19%option backup debug perf-report perf-report verbose warn
20%option align full 20%option align full
21 21
22SPACE [ \r\n\t]* 22HEX [[:xdigit:]]
23 23NAME [[:alpha:]](_|[[:alpha:]]|[[:digit:]])*
24LETTER [A-Za-z] 24INTEGER [[:digit:]]+
25DECIMAL [0-9]
26HEX [0-9A-Fa-f]
27
28NAME {LETTER}(_|{LETTER}|{DECIMAL})*
29INTEGER {DECIMAL}+
30EXPONANT [eE][+-]?{INTEGER} 25EXPONANT [eE][+-]?{INTEGER}
31FLOAT {INTEGER}("."{INTEGER})?{EXPONANT}? 26FLOAT {INTEGER}("."{INTEGER})?{EXPONANT}?
32 27
33%% 28%%
34 29
35 /* Basic tokens */ 30 /* Basic tokens */
36{SPACE} %{ ECHO; /* Skip blanks. */ %} 31[[:space:]]+ %{ /* ECHO; yylval->spaceValue = strdup(yytext); return LSL_SPACE; */ %}
37{NAME} %{ ECHO; /* yylval->nameValue=strdup(yytext); return LSL_NAME; */ %} 32{NAME} %{ ECHO; /* yylval->nameValue = strdup(yytext); return LSL_NAME; */ %}
38{INTEGER} %{ ECHO; yylval->integerValue = atoi(yytext); return LSL_INTEGER; %} 33{INTEGER} %{ ECHO; yylval->integerValue = atoi(yytext); return LSL_INTEGER; %}
39{FLOAT} %{ ECHO; /* yylval->floatValue = atof(yytext); return LSL_FLOAT; */ %} 34{FLOAT} %{ ECHO; /* yylval->floatValue = atof(yytext); return LSL_FLOAT; */ %}
40 35
@@ -74,12 +69,12 @@ int yywrap(yyscan_t yyscanner)
74{ 69{
75#ifdef FLEX_SCANNER 70#ifdef FLEX_SCANNER
76 #ifndef LL_WINDOWS 71 #ifndef LL_WINDOWS
77 // get gcc to stop complaining about lack of use of yyunput 72 // Get gcc to stop complaining about lack of use of yyunput and input.
78 (void) yyunput; 73 (void) yyunput;
79 (void) input; 74 (void) input;
80 #endif 75 #endif
81#endif 76#endif
82// TODO - If we are getting files from stdin, or multiple -f arguments, we should loop through them asd return 0. Return 1 when there are no more files. 77// TODO - If we are getting files from stdin, or multiple -f arguments, we should loop through them and return 0. Return 1 when there are no more files.
83 return(1); 78 return(1);
84} 79}
85 80