diff options
Diffstat (limited to 'LuaSL')
-rw-r--r-- | LuaSL/src/LuaSL_LSL_tree.h | 1 | ||||
-rw-r--r-- | LuaSL/src/LuaSL_compile.c | 11 | ||||
-rw-r--r-- | LuaSL/src/LuaSL_lemon_yaccer.y | 2 |
3 files changed, 13 insertions, 1 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h index dee6263..2c2bfa6 100644 --- a/LuaSL/src/LuaSL_LSL_tree.h +++ b/LuaSL/src/LuaSL_LSL_tree.h | |||
@@ -286,6 +286,7 @@ LSL_Leaf *addTypecast(LSL_Leaf *lval, LSL_Leaf *type, LSL_Leaf *rval, LSL_Leaf * | |||
286 | LSL_Leaf *addVariable(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identifier, LSL_Leaf *assignment, LSL_Leaf *expr); | 286 | LSL_Leaf *addVariable(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identifier, LSL_Leaf *assignment, LSL_Leaf *expr); |
287 | 287 | ||
288 | void beginBlock(LuaSL_compiler *compiler, LSL_Leaf *block); | 288 | void beginBlock(LuaSL_compiler *compiler, LSL_Leaf *block); |
289 | LSL_Leaf *checkVariable(LuaSL_compiler *compiler, LSL_Leaf *identifier); | ||
289 | LSL_Leaf *collectParameters(LSL_Leaf *list, LSL_Leaf *comma, LSL_Leaf *newParam); | 290 | LSL_Leaf *collectParameters(LSL_Leaf *list, LSL_Leaf *comma, LSL_Leaf *newParam); |
290 | void endBlock(LuaSL_compiler *compiler, LSL_Leaf *block); | 291 | void endBlock(LuaSL_compiler *compiler, LSL_Leaf *block); |
291 | 292 | ||
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index 65a8089..6d82fb6 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c | |||
@@ -230,6 +230,17 @@ static LSL_Leaf *findVariable(LuaSL_compiler *compiler, const char *name) | |||
230 | return var; | 230 | return var; |
231 | } | 231 | } |
232 | 232 | ||
233 | LSL_Leaf *checkVariable(LuaSL_compiler *compiler, LSL_Leaf *identifier) | ||
234 | { | ||
235 | gameGlobals *game = compiler->game; | ||
236 | LSL_Leaf *var = findVariable(compiler, identifier->value.stringValue); | ||
237 | |||
238 | if (NULL == var) | ||
239 | PE("NOT Found %s!", identifier->value.stringValue); | ||
240 | |||
241 | return var; | ||
242 | } | ||
243 | |||
233 | LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, LSL_Leaf *right) | 244 | LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, LSL_Leaf *right) |
234 | { | 245 | { |
235 | gameGlobals *game = compiler->game; | 246 | gameGlobals *game = compiler->game; |
diff --git a/LuaSL/src/LuaSL_lemon_yaccer.y b/LuaSL/src/LuaSL_lemon_yaccer.y index 560c6ab..d5a6751 100644 --- a/LuaSL/src/LuaSL_lemon_yaccer.y +++ b/LuaSL/src/LuaSL_lemon_yaccer.y | |||
@@ -167,7 +167,7 @@ statement(A) ::= type(B) LSL_IDENTIFIER(C) LSL_STATEMENT(F). { A = addStatem | |||
167 | 167 | ||
168 | %right LSL_DOT LSL_IDENTIFIER. | 168 | %right LSL_DOT LSL_IDENTIFIER. |
169 | identifier ::= identifier LSL_DOT LSL_IDENTIFIER. | 169 | identifier ::= identifier LSL_DOT LSL_IDENTIFIER. |
170 | identifier(A) ::= LSL_IDENTIFIER(B). { A = B; } | 170 | identifier(A) ::= LSL_IDENTIFIER(B). { A = checkVariable(compiler, B); } |
171 | 171 | ||
172 | %right LSL_DECREMENT_PRE LSL_INCREMENT_PRE LSL_DECREMENT_POST LSL_INCREMENT_POST. | 172 | %right LSL_DECREMENT_PRE LSL_INCREMENT_PRE LSL_DECREMENT_POST LSL_INCREMENT_POST. |
173 | expr ::= identifier LSL_DECREMENT_PRE. | 173 | expr ::= identifier LSL_DECREMENT_PRE. |