aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src/LuaSL_lemon_yaccer.y
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-17 19:52:21 +1000
committerDavid Walter Seikel2012-01-17 19:52:21 +1000
commit36f91bf237a2d48e27171c6661eff9cc255214d0 (patch)
tree9991a29a402c321ab1d83f00cb3a81e3cf8ba5a6 /LuaSL/src/LuaSL_lemon_yaccer.y
parentChange to the stringshared hash, it's way faster. (diff)
downloadSledjHamr-36f91bf237a2d48e27171c6661eff9cc255214d0.zip
SledjHamr-36f91bf237a2d48e27171c6661eff9cc255214d0.tar.gz
SledjHamr-36f91bf237a2d48e27171c6661eff9cc255214d0.tar.bz2
SledjHamr-36f91bf237a2d48e27171c6661eff9cc255214d0.tar.xz
Add function parameters to the search list.
Diffstat (limited to 'LuaSL/src/LuaSL_lemon_yaccer.y')
-rw-r--r--LuaSL/src/LuaSL_lemon_yaccer.y18
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.
26script ::= script state(A). { if (NULL != A) A->left = compiler->ast; compiler->ast = A; } 26script ::= script state(A). { if (NULL != A) A->left = compiler->ast; compiler->ast = A; }
27script ::= script function(A). { if (NULL != A) A->left = compiler->ast; compiler->ast = A; } 27script ::= script functionBody(A). { if (NULL != A) A->left = compiler->ast; compiler->ast = A; }
28script ::= script statement(A). { if (NULL != A) A->left = compiler->ast; compiler->ast = A; } 28script ::= script statement(A). { if (NULL != A) A->left = compiler->ast; compiler->ast = A; }
29script ::= . 29script ::= .
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.
40functionList ::= functionList function. 40functionList ::= functionList functionBody.
41functionList ::= . 41functionList ::= .
42 42
43parameterList(A) ::= parameterList(B) LSL_COMMA(C) parameter(D). { A = collectParameters(B, C, D); } 43functionBody(A) ::= function(B) funcBlock(C). { A = addFunctionBody(compiler, B, C); }
44parameterList(A) ::= parameter(D). { A = collectParameters(NULL, NULL, D); } 44
45parameterList(A) ::= . { A = collectParameters(NULL, NULL, NULL); } 45parameterList(A) ::= parameterList(B) LSL_COMMA(C) parameter(D). { A = collectParameters(compiler, B, C, D); }
46parameter(A) ::= type(B) LSL_IDENTIFIER(C). { A = addParameter(B, C); } 46parameterList(A) ::= parameter(D). { A = collectParameters(compiler, NULL, NULL, D); }
47parameterList(A) ::= . { A = collectParameters(compiler, NULL, NULL, NULL); }
48parameter(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.
48function(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); } 50function(A) ::= LSL_IDENTIFIER(C) LSL_PARENTHESIS_OPEN(D) parameterList(E) LSL_PARENTHESIS_CLOSE(F). { A = addFunction(compiler, NULL, C, D, E, F); }
49function(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); } 51function(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