diff options
author | David Walter Seikel | 2012-01-21 19:24:53 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-21 19:24:53 +1000 |
commit | b27dab5443ca5919e7727fd2666559a6498d8c3d (patch) | |
tree | 685b024be28145d2a71cfd8d0c2a106032446a68 /LuaSL | |
parent | Second part of the second pass to clean up functions used before they where d... (diff) | |
download | SledjHamr-b27dab5443ca5919e7727fd2666559a6498d8c3d.zip SledjHamr-b27dab5443ca5919e7727fd2666559a6498d8c3d.tar.gz SledjHamr-b27dab5443ca5919e7727fd2666559a6498d8c3d.tar.bz2 SledjHamr-b27dab5443ca5919e7727fd2666559a6498d8c3d.tar.xz |
Parse 'crements.
Diffstat (limited to 'LuaSL')
-rw-r--r-- | LuaSL/src/LuaSL_LSL_tree.h | 1 | ||||
-rw-r--r-- | LuaSL/src/LuaSL_compile.c | 10 | ||||
-rw-r--r-- | LuaSL/src/LuaSL_lemon_yaccer.y | 8 |
3 files changed, 15 insertions, 4 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h index d537948..c0930b3 100644 --- a/LuaSL/src/LuaSL_LSL_tree.h +++ b/LuaSL/src/LuaSL_LSL_tree.h | |||
@@ -336,6 +336,7 @@ typedef struct | |||
336 | 336 | ||
337 | 337 | ||
338 | void burnLeaf(void *data); | 338 | void burnLeaf(void *data); |
339 | LSL_Leaf *addCrement(LuaSL_compiler *compiler, LSL_Leaf *variable, LSL_Leaf *crement); | ||
339 | LSL_Leaf *addFunction(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identifier, LSL_Leaf *open, LSL_Leaf *params, LSL_Leaf *close); | 340 | LSL_Leaf *addFunction(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identifier, LSL_Leaf *open, LSL_Leaf *params, LSL_Leaf *close); |
340 | LSL_Leaf *addFunctionBody(LuaSL_compiler *compiler, LSL_Leaf *function, LSL_Leaf *block); | 341 | LSL_Leaf *addFunctionBody(LuaSL_compiler *compiler, LSL_Leaf *function, LSL_Leaf *block); |
341 | LSL_Leaf *addFunctionCall(LuaSL_compiler *compiler, LSL_Leaf *identifier, LSL_Leaf *open, LSL_Leaf *params, LSL_Leaf *close); | 342 | LSL_Leaf *addFunctionCall(LuaSL_compiler *compiler, LSL_Leaf *identifier, LSL_Leaf *open, LSL_Leaf *params, LSL_Leaf *close); |
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index 5a3a68b..cb64038 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c | |||
@@ -432,6 +432,16 @@ LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, | |||
432 | return lval; | 432 | return lval; |
433 | } | 433 | } |
434 | 434 | ||
435 | LSL_Leaf *addCrement(LuaSL_compiler *compiler, LSL_Leaf *variable, LSL_Leaf *crement) | ||
436 | { | ||
437 | if ((variable) && (crement)) | ||
438 | { | ||
439 | crement->basicType = variable->basicType; | ||
440 | } | ||
441 | |||
442 | return crement; | ||
443 | } | ||
444 | |||
435 | LSL_Leaf *addParameter(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identifier) | 445 | LSL_Leaf *addParameter(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identifier) |
436 | { | 446 | { |
437 | LSL_Identifier *result = calloc(1, sizeof(LSL_Identifier)); | 447 | LSL_Identifier *result = calloc(1, sizeof(LSL_Identifier)); |
diff --git a/LuaSL/src/LuaSL_lemon_yaccer.y b/LuaSL/src/LuaSL_lemon_yaccer.y index 6e82578..4a5cb3b 100644 --- a/LuaSL/src/LuaSL_lemon_yaccer.y +++ b/LuaSL/src/LuaSL_lemon_yaccer.y | |||
@@ -176,10 +176,10 @@ identifier ::= identifier LSL_DOT LSL_IDENTIFIER. | |||
176 | identifier(A) ::= LSL_IDENTIFIER(B). { A = checkVariable(compiler, B); } | 176 | identifier(A) ::= LSL_IDENTIFIER(B). { A = checkVariable(compiler, B); } |
177 | 177 | ||
178 | %right LSL_DECREMENT_PRE LSL_INCREMENT_PRE LSL_DECREMENT_POST LSL_INCREMENT_POST. | 178 | %right LSL_DECREMENT_PRE LSL_INCREMENT_PRE LSL_DECREMENT_POST LSL_INCREMENT_POST. |
179 | expr ::= identifier LSL_DECREMENT_PRE. | 179 | expr(A) ::= identifier(B) LSL_DECREMENT_PRE(C). { A = addCrement(compiler, B, C); } |
180 | expr ::= identifier LSL_INCREMENT_PRE. | 180 | expr(A) ::= identifier(B) LSL_INCREMENT_PRE(C). { A = addCrement(compiler, B, C); } |
181 | expr ::= LSL_DECREMENT_PRE identifier. | 181 | expr(A) ::= LSL_DECREMENT_PRE(C) identifier(B). { A = addCrement(compiler, B, C); } |
182 | expr ::= LSL_INCREMENT_PRE identifier. | 182 | expr(A) ::= LSL_INCREMENT_PRE(C) identifier(B). { A = addCrement(compiler, B, C); } |
183 | 183 | ||
184 | %nonassoc LSL_COMMA. | 184 | %nonassoc LSL_COMMA. |
185 | 185 | ||