diff options
Diffstat (limited to 'LuaSL/src/LuaSL_lemon_yaccer.y')
-rw-r--r-- | LuaSL/src/LuaSL_lemon_yaccer.y | 6 |
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. |
34 | stateBlock(A) ::= LSL_BLOCK_OPEN functionList(B) LSL_BLOCK_CLOSE. { A = B; } | 34 | stateBlock(A) ::= beginBlock(L) functionList(B) LSL_BLOCK_CLOSE(R). { A = addBlock(compiler, L, B, R); } |
35 | state(S) ::= LSL_DEFAULT(I) stateBlock(B). { S = addState(compiler, I, B); } | 35 | state(S) ::= LSL_DEFAULT(I) stateBlock(B). { S = addState(compiler, I, B); } |
36 | state(S) ::= LSL_STATE_CHANGE LSL_IDENTIFIER(I) stateBlock(B). { S = addState(compiler, I, B); } | 36 | state(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( | |||
57 | block(A) ::= funcBlock(B). { A = B; } | 57 | block(A) ::= funcBlock(B). { A = B; } |
58 | block(A) ::= statement(B). { A = B; } | 58 | block(A) ::= statement(B). { A = B; } |
59 | funcBlock(A) ::= LSL_BLOCK_OPEN statementList(B) LSL_BLOCK_CLOSE. { A = B; } | 59 | funcBlock(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. | ||
61 | funcBlock(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. |
86 | statement(A) ::= LSL_LABEL(F) LSL_IDENTIFIER(I) LSL_STATEMENT(S). { A = addStatement(compiler, S, F->toKen->type, NULL, NULL, NULL, NULL, I); } | 88 | statement(A) ::= LSL_LABEL(F) LSL_IDENTIFIER(I) LSL_STATEMENT(S). { A = addStatement(compiler, S, F->toKen->type, NULL, NULL, NULL, NULL, I); } |
87 | 89 | ||
90 | beginBlock(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. |
89 | statement(A) ::= expr(E) LSL_STATEMENT(S). { A = addStatement(compiler, S, LSL_EXPRESSION, NULL, E, NULL, NULL, NULL); } | 93 | statement(A) ::= expr(E) LSL_STATEMENT(S). { A = addStatement(compiler, S, LSL_EXPRESSION, NULL, E, NULL, NULL, NULL); } |
90 | 94 | ||