aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src/LuaSL_compile.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-02-01 22:17:02 +1000
committerDavid Walter Seikel2012-02-01 22:17:02 +1000
commiteb3278594f50be28c048c11d96bd814c1ebbdf3a (patch)
treed2ac96425f7ae276be667c68e287e7b2d253e3b8 /LuaSL/src/LuaSL_compile.c
parentTrack event handlers differently from functions. (diff)
downloadSledjHamr-eb3278594f50be28c048c11d96bd814c1ebbdf3a.zip
SledjHamr-eb3278594f50be28c048c11d96bd814c1ebbdf3a.tar.gz
SledjHamr-eb3278594f50be28c048c11d96bd814c1ebbdf3a.tar.bz2
SledjHamr-eb3278594f50be28c048c11d96bd814c1ebbdf3a.tar.xz
Deal with parsing if ... else ...
Diffstat (limited to '')
-rw-r--r--LuaSL/src/LuaSL_compile.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c
index 9c86f97..eada67f 100644
--- a/LuaSL/src/LuaSL_compile.c
+++ b/LuaSL/src/LuaSL_compile.c
@@ -727,6 +727,12 @@ LSL_Leaf *addState(LuaSL_compiler *compiler, LSL_Leaf *state, LSL_Leaf *identifi
727 return identifier; 727 return identifier;
728} 728}
729 729
730LSL_Leaf *addIfElse(LuaSL_compiler *compiler, LSL_Leaf *ifBlock, LSL_Leaf *elseBlock)
731{
732 ifBlock->value.statementValue->elseBlock = elseBlock->value.statementValue;
733 return ifBlock;
734}
735
730LSL_Leaf *addStatement(LuaSL_compiler *compiler, LSL_Leaf *lval, LSL_Leaf *flow, LSL_Leaf *left, LSL_Leaf *expr, LSL_Leaf *right, LSL_Leaf *block, LSL_Leaf *identifier) 736LSL_Leaf *addStatement(LuaSL_compiler *compiler, LSL_Leaf *lval, LSL_Leaf *flow, LSL_Leaf *left, LSL_Leaf *expr, LSL_Leaf *right, LSL_Leaf *block, LSL_Leaf *identifier)
731{ 737{
732 gameGlobals *game = compiler->game; 738 gameGlobals *game = compiler->game;
@@ -1427,6 +1433,7 @@ static void outputRawStatement(FILE *file, outputMode mode, LSL_Statement *state
1427 } 1433 }
1428 case LSL_ELSE : 1434 case LSL_ELSE :
1429 { 1435 {
1436 isBlock = TRUE;
1430#if LUASL_DIFF_CHECK 1437#if LUASL_DIFF_CHECK
1431 if ((statement->ignorable) && (statement->ignorable[1])) 1438 if ((statement->ignorable) && (statement->ignorable[1]))
1432 fwrite(eina_strbuf_string_get(statement->ignorable[1]), 1, eina_strbuf_length_get(statement->ignorable[1]), file); 1439 fwrite(eina_strbuf_string_get(statement->ignorable[1]), 1, eina_strbuf_length_get(statement->ignorable[1]), file);
@@ -1509,6 +1516,9 @@ static void outputRawStatement(FILE *file, outputMode mode, LSL_Statement *state
1509 if (!LUASL_DIFF_CHECK) 1516 if (!LUASL_DIFF_CHECK)
1510 fprintf(file, "\n"); 1517 fprintf(file, "\n");
1511 } 1518 }
1519
1520 if (statement->elseBlock)
1521 outputRawStatement(file, mode, statement->elseBlock);
1512 } 1522 }
1513} 1523}
1514 1524