diff options
Diffstat (limited to '')
-rw-r--r-- | LuaSL/src/LuaSL_lemon_yaccer.y | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/LuaSL/src/LuaSL_lemon_yaccer.y b/LuaSL/src/LuaSL_lemon_yaccer.y index d5a6751..a0defc5 100644 --- a/LuaSL/src/LuaSL_lemon_yaccer.y +++ b/LuaSL/src/LuaSL_lemon_yaccer.y | |||
@@ -24,7 +24,7 @@ program ::= script LSL_SCRIPT(A). { if (NULL != A) A->left = compiler->ast; | |||
24 | 24 | ||
25 | %nonassoc LSL_SCRIPT. | 25 | %nonassoc LSL_SCRIPT. |
26 | script ::= script state(A). { if (NULL != A) A->left = compiler->ast; compiler->ast = A; } | 26 | script ::= script state(A). { if (NULL != A) A->left = compiler->ast; compiler->ast = A; } |
27 | script ::= script function(A). { if (NULL != A) A->left = compiler->ast; compiler->ast = A; } | 27 | script ::= script functionBody(A). { if (NULL != A) A->left = compiler->ast; compiler->ast = A; } |
28 | script ::= script statement(A). { if (NULL != A) A->left = compiler->ast; compiler->ast = A; } | 28 | script ::= script statement(A). { if (NULL != A) A->left = compiler->ast; compiler->ast = A; } |
29 | script ::= . | 29 | script ::= . |
30 | 30 | ||
@@ -37,16 +37,18 @@ state(S) ::= LSL_IDENTIFIER(I) stateBlock(B). { S = addState(compiler, I, B) | |||
37 | // Function definitions. | 37 | // Function definitions. |
38 | 38 | ||
39 | %nonassoc LSL_PARAMETER LSL_PARAMETER_LIST LSL_FUNCTION. | 39 | %nonassoc LSL_PARAMETER LSL_PARAMETER_LIST LSL_FUNCTION. |
40 | functionList ::= functionList function. | 40 | functionList ::= functionList functionBody. |
41 | functionList ::= . | 41 | functionList ::= . |
42 | 42 | ||
43 | parameterList(A) ::= parameterList(B) LSL_COMMA(C) parameter(D). { A = collectParameters(B, C, D); } | 43 | functionBody(A) ::= function(B) funcBlock(C). { A = addFunctionBody(compiler, B, C); } |
44 | parameterList(A) ::= parameter(D). { A = collectParameters(NULL, NULL, D); } | 44 | |
45 | parameterList(A) ::= . { A = collectParameters(NULL, NULL, NULL); } | 45 | parameterList(A) ::= parameterList(B) LSL_COMMA(C) parameter(D). { A = collectParameters(compiler, B, C, D); } |
46 | parameter(A) ::= type(B) LSL_IDENTIFIER(C). { A = addParameter(B, C); } | 46 | parameterList(A) ::= parameter(D). { A = collectParameters(compiler, NULL, NULL, D); } |
47 | parameterList(A) ::= . { A = collectParameters(compiler, NULL, NULL, NULL); } | ||
48 | parameter(A) ::= type(B) LSL_IDENTIFIER(C). { A = addParameter(compiler, B, C); } | ||
47 | // Causes a conflict when it's an empty parameterList with calling the same type of function. | 49 | // Causes a conflict when it's an empty parameterList with calling the same type of function. |
48 | function(A) ::= LSL_IDENTIFIER(C) LSL_PARENTHESIS_OPEN(D) parameterList(E) LSL_PARENTHESIS_CLOSE(F) funcBlock(G). { A = addFunction(compiler, NULL, C, D, E, F, G); } | 50 | function(A) ::= LSL_IDENTIFIER(C) LSL_PARENTHESIS_OPEN(D) parameterList(E) LSL_PARENTHESIS_CLOSE(F). { A = addFunction(compiler, NULL, C, D, E, F); } |
49 | function(A) ::= type(B) LSL_IDENTIFIER(C) LSL_PARENTHESIS_OPEN(D) parameterList(E) LSL_PARENTHESIS_CLOSE(F) funcBlock(G). { A = addFunction(compiler, B, C, D, E, F, G); } | 51 | function(A) ::= type(B) LSL_IDENTIFIER(C) LSL_PARENTHESIS_OPEN(D) parameterList(E) LSL_PARENTHESIS_CLOSE(F). { A = addFunction(compiler, B, C, D, E, F); } |
50 | 52 | ||
51 | // Blocks. | 53 | // Blocks. |
52 | 54 | ||