aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src/LuaSL_lemon_yaccer.y
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-30 13:33:11 +1000
committerDavid Walter Seikel2012-01-30 13:33:11 +1000
commit8b71bc2d2905ca2ded0789a5534efc914ea84858 (patch)
treea0d16e863f4a65c6dc60bfbe77504e22b950dc3a /LuaSL/src/LuaSL_lemon_yaccer.y
parenttoken -> toKen. Seems to be a key word somewhere, best to be safe. (diff)
downloadSledjHamr-8b71bc2d2905ca2ded0789a5534efc914ea84858.zip
SledjHamr-8b71bc2d2905ca2ded0789a5534efc914ea84858.tar.gz
SledjHamr-8b71bc2d2905ca2ded0789a5534efc914ea84858.tar.bz2
SledjHamr-8b71bc2d2905ca2ded0789a5534efc914ea84858.tar.xz
Change the way blocks start and end, the look ahead was screwing things.
Diffstat (limited to '')
-rw-r--r--LuaSL/src/LuaSL_lemon_yaccer.y6
1 files changed, 5 insertions, 1 deletions
diff --git a/LuaSL/src/LuaSL_lemon_yaccer.y b/LuaSL/src/LuaSL_lemon_yaccer.y
index 125b384..ed53fd4 100644
--- a/LuaSL/src/LuaSL_lemon_yaccer.y
+++ b/LuaSL/src/LuaSL_lemon_yaccer.y
@@ -31,7 +31,7 @@ script ::= .
31// State definitions. 31// State definitions.
32 32
33%nonassoc LSL_BLOCK_OPEN LSL_BLOCK_CLOSE LSL_STATE. 33%nonassoc LSL_BLOCK_OPEN LSL_BLOCK_CLOSE LSL_STATE.
34stateBlock(A) ::= LSL_BLOCK_OPEN functionList(B) LSL_BLOCK_CLOSE. { A = B; } 34stateBlock(A) ::= beginBlock(L) functionList(B) LSL_BLOCK_CLOSE(R). { A = addBlock(compiler, L, B, R); }
35state(S) ::= LSL_DEFAULT(I) stateBlock(B). { S = addState(compiler, I, B); } 35state(S) ::= LSL_DEFAULT(I) stateBlock(B). { S = addState(compiler, I, B); }
36state(S) ::= LSL_STATE_CHANGE LSL_IDENTIFIER(I) stateBlock(B). { S = addState(compiler, I, B); } 36state(S) ::= LSL_STATE_CHANGE LSL_IDENTIFIER(I) stateBlock(B). { S = addState(compiler, I, B); }
37 37
@@ -57,6 +57,8 @@ function(A) ::= type(B) LSL_IDENTIFIER(C) LSL_PARENTHESIS_OPEN(D) parameterList(
57block(A) ::= funcBlock(B). { A = B; } 57block(A) ::= funcBlock(B). { A = B; }
58block(A) ::= statement(B). { A = B; } 58block(A) ::= statement(B). { A = B; }
59funcBlock(A) ::= LSL_BLOCK_OPEN statementList(B) LSL_BLOCK_CLOSE. { A = B; } 59funcBlock(A) ::= LSL_BLOCK_OPEN statementList(B) LSL_BLOCK_CLOSE. { A = B; }
60// Perhaps change this to block? No ,this is what differentiates it from a single statement, which functions can't handle.
61funcBlock(A) ::= beginBlock(L) statementList(B) LSL_BLOCK_CLOSE(R). { A = addBlock(compiler, L, B, R); }
60 62
61// Various forms of statement. 63// Various forms of statement.
62 64
@@ -85,6 +87,8 @@ statement(A) ::= LSL_WHILE(F) LSL_PARENTHESIS_OPEN(L) expr(E) LSL_PARENTHESIS_CL
85%nonassoc LSL_LABEL. 87%nonassoc LSL_LABEL.
86statement(A) ::= LSL_LABEL(F) LSL_IDENTIFIER(I) LSL_STATEMENT(S). { A = addStatement(compiler, S, F->toKen->type, NULL, NULL, NULL, NULL, I); } 88statement(A) ::= LSL_LABEL(F) LSL_IDENTIFIER(I) LSL_STATEMENT(S). { A = addStatement(compiler, S, F->toKen->type, NULL, NULL, NULL, NULL, I); }
87 89
90beginBlock(A) ::= LSL_BLOCK_OPEN(B). { A = beginBlock(compiler, B); }
91
88// This might be bogus, or might be valid LSL, but it lets us test the expression parser by evaluating them. 92// This might be bogus, or might be valid LSL, but it lets us test the expression parser by evaluating them.
89statement(A) ::= expr(E) LSL_STATEMENT(S). { A = addStatement(compiler, S, LSL_EXPRESSION, NULL, E, NULL, NULL, NULL); } 93statement(A) ::= expr(E) LSL_STATEMENT(S). { A = addStatement(compiler, S, LSL_EXPRESSION, NULL, E, NULL, NULL, NULL); }
90 94