aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src/LuaSL_lemon_yaccer.y
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_lemon_yaccer.y
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_lemon_yaccer.y7
1 files changed, 4 insertions, 3 deletions
diff --git a/LuaSL/src/LuaSL_lemon_yaccer.y b/LuaSL/src/LuaSL_lemon_yaccer.y
index 828cf12..72d328c 100644
--- a/LuaSL/src/LuaSL_lemon_yaccer.y
+++ b/LuaSL/src/LuaSL_lemon_yaccer.y
@@ -71,11 +71,12 @@ statement(A) ::= LSL_DO(F) block(B) LSL_WHILE(W) LSL_PARENTHESIS_OPEN(L) expr(E)
71statement(A) ::= LSL_FOR(F) LSL_PARENTHESIS_OPEN(L) expr(E0) LSL_STATEMENT(S0) expr(E1) LSL_STATEMENT(S1) expr(E2) LSL_PARENTHESIS_CLOSE(R) block(B). { A = addStatement(compiler, NULL, F, L, E1, R, B, NULL); } // three expressions, two semi colons 71statement(A) ::= LSL_FOR(F) LSL_PARENTHESIS_OPEN(L) expr(E0) LSL_STATEMENT(S0) expr(E1) LSL_STATEMENT(S1) expr(E2) LSL_PARENTHESIS_CLOSE(R) block(B). { A = addStatement(compiler, NULL, F, L, E1, R, B, NULL); } // three expressions, two semi colons
72statement(A) ::= LSL_FOR(F) LSL_PARENTHESIS_OPEN(L) expr(E0) LSL_STATEMENT(S0) expr(E1) LSL_STATEMENT(S1) expr(E2) LSL_PARENTHESIS_CLOSE(R) statement(S). { A = addStatement(compiler, S, F, L, E1, R, NULL, NULL); } // three expressions, two semi colons 72statement(A) ::= LSL_FOR(F) LSL_PARENTHESIS_OPEN(L) expr(E0) LSL_STATEMENT(S0) expr(E1) LSL_STATEMENT(S1) expr(E2) LSL_PARENTHESIS_CLOSE(R) statement(S). { A = addStatement(compiler, S, F, L, E1, R, NULL, NULL); } // three expressions, two semi colons
73 73
74statement(A) ::= ifBlock(B). { A = B; } 74statement(A) ::= ifBlock(B). { A = B; }
75ifBlock ::= ifBlock LSL_ELSE block. 75ifBlock(A) ::= ifBlock(B) elseBlock(E). { A = addIfElse(compiler, B, E); }
76ifBlock ::= ifBlock LSL_ELSE statement.
77ifBlock(A) ::= LSL_IF(F) LSL_PARENTHESIS_OPEN(L) expr(E) LSL_PARENTHESIS_CLOSE(R) block(B). [LSL_ELSE] { A = addStatement(compiler, NULL, F, L, E, R, B, NULL); } 76ifBlock(A) ::= LSL_IF(F) LSL_PARENTHESIS_OPEN(L) expr(E) LSL_PARENTHESIS_CLOSE(R) block(B). [LSL_ELSE] { A = addStatement(compiler, NULL, F, L, E, R, B, NULL); }
78ifBlock(A) ::= LSL_IF(F) LSL_PARENTHESIS_OPEN(L) expr(E) LSL_PARENTHESIS_CLOSE(R) statement(S). [LSL_ELSE] { A = addStatement(compiler, S, F, L, E, R, NULL, NULL); } 77ifBlock(A) ::= LSL_IF(F) LSL_PARENTHESIS_OPEN(L) expr(E) LSL_PARENTHESIS_CLOSE(R) statement(S). [LSL_ELSE] { A = addStatement(compiler, S, F, L, E, R, NULL, NULL); }
78elseBlock(A) ::= LSL_ELSE(F) block(B). { A = addStatement(compiler, NULL, F, NULL, NULL, NULL, B, NULL); }
79elseBlock(A) ::= LSL_ELSE(F) statement(S). { A = addStatement(compiler, S, F, NULL, NULL, NULL, NULL, NULL); }
79 80
80statement(A) ::= LSL_JUMP(F) LSL_IDENTIFIER(I) LSL_STATEMENT(S). { A = addStatement(compiler, S, F, NULL, NULL, NULL, NULL, I); } 81statement(A) ::= LSL_JUMP(F) LSL_IDENTIFIER(I) LSL_STATEMENT(S). { A = addStatement(compiler, S, F, NULL, NULL, NULL, NULL, I); }
81statement(A) ::= LSL_RETURN(F) expr(E) LSL_STATEMENT(S). { A = addStatement(compiler, S, F, NULL, E, NULL, NULL, NULL); } 82statement(A) ::= LSL_RETURN(F) expr(E) LSL_STATEMENT(S). { A = addStatement(compiler, S, F, NULL, E, NULL, NULL, NULL); }