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_LSL_tree.h | |
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_LSL_tree.h')
-rw-r--r-- | LuaSL/src/LuaSL_LSL_tree.h | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h index a5d090e..7973509 100644 --- a/LuaSL/src/LuaSL_LSL_tree.h +++ b/LuaSL/src/LuaSL_LSL_tree.h | |||
@@ -8,6 +8,8 @@ | |||
8 | #define YY_NO_UNISTD_H 1 | 8 | #define YY_NO_UNISTD_H 1 |
9 | #endif // YY_NO_UNISTD_H | 9 | #endif // YY_NO_UNISTD_H |
10 | 10 | ||
11 | #include "LuaSL_yaccer.tab.h" | ||
12 | |||
11 | // http://w-hat.com/stackdepth is a useful discussion about some aspects of the LL parser. | 13 | // http://w-hat.com/stackdepth is a useful discussion about some aspects of the LL parser. |
12 | 14 | ||
13 | typedef enum | 15 | typedef enum |
@@ -20,6 +22,7 @@ typedef enum | |||
20 | LSL_CREATION = 16 | 22 | LSL_CREATION = 16 |
21 | } LSL_Flags; | 23 | } LSL_Flags; |
22 | 24 | ||
25 | /* | ||
23 | typedef enum // In order of precedence, high to low. | 26 | typedef enum // In order of precedence, high to low. |
24 | // Left to right, unless oterwise stated. | 27 | // Left to right, unless oterwise stated. |
25 | // According to http://wiki.secondlife.com/wiki/Category:LSL_Operators | 28 | // According to http://wiki.secondlife.com/wiki/Category:LSL_Operators |
@@ -69,6 +72,9 @@ typedef enum // In order of precedence, high to low. | |||
69 | LSL_BOOL_OR, | 72 | LSL_BOOL_OR, |
70 | LSL_BOOL_AND | 73 | LSL_BOOL_AND |
71 | } LSL_Operation; | 74 | } LSL_Operation; |
75 | */ | ||
76 | |||
77 | typedef int LSL_Operation; | ||
72 | 78 | ||
73 | typedef struct | 79 | typedef struct |
74 | { | 80 | { |
@@ -131,6 +137,7 @@ LSL_Operator LSL_Tokens[] = | |||
131 | }; | 137 | }; |
132 | #endif | 138 | #endif |
133 | 139 | ||
140 | /* | ||
134 | typedef enum | 141 | typedef enum |
135 | { | 142 | { |
136 | LSL_COMMENT, | 143 | LSL_COMMENT, |
@@ -162,6 +169,11 @@ typedef enum | |||
162 | LSL_STATE, | 169 | LSL_STATE, |
163 | LSL_SCRIPT | 170 | LSL_SCRIPT |
164 | } LSL_Type; | 171 | } LSL_Type; |
172 | */ | ||
173 | |||
174 | typedef int LSL_Type; | ||
175 | #define LSL_EXPRESSION 1 | ||
176 | |||
165 | 177 | ||
166 | #ifdef LSL_Keywords_define | 178 | #ifdef LSL_Keywords_define |
167 | char *LSL_Keywords[] = | 179 | char *LSL_Keywords[] = |
@@ -285,29 +297,6 @@ typedef union LSL_Leaf | |||
285 | LSL_Function *functionValue; | 297 | LSL_Function *functionValue; |
286 | LSL_State *stateValue; | 298 | LSL_State *stateValue; |
287 | LSL_Script *scriptValue; | 299 | LSL_Script *scriptValue; |
288 | } LSL_Leaf; | ||
289 | |||
290 | typedef struct LSL_AST | ||
291 | { | ||
292 | struct LSL_AST *left; | ||
293 | struct LSL_AST *right; | ||
294 | int line; | ||
295 | int character; | ||
296 | LSL_Type type; | ||
297 | LSL_Leaf content; | ||
298 | } LSL_AST; | ||
299 | |||
300 | |||
301 | /** | ||
302 | * @brief The structure used by flex and bison | ||
303 | */ | ||
304 | //typedef union tagTypeParser | ||
305 | //{ | ||
306 | // SExpression *expression; | ||
307 | // int value; | ||
308 | // int ival; | ||
309 | // float fval; | ||
310 | // char *sval; | ||
311 | // class LLScriptType *type; | 300 | // class LLScriptType *type; |
312 | // class LLScriptConstant *constant; | 301 | // class LLScriptConstant *constant; |
313 | // class LLScriptIdentifier *identifier; | 302 | // class LLScriptIdentifier *identifier; |
@@ -322,7 +311,18 @@ typedef struct LSL_AST | |||
322 | // class LLScriptState *state; | 311 | // class LLScriptState *state; |
323 | // class LLScritpGlobalStorage *global_store; | 312 | // class LLScritpGlobalStorage *global_store; |
324 | // class LLScriptScript *script; | 313 | // class LLScriptScript *script; |
325 | //}STypeParser; | 314 | } LSL_Leaf; |
315 | |||
316 | typedef struct LSL_AST | ||
317 | { | ||
318 | struct LSL_AST *left; | ||
319 | struct LSL_AST *right; | ||
320 | int line; | ||
321 | int character; | ||
322 | LSL_Type type; | ||
323 | LSL_Leaf content; | ||
324 | } LSL_AST; | ||
325 | |||
326 | 326 | ||
327 | // define the type for flex and bison | 327 | // define the type for flex and bison |
328 | #define YYSTYPE LSL_Leaf | 328 | #define YYSTYPE LSL_Leaf |
@@ -359,8 +359,6 @@ void convertExpression2Lua(LSL_Expression *exp); | |||
359 | int yyerror(const char *msg); | 359 | int yyerror(const char *msg); |
360 | int yyparse(void *param); | 360 | int yyparse(void *param); |
361 | 361 | ||
362 | #include "LuaSL_yaccer.tab.h" | ||
363 | |||
364 | 362 | ||
365 | #endif // __EXPRESSION_H__ | 363 | #endif // __EXPRESSION_H__ |
366 | 364 | ||