aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src/LuaSL_lemon_yaccer.y
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-21 16:10:25 +1000
committerDavid Walter Seikel2012-01-21 16:10:25 +1000
commit217e4fcd7d750396b168c65037e38b9d1ae29780 (patch)
treecd37a965363fd5f9d659e72906086e6c9d935469 /LuaSL/src/LuaSL_lemon_yaccer.y
parentParse function calls, at least the basics. (diff)
downloadSledjHamr-217e4fcd7d750396b168c65037e38b9d1ae29780.zip
SledjHamr-217e4fcd7d750396b168c65037e38b9d1ae29780.tar.gz
SledjHamr-217e4fcd7d750396b168c65037e38b9d1ae29780.tar.bz2
SledjHamr-217e4fcd7d750396b168c65037e38b9d1ae29780.tar.xz
Oops, left this off the last commit. More function call parsing.
Diffstat (limited to '')
-rw-r--r--LuaSL/src/LuaSL_lemon_yaccer.y6
1 files changed, 4 insertions, 2 deletions
diff --git a/LuaSL/src/LuaSL_lemon_yaccer.y b/LuaSL/src/LuaSL_lemon_yaccer.y
index af2423a..1e5389d 100644
--- a/LuaSL/src/LuaSL_lemon_yaccer.y
+++ b/LuaSL/src/LuaSL_lemon_yaccer.y
@@ -87,6 +87,7 @@ statement(A) ::= expr(B) LSL_STATEMENT(D). { A = addStatement(D, LSL_EXPRESS
87 87
88// Various forms of expression. 88// Various forms of expression.
89 89
90// Used for function call params, and list contents.
90exprList ::= exprList LSL_COMMA expr. 91exprList ::= exprList LSL_COMMA expr.
91exprList ::= expr. 92exprList ::= expr.
92exprList ::= . 93exprList ::= .
@@ -149,7 +150,7 @@ expr(A) ::= LSL_PARENTHESIS_OPEN(B) type(C) LSL_PARENTHESIS_CLOSE(D) expr(E). {
149// Function call. 150// Function call.
150 151
151// Causes a conflict when exprList is empty with a function definition with no type and no parameters. 152// Causes a conflict when exprList is empty with a function definition with no type and no parameters.
152expr ::= LSL_IDENTIFIER LSL_PARENTHESIS_OPEN exprList LSL_PARENTHESIS_CLOSE. 153expr(A) ::= LSL_IDENTIFIER(B) LSL_PARENTHESIS_OPEN(C) exprList(D) LSL_PARENTHESIS_CLOSE(E). { A = addFunctionCall(compiler, B, C, D, E); }
153 154
154// Variables and dealing with them. 155// Variables and dealing with them.
155 156
@@ -165,10 +166,11 @@ expr(A) ::= identifier LSL_ASSIGNMENT_DIVIDE expr(B). { A = B; }
165expr(A) ::= identifier LSL_ASSIGNMENT_PLAIN expr(B). { A = B; } 166expr(A) ::= identifier LSL_ASSIGNMENT_PLAIN expr(B). { A = B; }
166 167
167// Hmm think this can have commas seperating the assignment parts, or is that only in C?. If so, best to separate them when converting to Lua, as it uses that syntax for something else. 168// Hmm think this can have commas seperating the assignment parts, or is that only in C?. If so, best to separate them when converting to Lua, as it uses that syntax for something else.
169// Well, not in OpenSim at least, nor in SL. So we are safe. B-)
168statement(A) ::= type(B) LSL_IDENTIFIER(C) LSL_ASSIGNMENT_PLAIN(D) expr(E) LSL_STATEMENT(F). { A = addStatement(F, LSL_IDENTIFIER, addVariable(compiler, B, C, D, E)); } 170statement(A) ::= type(B) LSL_IDENTIFIER(C) LSL_ASSIGNMENT_PLAIN(D) expr(E) LSL_STATEMENT(F). { A = addStatement(F, LSL_IDENTIFIER, addVariable(compiler, B, C, D, E)); }
169statement(A) ::= type(B) LSL_IDENTIFIER(C) LSL_STATEMENT(F). { A = addStatement(F, LSL_IDENTIFIER, addVariable(compiler, B, C, NULL, NULL)); } 171statement(A) ::= type(B) LSL_IDENTIFIER(C) LSL_STATEMENT(F). { A = addStatement(F, LSL_IDENTIFIER, addVariable(compiler, B, C, NULL, NULL)); }
170 172
171%right LSL_DOT LSL_IDENTIFIER. 173%right LSL_DOT LSL_IDENTIFIER LSL_FUNCTION_CALL.
172identifier ::= identifier LSL_DOT LSL_IDENTIFIER. 174identifier ::= identifier LSL_DOT LSL_IDENTIFIER.
173identifier(A) ::= LSL_IDENTIFIER(B). { A = checkVariable(compiler, B); } 175identifier(A) ::= LSL_IDENTIFIER(B). { A = checkVariable(compiler, B); }
174 176