diff options
Diffstat (limited to '')
-rw-r--r-- | LuaSL/src/LuaSL_lemon_yaccer.y | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/LuaSL/src/LuaSL_lemon_yaccer.y b/LuaSL/src/LuaSL_lemon_yaccer.y index 7bc4dfb..16f552c 100644 --- a/LuaSL/src/LuaSL_lemon_yaccer.y +++ b/LuaSL/src/LuaSL_lemon_yaccer.y | |||
@@ -62,9 +62,13 @@ type ::= LSL_TYPE_VECTOR. | |||
62 | %left LSL_ANGLE_OPEN LSL_ANGLE_CLOSE. | 62 | %left LSL_ANGLE_OPEN LSL_ANGLE_CLOSE. |
63 | %nonassoc LSL_BRACKET_OPEN LSL_BRACKET_CLOSE. | 63 | %nonassoc LSL_BRACKET_OPEN LSL_BRACKET_CLOSE. |
64 | %nonassoc LSL_PARENTHESIS_OPEN LSL_PARENTHESIS_CLOSE LSL_EXPRESSION. | 64 | %nonassoc LSL_PARENTHESIS_OPEN LSL_PARENTHESIS_CLOSE LSL_EXPRESSION. |
65 | |||
66 | exprList ::= exprList LSL_COMMA expr. | ||
67 | exprList ::= expr. | ||
68 | exprList ::= . | ||
69 | expr ::= LSL_IDENTIFIER LSL_PARENTHESIS_OPEN exprList LSL_PARENTHESIS_CLOSE. | ||
65 | expr(A) ::= LSL_PARENTHESIS_OPEN(B) expr(C) LSL_PARENTHESIS_CLOSE(D). { A = addParenthesis(B, C, D); } | 70 | expr(A) ::= LSL_PARENTHESIS_OPEN(B) expr(C) LSL_PARENTHESIS_CLOSE(D). { A = addParenthesis(B, C, D); } |
66 | expr(A) ::= LSL_PARENTHESIS_OPEN(B) type(C) LSL_PARENTHESIS_CLOSE(D). { A = addTypecast(B, C, D); } | 71 | expr(A) ::= LSL_PARENTHESIS_OPEN(B) type(C) LSL_PARENTHESIS_CLOSE(D). { A = addTypecast(B, C, D); } |
67 | //expr ::= LSL_IDENTIFIER LSL_PARENTHESIS_OPEN exprList LSL_PARENTHESIS_CLOSE. | ||
68 | 72 | ||
69 | %right LSL_ASSIGNMENT_CONCATENATE LSL_ASSIGNMENT_ADD LSL_ASSIGNMENT_SUBTRACT LSL_ASSIGNMENT_MULTIPLY LSL_ASSIGNMENT_MODULO LSL_ASSIGNMENT_DIVIDE LSL_ASSIGNMENT_PLAIN. | 73 | %right LSL_ASSIGNMENT_CONCATENATE LSL_ASSIGNMENT_ADD LSL_ASSIGNMENT_SUBTRACT LSL_ASSIGNMENT_MULTIPLY LSL_ASSIGNMENT_MODULO LSL_ASSIGNMENT_DIVIDE LSL_ASSIGNMENT_PLAIN. |
70 | expr ::= LSL_IDENTIFIER LSL_ASSIGNMENT_CONCATENATE expr. | 74 | expr ::= LSL_IDENTIFIER LSL_ASSIGNMENT_CONCATENATE expr. |
@@ -84,10 +88,6 @@ expr ::= LSL_INCREMENT_PRE LSL_IDENTIFIER. | |||
84 | 88 | ||
85 | %nonassoc LSL_COMMA. | 89 | %nonassoc LSL_COMMA. |
86 | 90 | ||
87 | exprList ::= exprList LSL_COMMA expr. | ||
88 | exprList ::= expr. | ||
89 | exprList ::= . | ||
90 | |||
91 | %nonassoc LSL_FLOAT. | 91 | %nonassoc LSL_FLOAT. |
92 | expr(A) ::= LSL_FLOAT(B). { B->basicType = OT_float; A = B; } | 92 | expr(A) ::= LSL_FLOAT(B). { B->basicType = OT_float; A = B; } |
93 | %nonassoc LSL_INTEGER. | 93 | %nonassoc LSL_INTEGER. |
@@ -107,21 +107,17 @@ expr ::= LSL_ANGLE_OPEN expr LSL_COMMA expr LSL_COMMA expr LSL_ANGLE_CLOSE. | |||
107 | %nonassoc LSL_DO LSL_FOR LSL_ELSE_IF LSL_IF LSL_JUMP LSL_RETURN LSL_STATE_CHANGE LSL_WHILE. | 107 | %nonassoc LSL_DO LSL_FOR LSL_ELSE_IF LSL_IF LSL_JUMP LSL_RETURN LSL_STATE_CHANGE LSL_WHILE. |
108 | %nonassoc LSL_ELSE. | 108 | %nonassoc LSL_ELSE. |
109 | statement ::= LSL_DO block LSL_WHILE LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE LSL_STATEMENT. | 109 | statement ::= LSL_DO block LSL_WHILE LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE LSL_STATEMENT. |
110 | statement ::= LSL_DO statement LSL_WHILE LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE LSL_STATEMENT. | ||
111 | statement ::= LSL_FOR LSL_PARENTHESIS_OPEN expr LSL_COMMA expr LSL_COMMA expr LSL_PARENTHESIS_CLOSE block. | 110 | statement ::= LSL_FOR LSL_PARENTHESIS_OPEN expr LSL_COMMA expr LSL_COMMA expr LSL_PARENTHESIS_CLOSE block. |
112 | statement ::= LSL_FOR LSL_PARENTHESIS_OPEN expr LSL_COMMA expr LSL_COMMA expr LSL_PARENTHESIS_CLOSE statement. | ||
113 | 111 | ||
114 | statement ::= LSL_IF LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE block. [LSL_ELSE] | 112 | ifBlock ::= ifBlock LSL_ELSE block. |
115 | statement ::= LSL_IF LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE statement. [LSL_ELSE] | 113 | ifBlock ::= block. |
116 | statement ::= LSL_IF LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE block LSL_ELSE block. | 114 | statement ::= LSL_IF LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE ifBlock. //[LSL_ELSE] |
117 | //statement ::= LSL_IF LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE statement LSL_ELSE statement. | ||
118 | 115 | ||
119 | statement ::= LSL_JUMP LSL_IDENTIFIER LSL_STATEMENT. | 116 | statement ::= LSL_JUMP LSL_IDENTIFIER LSL_STATEMENT. |
120 | statement ::= LSL_RETURN expr LSL_STATEMENT. | 117 | statement ::= LSL_RETURN expr LSL_STATEMENT. |
121 | statement ::= LSL_RETURN LSL_STATEMENT. | 118 | statement ::= LSL_RETURN LSL_STATEMENT. |
122 | statement ::= LSL_STATE_CHANGE LSL_IDENTIFIER LSL_STATEMENT. | 119 | statement ::= LSL_STATE_CHANGE LSL_IDENTIFIER LSL_STATEMENT. |
123 | statement ::= LSL_WHILE LSL_WHILE LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE block. | 120 | statement ::= LSL_WHILE LSL_WHILE LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE block. |
124 | statement ::= LSL_WHILE LSL_WHILE LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE statement. | ||
125 | 121 | ||
126 | %nonassoc LSL_LABEL. | 122 | %nonassoc LSL_LABEL. |
127 | target ::= LSL_LABEL LSL_IDENTIFIER LSL_STATEMENT. | 123 | target ::= LSL_LABEL LSL_IDENTIFIER LSL_STATEMENT. |
@@ -137,22 +133,25 @@ statementList ::= . | |||
137 | 133 | ||
138 | %nonassoc LSL_BLOCK_OPEN LSL_BLOCK_CLOSE. | 134 | %nonassoc LSL_BLOCK_OPEN LSL_BLOCK_CLOSE. |
139 | block ::= LSL_BLOCK_OPEN statementList LSL_BLOCK_CLOSE. | 135 | block ::= LSL_BLOCK_OPEN statementList LSL_BLOCK_CLOSE. |
136 | block ::= statement. | ||
140 | 137 | ||
141 | %nonassoc LSL_PARAMETER LSL_FUNCTION LSL_STATE. | 138 | %nonassoc LSL_PARAMETER LSL_FUNCTION LSL_STATE. |
142 | parameter ::= type LSL_IDENTIFIER. | 139 | parameter ::= type LSL_IDENTIFIER. |
143 | parameterList ::= parameterList LSL_COMMA parameter. | 140 | parameterList ::= parameterList LSL_COMMA parameter. |
144 | parameterList ::= parameter. | 141 | parameterList ::= parameter. |
145 | parameterList ::= . | 142 | parameterList ::= . |
146 | function ::= LSL_IDENTIFIER LSL_PARENTHESIS_OPEN parameterList LSL_PARENTHESIS_CLOSE block. | ||
147 | function ::= type LSL_IDENTIFIER LSL_PARENTHESIS_OPEN parameterList LSL_PARENTHESIS_CLOSE block. | 143 | function ::= type LSL_IDENTIFIER LSL_PARENTHESIS_OPEN parameterList LSL_PARENTHESIS_CLOSE block. |
144 | functionList ::= functionList function. | ||
145 | functionList ::= . | ||
148 | 146 | ||
149 | state ::= LSL_IDENTIFIER block. | 147 | stateBlock ::= LSL_BLOCK_OPEN functionList LSL_BLOCK_CLOSE. |
148 | state ::= LSL_IDENTIFIER stateBlock. | ||
150 | 149 | ||
151 | %nonassoc LSL_SCRIPT. | 150 | %nonassoc LSL_SCRIPT. |
152 | script ::= script state. | 151 | script ::= script state. |
153 | script ::= script function. | 152 | script ::= script function. |
154 | script ::= script statement(A). { A->left = param->ast; param->ast = A; } | 153 | script ::= script statement(A). { A->left = param->ast; param->ast = A; } |
155 | script ::= statement(A). { A->left = param->ast; param->ast = A; } | 154 | script ::= . |
156 | 155 | ||
157 | %nonassoc LSL_SPACE LSL_COMMENT LSL_COMMENT_LINE LSL_UNKNOWN. | 156 | %nonassoc LSL_SPACE LSL_COMMENT LSL_COMMENT_LINE LSL_UNKNOWN. |
158 | 157 | ||