diff options
author | David Walter Seikel | 2012-01-21 16:10:25 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-21 16:10:25 +1000 |
commit | 217e4fcd7d750396b168c65037e38b9d1ae29780 (patch) | |
tree | cd37a965363fd5f9d659e72906086e6c9d935469 /LuaSL | |
parent | Parse function calls, at least the basics. (diff) | |
download | SledjHamr-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 'LuaSL')
-rw-r--r-- | LuaSL/src/LuaSL_lemon_yaccer.y | 6 |
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. | ||
90 | exprList ::= exprList LSL_COMMA expr. | 91 | exprList ::= exprList LSL_COMMA expr. |
91 | exprList ::= expr. | 92 | exprList ::= expr. |
92 | exprList ::= . | 93 | exprList ::= . |
@@ -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. |
152 | expr ::= LSL_IDENTIFIER LSL_PARENTHESIS_OPEN exprList LSL_PARENTHESIS_CLOSE. | 153 | expr(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; } | |||
165 | expr(A) ::= identifier LSL_ASSIGNMENT_PLAIN expr(B). { A = B; } | 166 | expr(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-) | ||
168 | statement(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)); } | 170 | statement(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)); } |
169 | statement(A) ::= type(B) LSL_IDENTIFIER(C) LSL_STATEMENT(F). { A = addStatement(F, LSL_IDENTIFIER, addVariable(compiler, B, C, NULL, NULL)); } | 171 | statement(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. |
172 | identifier ::= identifier LSL_DOT LSL_IDENTIFIER. | 174 | identifier ::= identifier LSL_DOT LSL_IDENTIFIER. |
173 | identifier(A) ::= LSL_IDENTIFIER(B). { A = checkVariable(compiler, B); } | 175 | identifier(A) ::= LSL_IDENTIFIER(B). { A = checkVariable(compiler, B); } |
174 | 176 | ||