diff options
author | David Walter Seikel | 2012-01-08 09:01:44 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-08 09:01:44 +1000 |
commit | 0306182b9bcafa7f850dd91aa196ae7d562d2254 (patch) | |
tree | c815ac4506e27ed285a67d5ca1f936f40b90b9b6 /LuaSL/src/LuaSL_LSL_tree.h | |
parent | Parenthesis and statement parsing. (diff) | |
download | SledjHamr-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_LSL_tree.h')
-rw-r--r-- | LuaSL/src/LuaSL_LSL_tree.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h index 597db54..0b2f125 100644 --- a/LuaSL/src/LuaSL_LSL_tree.h +++ b/LuaSL/src/LuaSL_LSL_tree.h | |||
@@ -89,16 +89,12 @@ typedef enum // In order of precedence, high to low. | |||
89 | LSL_BIT_XOR, | 89 | LSL_BIT_XOR, |
90 | LSL_BIT_OR, | 90 | LSL_BIT_OR, |
91 | LSL_BOOL_OR, | 91 | LSL_BOOL_OR, |
92 | LSL_BOOL_AND | 92 | LSL_BOOL_AND, |
93 | } LSL_Operation; | ||
94 | #else | ||
95 | typedef int LSL_Operation; | ||
96 | #endif | ||
97 | 93 | ||
98 | #ifdef LUASL_USE_ENUM | 94 | // The rest are not operater types. |
99 | typedef enum | 95 | |
100 | { | 96 | LSL_SPACE, |
101 | LSL_COMMENT = (LSL_BOOL_AND + 1), | 97 | LSL_COMMENT, |
102 | LSL_TYPE, | 98 | LSL_TYPE, |
103 | LSL_NAME, | 99 | LSL_NAME, |
104 | LSL_IDENTIFIER, | 100 | LSL_IDENTIFIER, |
@@ -125,7 +121,8 @@ typedef enum | |||
125 | LSL_PARAMETER, | 121 | LSL_PARAMETER, |
126 | LSL_FUNCTION, | 122 | LSL_FUNCTION, |
127 | LSL_STATE, | 123 | LSL_STATE, |
128 | LSL_SCRIPT | 124 | LSL_SCRIPT, |
125 | LSL_UNKNOWN | ||
129 | } LSL_Type; | 126 | } LSL_Type; |
130 | #else | 127 | #else |
131 | typedef int LSL_Type; | 128 | typedef int LSL_Type; |
@@ -166,6 +163,7 @@ typedef struct | |||
166 | 163 | ||
167 | typedef union LSL_Leaf | 164 | typedef union LSL_Leaf |
168 | { | 165 | { |
166 | char *spaceValue; | ||
169 | char *commentValue; | 167 | char *commentValue; |
170 | LSL_Type typeValue; | 168 | LSL_Type typeValue; |
171 | char *nameValue; | 169 | char *nameValue; |
@@ -178,7 +176,7 @@ typedef union LSL_Leaf | |||
178 | float rotationValue[4]; | 176 | float rotationValue[4]; |
179 | union LSL_Leaf *listValue; | 177 | union LSL_Leaf *listValue; |
180 | char *labelValue; | 178 | char *labelValue; |
181 | LSL_Operation operationValue; | 179 | LSL_Type operationValue; |
182 | struct LSL_AST *expressionValue; | 180 | struct LSL_AST *expressionValue; |
183 | LSL_Statement *doValue; | 181 | LSL_Statement *doValue; |
184 | LSL_Statement *forValue; | 182 | LSL_Statement *forValue; |
@@ -192,6 +190,7 @@ typedef union LSL_Leaf | |||
192 | LSL_Function *functionValue; | 190 | LSL_Function *functionValue; |
193 | LSL_State *stateValue; | 191 | LSL_State *stateValue; |
194 | LSL_Script *scriptValue; | 192 | LSL_Script *scriptValue; |
193 | char *unknownValue; | ||
195 | } LSL_Leaf; | 194 | } LSL_Leaf; |
196 | 195 | ||
197 | typedef struct | 196 | typedef struct |
@@ -257,10 +256,11 @@ typedef struct | |||
257 | 256 | ||
258 | LSL_AST *addExpression(LSL_AST *exp); | 257 | LSL_AST *addExpression(LSL_AST *exp); |
259 | LSL_AST *addInteger(int value); | 258 | LSL_AST *addInteger(int value); |
260 | LSL_AST *addOperation(LSL_Operation type, LSL_AST *left, LSL_AST *right); | 259 | LSL_AST *addOperation(LSL_Type type, LSL_AST *left, LSL_AST *right); |
261 | LSL_AST *addParenthesis(LSL_AST *expr); | 260 | LSL_AST *addParenthesis(LSL_AST *expr); |
262 | LSL_Statement *createStatement(LSL_Type type, LSL_AST *expr); | 261 | LSL_Statement *createStatement(LSL_Type type, LSL_AST *root); |
263 | LSL_AST *addStatement(LSL_Statement *statement, LSL_AST *left); | 262 | LSL_AST *addStatement(LSL_Statement *statement, LSL_AST *root); |
263 | LSL_AST *addSpace(char *text, LSL_AST *root); | ||
264 | 264 | ||
265 | int yyerror(const char *msg); | 265 | int yyerror(const char *msg); |
266 | int yyparse(void *param); | 266 | int yyparse(void *param); |