aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL
diff options
context:
space:
mode:
Diffstat (limited to 'LuaSL')
-rw-r--r--LuaSL/src/LuaSL_lemon_yaccer.y13
1 files changed, 6 insertions, 7 deletions
diff --git a/LuaSL/src/LuaSL_lemon_yaccer.y b/LuaSL/src/LuaSL_lemon_yaccer.y
index 5ae66ce..e15078b 100644
--- a/LuaSL/src/LuaSL_lemon_yaccer.y
+++ b/LuaSL/src/LuaSL_lemon_yaccer.y
@@ -42,7 +42,7 @@ functionList(A) ::= functionList(B) functionBody(C). { A = collectStatements(
42functionList(A) ::= functionBody(C). { A = collectStatements(compiler, NULL, C); } 42functionList(A) ::= functionBody(C). { A = collectStatements(compiler, NULL, C); }
43functionList(A) ::= . { A = collectStatements(compiler, NULL, NULL); } 43functionList(A) ::= . { A = collectStatements(compiler, NULL, NULL); }
44 44
45functionBody(A) ::= function(F) funcBlock(B). { A = addFunctionBody(compiler, F, B); } // addFunctionBody has an implied addStatement(compiler, NULL, LSL_FUNCTION, NULL, B, NULL, NULL); 45functionBody(A) ::= function(F) block(B). { A = addFunctionBody(compiler, F, B); } // addFunctionBody has an implied addStatement(compiler, NULL, LSL_FUNCTION, NULL, B, NULL, NULL);
46 46
47parameterList(A) ::= parameterList(B) LSL_COMMA(C) parameter(D). { A = collectParameters(compiler, B, C, D); } 47parameterList(A) ::= parameterList(B) LSL_COMMA(C) parameter(D). { A = collectParameters(compiler, B, C, D); }
48parameterList(A) ::= parameter(D). { A = collectParameters(compiler, NULL, NULL, D); } 48parameterList(A) ::= parameter(D). { A = collectParameters(compiler, NULL, NULL, D); }
@@ -54,10 +54,7 @@ function(A) ::= type(B) LSL_IDENTIFIER(C) LSL_PARENTHESIS_OPEN(D) parameterList(
54 54
55// Blocks. 55// Blocks.
56 56
57block(A) ::= funcBlock(B). { A = B; } 57block(A) ::= beginBlock(L) statementList(B) LSL_BLOCK_CLOSE(R). { A = addBlock(compiler, L, B, R); }
58block(A) ::= statementList(B). { A = B; }
59// Perhaps change this to block? No ,this is what differentiates it from a single statement, which functions can't handle.
60funcBlock(A) ::= beginBlock(L) statementList(B) LSL_BLOCK_CLOSE(R). { A = addBlock(compiler, L, B, R); }
61 58
62// Various forms of statement. 59// Various forms of statement.
63 60
@@ -71,10 +68,11 @@ statementList(A) ::= . { A = collectStatements(compiler, NULL, NULL); }
71%nonassoc LSL_ELSE. 68%nonassoc LSL_ELSE.
72statement(A) ::= LSL_DO(F) block(B) LSL_WHILE(W) LSL_PARENTHESIS_OPEN(L) expr(E) LSL_PARENTHESIS_CLOSE(R) LSL_STATEMENT(S). { A = addStatement(compiler, S, F->toKen->type, L, E, R, B, W); } 69statement(A) ::= LSL_DO(F) block(B) LSL_WHILE(W) LSL_PARENTHESIS_OPEN(L) expr(E) LSL_PARENTHESIS_CLOSE(R) LSL_STATEMENT(S). { A = addStatement(compiler, S, F->toKen->type, L, E, R, B, W); }
73statement(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->toKen->type, L, E1, R, B, NULL); } // three expressions, two semi colons 70statement(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->toKen->type, 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) statement(S). { A = addStatement(compiler, S, F->toKen->type, L, E1, R, NULL, NULL); } // three expressions, two semi colons
74 72
75statement(A) ::= ifBlock(B). { A = B; } 73statement(A) ::= ifBlock(B). { A = B; }
76//ifBlock ::= ifBlock LSL_ELSE block. 74ifBlock ::= ifBlock LSL_ELSE block.
77statement ::= LSL_ELSE block. 75ifBlock ::= ifBlock LSL_ELSE statement.
78ifBlock(A) ::= LSL_IF(F) LSL_PARENTHESIS_OPEN(L) expr(E) LSL_PARENTHESIS_CLOSE(R) block(B). /*[LSL_ELSE]*/ { A = addStatement(compiler, NULL, F->toKen->type, L, E, R, B, NULL); } // optional else, optional else if 76ifBlock(A) ::= LSL_IF(F) LSL_PARENTHESIS_OPEN(L) expr(E) LSL_PARENTHESIS_CLOSE(R) block(B). /*[LSL_ELSE]*/ { A = addStatement(compiler, NULL, F->toKen->type, L, E, R, B, NULL); } // optional else, optional else if
79ifBlock(A) ::= LSL_IF(F) LSL_PARENTHESIS_OPEN(L) expr(E) LSL_PARENTHESIS_CLOSE(R) statement(S). /*[LSL_ELSE]*/ { A = addStatement(compiler, S, F->toKen->type, L, E, R, NULL, NULL); } // optional else, optional else if 77ifBlock(A) ::= LSL_IF(F) LSL_PARENTHESIS_OPEN(L) expr(E) LSL_PARENTHESIS_CLOSE(R) statement(S). /*[LSL_ELSE]*/ { A = addStatement(compiler, S, F->toKen->type, L, E, R, NULL, NULL); } // optional else, optional else if
80 78
@@ -84,6 +82,7 @@ statement(A) ::= LSL_RETURN(F) LSL_STATEMENT(S). { A = addStatement(
84statement(A) ::= LSL_STATE_CHANGE(F) LSL_DEFAULT(I) LSL_STATEMENT(S). { A = addStatement(compiler, S, F->toKen->type, NULL, NULL, NULL, NULL, I); } 82statement(A) ::= LSL_STATE_CHANGE(F) LSL_DEFAULT(I) LSL_STATEMENT(S). { A = addStatement(compiler, S, F->toKen->type, NULL, NULL, NULL, NULL, I); }
85statement(A) ::= LSL_STATE_CHANGE(F) LSL_IDENTIFIER(I) LSL_STATEMENT(S). { A = addStatement(compiler, S, F->toKen->type, NULL, NULL, NULL, NULL, I); } 83statement(A) ::= LSL_STATE_CHANGE(F) LSL_IDENTIFIER(I) LSL_STATEMENT(S). { A = addStatement(compiler, S, F->toKen->type, NULL, NULL, NULL, NULL, I); }
86statement(A) ::= LSL_WHILE(F) LSL_PARENTHESIS_OPEN(L) expr(E) LSL_PARENTHESIS_CLOSE(R) block(B). { A = addStatement(compiler, NULL, F->toKen->type, L, E, R, B, NULL); } 84statement(A) ::= LSL_WHILE(F) LSL_PARENTHESIS_OPEN(L) expr(E) LSL_PARENTHESIS_CLOSE(R) block(B). { A = addStatement(compiler, NULL, F->toKen->type, L, E, R, B, NULL); }
85statement(A) ::= LSL_WHILE(F) LSL_PARENTHESIS_OPEN(L) expr(E) LSL_PARENTHESIS_CLOSE(R) statement(S). { A = addStatement(compiler, S, F->toKen->type, L, E, R, NULL, NULL); }
87 86
88%nonassoc LSL_LABEL. 87%nonassoc LSL_LABEL.
89statement(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); }