aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-21 19:24:53 +1000
committerDavid Walter Seikel2012-01-21 19:24:53 +1000
commitb27dab5443ca5919e7727fd2666559a6498d8c3d (patch)
tree685b024be28145d2a71cfd8d0c2a106032446a68
parentSecond part of the second pass to clean up functions used before they where d... (diff)
downloadSledjHamr-b27dab5443ca5919e7727fd2666559a6498d8c3d.zip
SledjHamr-b27dab5443ca5919e7727fd2666559a6498d8c3d.tar.gz
SledjHamr-b27dab5443ca5919e7727fd2666559a6498d8c3d.tar.bz2
SledjHamr-b27dab5443ca5919e7727fd2666559a6498d8c3d.tar.xz
Parse 'crements.
-rw-r--r--LuaSL/src/LuaSL_LSL_tree.h1
-rw-r--r--LuaSL/src/LuaSL_compile.c10
-rw-r--r--LuaSL/src/LuaSL_lemon_yaccer.y8
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
338void burnLeaf(void *data); 338void burnLeaf(void *data);
339LSL_Leaf *addCrement(LuaSL_compiler *compiler, LSL_Leaf *variable, LSL_Leaf *crement);
339LSL_Leaf *addFunction(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identifier, LSL_Leaf *open, LSL_Leaf *params, LSL_Leaf *close); 340LSL_Leaf *addFunction(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identifier, LSL_Leaf *open, LSL_Leaf *params, LSL_Leaf *close);
340LSL_Leaf *addFunctionBody(LuaSL_compiler *compiler, LSL_Leaf *function, LSL_Leaf *block); 341LSL_Leaf *addFunctionBody(LuaSL_compiler *compiler, LSL_Leaf *function, LSL_Leaf *block);
341LSL_Leaf *addFunctionCall(LuaSL_compiler *compiler, LSL_Leaf *identifier, LSL_Leaf *open, LSL_Leaf *params, LSL_Leaf *close); 342LSL_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
435LSL_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
435LSL_Leaf *addParameter(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identifier) 445LSL_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.
176identifier(A) ::= LSL_IDENTIFIER(B). { A = checkVariable(compiler, B); } 176identifier(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.
179expr ::= identifier LSL_DECREMENT_PRE. 179expr(A) ::= identifier(B) LSL_DECREMENT_PRE(C). { A = addCrement(compiler, B, C); }
180expr ::= identifier LSL_INCREMENT_PRE. 180expr(A) ::= identifier(B) LSL_INCREMENT_PRE(C). { A = addCrement(compiler, B, C); }
181expr ::= LSL_DECREMENT_PRE identifier. 181expr(A) ::= LSL_DECREMENT_PRE(C) identifier(B). { A = addCrement(compiler, B, C); }
182expr ::= LSL_INCREMENT_PRE identifier. 182expr(A) ::= LSL_INCREMENT_PRE(C) identifier(B). { A = addCrement(compiler, B, C); }
183 183
184%nonassoc LSL_COMMA. 184%nonassoc LSL_COMMA.
185 185