diff options
author | David Walter Seikel | 2012-01-06 14:06:47 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-06 14:06:47 +1000 |
commit | 8b6c0f0960aaf4b886d0004105df886e3d3c22e7 (patch) | |
tree | fc3299ba3694c8cf3b164cc3c4bedc649178720a /LuaSL/src/LuaSL_lexer.l | |
parent | Add more LSL parsing structure. (diff) | |
download | SledjHamr-8b6c0f0960aaf4b886d0004105df886e3d3c22e7.zip SledjHamr-8b6c0f0960aaf4b886d0004105df886e3d3c22e7.tar.gz SledjHamr-8b6c0f0960aaf4b886d0004105df886e3d3c22e7.tar.bz2 SledjHamr-8b6c0f0960aaf4b886d0004105df886e3d3c22e7.tar.xz |
Use the LSL_ enums for parser tokens. Some clean up and debugging.
OK, so the parsers prefer to make them defines instead of enums. sigh
Diffstat (limited to 'LuaSL/src/LuaSL_lexer.l')
-rw-r--r-- | LuaSL/src/LuaSL_lexer.l | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/LuaSL/src/LuaSL_lexer.l b/LuaSL/src/LuaSL_lexer.l index d204916..478e62c 100644 --- a/LuaSL/src/LuaSL_lexer.l +++ b/LuaSL/src/LuaSL_lexer.l | |||
@@ -8,24 +8,21 @@ | |||
8 | %option reentrant noyywrap never-interactive nounistd | 8 | %option reentrant noyywrap never-interactive nounistd |
9 | %option bison-bridge | 9 | %option bison-bridge |
10 | 10 | ||
11 | LPAREN "(" | 11 | SPACE [ \r\n\t]* |
12 | RPAREN ")" | ||
13 | PLUS "+" | ||
14 | MULTIPLY "*" | ||
15 | |||
16 | NUMBER [0-9]+ | 12 | NUMBER [0-9]+ |
17 | WS [ \r\n\t]* | 13 | NAME [a-zA-Z][a-zA-Z0-9]* |
18 | 14 | ||
19 | %% | 15 | %% |
20 | 16 | ||
21 | {WS} { /* Skip blanks. */ } | 17 | {SPACE} { /* Skip blanks. */ } |
22 | {NUMBER} { sscanf(yytext,"%d",&yylval->integerValue); return TOKEN_NUMBER; } | 18 | {NUMBER} { yylval->integerValue = atoi(yytext); return LSL_INTEGER; } |
19 | {NAME} { /* yylval->nameValue=strdup(yytext); return LSL_NAME; */ } | ||
23 | 20 | ||
24 | {MULTIPLY} { return TOKEN_MULTIPLY; } | 21 | "*" { return LSL_MULTIPLY; } |
25 | {PLUS} { return TOKEN_PLUS; } | 22 | "+" { return LSL_ADD; } |
26 | {LPAREN} { return TOKEN_LPAREN; } | 23 | "(" { return LSL_PARENTHESIS_OPEN; } |
27 | {RPAREN} { return TOKEN_RPAREN; } | 24 | ")" { return LSL_PARENTHESIS_CLOSE; } |
28 | . { } | 25 | . { /* This should return an "unknown character" error */ } |
29 | 26 | ||
30 | %% | 27 | %% |
31 | 28 | ||