aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--LuaSL/src/LuaSL_lemon_yaccer.y94
1 files changed, 80 insertions, 14 deletions
diff --git a/LuaSL/src/LuaSL_lemon_yaccer.y b/LuaSL/src/LuaSL_lemon_yaccer.y
index 32d6b46..046a2b5 100644
--- a/LuaSL/src/LuaSL_lemon_yaccer.y
+++ b/LuaSL/src/LuaSL_lemon_yaccer.y
@@ -51,24 +51,43 @@ expr(A) ::= LSL_SUBTRACT(B) expr(C). [LSL_NEGATION] { A = addOperation(NULL, B
51 51
52%right LSL_TYPECAST_OPEN LSL_TYPECAST_CLOSE. 52%right LSL_TYPECAST_OPEN LSL_TYPECAST_CLOSE.
53%nonassoc LSL_TYPE_FLOAT LSL_TYPE_INTEGER LSL_TYPE_KEY LSL_TYPE_LIST LSL_TYPE_ROTATION LSL_TYPE_STRING LSL_TYPE_VECTOR. 53%nonassoc LSL_TYPE_FLOAT LSL_TYPE_INTEGER LSL_TYPE_KEY LSL_TYPE_LIST LSL_TYPE_ROTATION LSL_TYPE_STRING LSL_TYPE_VECTOR.
54type ::= LSL_TYPE_FLOAT.
55type ::= LSL_TYPE_INTEGER.
56type ::= LSL_TYPE_KEY.
57type ::= LSL_TYPE_LIST.
58type ::= LSL_TYPE_ROTATION.
59type ::= LSL_TYPE_STRING.
60type ::= LSL_TYPE_VECTOR.
61
54%left LSL_ANGLE_OPEN LSL_ANGLE_CLOSE. 62%left LSL_ANGLE_OPEN LSL_ANGLE_CLOSE.
55%nonassoc LSL_BRACKET_OPEN LSL_BRACKET_CLOSE. 63%nonassoc LSL_BRACKET_OPEN LSL_BRACKET_CLOSE.
56%nonassoc LSL_PARENTHESIS_OPEN LSL_PARENTHESIS_CLOSE LSL_EXPRESSION. 64%nonassoc LSL_PARENTHESIS_OPEN LSL_PARENTHESIS_CLOSE LSL_EXPRESSION.
57expr(A) ::= LSL_PARENTHESIS_OPEN(B) expr(C) LSL_PARENTHESIS_CLOSE(D). { A = addParenthesis(B, C, D); } 65expr(A) ::= LSL_PARENTHESIS_OPEN(B) expr(C) LSL_PARENTHESIS_CLOSE(D). { A = addParenthesis(B, C, D); }
58 66expr(A) ::= LSL_PARENTHESIS_OPEN(B) type(C) LSL_PARENTHESIS_CLOSE(D). { A = addTypecast(B, C, D); }
59expr(A) ::= LSL_PARENTHESIS_OPEN(B) LSL_TYPE_FLOAT(C) LSL_PARENTHESIS_CLOSE(D). { A = addTypecast(B, C, D); } 67//expr ::= LSL_IDENTIFIER LSL_PARENTHESIS_OPEN exprList LSL_PARENTHESIS_CLOSE.
60expr(A) ::= LSL_PARENTHESIS_OPEN(B) LSL_TYPE_INTEGER(C) LSL_PARENTHESIS_CLOSE(D). { A = addTypecast(B, C, D); }
61expr(A) ::= LSL_PARENTHESIS_OPEN(B) LSL_TYPE_KEY(C) LSL_PARENTHESIS_CLOSE(D). { A = addTypecast(B, C, D); }
62expr(A) ::= LSL_PARENTHESIS_OPEN(B) LSL_TYPE_LIST(C) LSL_PARENTHESIS_CLOSE(D). { A = addTypecast(B, C, D); }
63expr(A) ::= LSL_PARENTHESIS_OPEN(B) LSL_TYPE_ROTATION(C) LSL_PARENTHESIS_CLOSE(D). { A = addTypecast(B, C, D); }
64expr(A) ::= LSL_PARENTHESIS_OPEN(B) LSL_TYPE_STRING(C) LSL_PARENTHESIS_CLOSE(D). { A = addTypecast(B, C, D); }
65expr(A) ::= LSL_PARENTHESIS_OPEN(B) LSL_TYPE_VECTOR(C) LSL_PARENTHESIS_CLOSE(D). { A = addTypecast(B, C, D); }
66 68
67%right LSL_ASSIGNMENT_CONCATENATE LSL_ASSIGNMENT_ADD LSL_ASSIGNMENT_SUBTRACT LSL_ASSIGNMENT_MULTIPLY LSL_ASSIGNMENT_MODULO LSL_ASSIGNMENT_DIVIDE LSL_ASSIGNMENT_PLAIN. 69%right LSL_ASSIGNMENT_CONCATENATE LSL_ASSIGNMENT_ADD LSL_ASSIGNMENT_SUBTRACT LSL_ASSIGNMENT_MULTIPLY LSL_ASSIGNMENT_MODULO LSL_ASSIGNMENT_DIVIDE LSL_ASSIGNMENT_PLAIN.
70expr ::= LSL_IDENTIFIER LSL_ASSIGNMENT_CONCATENATE expr.
71expr ::= LSL_IDENTIFIER LSL_ASSIGNMENT_ADD expr.
72expr ::= LSL_IDENTIFIER LSL_ASSIGNMENT_SUBTRACT expr.
73expr ::= LSL_IDENTIFIER LSL_ASSIGNMENT_MULTIPLY expr.
74expr ::= LSL_IDENTIFIER LSL_ASSIGNMENT_MODULO expr.
75expr ::= LSL_IDENTIFIER LSL_ASSIGNMENT_DIVIDE expr.
76expr ::= LSL_IDENTIFIER LSL_ASSIGNMENT_PLAIN expr.
68%right LSL_DOT. 77%right LSL_DOT.
78expr ::= LSL_IDENTIFIER LSL_DOT LSL_IDENTIFIER.
69%right LSL_DECREMENT_PRE LSL_INCREMENT_PRE LSL_DECREMENT_POST LSL_INCREMENT_POST. 79%right LSL_DECREMENT_PRE LSL_INCREMENT_PRE LSL_DECREMENT_POST LSL_INCREMENT_POST.
80expr ::= LSL_IDENTIFIER LSL_DECREMENT_PRE.
81expr ::= LSL_IDENTIFIER LSL_INCREMENT_PRE.
82expr ::= LSL_DECREMENT_PRE LSL_IDENTIFIER.
83expr ::= LSL_INCREMENT_PRE LSL_IDENTIFIER.
84
70%nonassoc LSL_COMMA. 85%nonassoc LSL_COMMA.
71 86
87exprList ::= exprList LSL_COMMA expr.
88exprList ::= expr.
89exprList ::= .
90
72%nonassoc LSL_FLOAT. 91%nonassoc LSL_FLOAT.
73expr(A) ::= LSL_FLOAT(B). { B->basicType = OT_float; A = B; } 92expr(A) ::= LSL_FLOAT(B). { B->basicType = OT_float; A = B; }
74%nonassoc LSL_INTEGER. 93%nonassoc LSL_INTEGER.
@@ -76,24 +95,71 @@ expr(A) ::= LSL_INTEGER(B). { B->basicType = OT_integer; A = B; }
76%nonassoc LSL_KEY. 95%nonassoc LSL_KEY.
77expr(A) ::= LSL_KEY(B). { B->basicType = OT_key; A = B; } 96expr(A) ::= LSL_KEY(B). { B->basicType = OT_key; A = B; }
78%nonassoc LSL_LIST. 97%nonassoc LSL_LIST.
98expr ::= LSL_BRACKET_OPEN exprList LSL_BRACKET_CLOSE.
79%nonassoc LSL_ROTATION. 99%nonassoc LSL_ROTATION.
100expr ::= LSL_ANGLE_OPEN expr LSL_COMMA expr LSL_COMMA expr LSL_COMMA expr LSL_ANGLE_CLOSE.
80%nonassoc LSL_STRING. 101%nonassoc LSL_STRING.
81expr(A) ::= LSL_STRING(B). { B->basicType = OT_string; A = B; } 102expr(A) ::= LSL_STRING(B). { B->basicType = OT_string; A = B; }
82%nonassoc LSL_VECTOR. 103%nonassoc LSL_VECTOR.
83 104expr ::= LSL_VECTOR.
84%nonassoc LSL_DO LSL_FOR LSL_ELSE LSL_ELSE_IF LSL_IF LSL_JUMP LSL_RETURN LSL_STATE_CHANGE LSL_WHILE. 105expr ::= LSL_ANGLE_OPEN expr LSL_COMMA expr LSL_COMMA expr LSL_ANGLE_CLOSE.
106
107%nonassoc LSL_DO LSL_FOR LSL_ELSE_IF LSL_IF LSL_JUMP LSL_RETURN LSL_STATE_CHANGE LSL_WHILE.
108%nonassoc LSL_ELSE.
109statement ::= LSL_DO block LSL_WHILE LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE LSL_STATEMENT.
110statement ::= LSL_DO statement LSL_WHILE LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE LSL_STATEMENT.
111statement ::= LSL_FOR LSL_PARENTHESIS_OPEN expr LSL_COMMA expr LSL_COMMA expr LSL_PARENTHESIS_CLOSE block.
112statement ::= LSL_FOR LSL_PARENTHESIS_OPEN expr LSL_COMMA expr LSL_COMMA expr LSL_PARENTHESIS_CLOSE statement.
113
114elseIfList ::= elseIfList elseIf.
115elseIfList ::= .
116elseIf ::= LSL_ELSE LSL_IF block. [LSL_ELSE]
117//elseIf ::= LSL_ELSE LSL_IF statement.
118
119statement ::= LSL_IF LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE block elseIfList. [LSL_ELSE]
120//statement ::= LSL_IF LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE statement elseIfList.
121statement ::= LSL_IF LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE block elseIfList LSL_ELSE block.
122//statement ::= LSL_IF LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE statement elseIfList LSL_ELSE block.
123//statement ::= LSL_IF LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE block elseIfList LSL_ELSE statement.
124//statement ::= LSL_IF LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE statement elseIfList LSL_ELSE statement.
125
126statement ::= LSL_JUMP LSL_IDENTIFIER.
127statement ::= LSL_RETURN expr LSL_STATEMENT.
128statement ::= LSL_RETURN LSL_STATEMENT.
129statement ::= LSL_STATE_CHANGE LSL_IDENTIFIER.
130statement ::= LSL_WHILE LSL_WHILE LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE block LSL_STATEMENT.
131statement ::= LSL_WHILE LSL_WHILE LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE statement LSL_STATEMENT.
85 132
86%nonassoc LSL_LABEL. 133%nonassoc LSL_LABEL.
134target ::= LSL_LABEL LSL_IDENTIFIER.
87 135
88%nonassoc LSL_STATEMENT. 136%nonassoc LSL_IDENTIFIER LSL_STATEMENT.
137statement ::= target LSL_STATEMENT.
138statement ::= type LSL_IDENTIFIER LSL_ASSIGNMENT_PLAIN expr LSL_STATEMENT.
139statement ::= type LSL_IDENTIFIER LSL_STATEMENT.
89statement(A) ::= expr(B) LSL_STATEMENT(D). { A = addStatement(D, LSL_EXPRESSION, B); } 140statement(A) ::= expr(B) LSL_STATEMENT(D). { A = addStatement(D, LSL_EXPRESSION, B); }
90 141
91%nonassoc LSL_IDENTIFIER LSL_SCRIPT. 142statementList ::= statementList statement.
92script ::= script statement(A). { A->left = param->ast; param->ast = A; } 143statementList ::= .
93script ::= statement(A). { A->left = param->ast; param->ast = A; }
94 144
95%nonassoc LSL_BLOCK_OPEN LSL_BLOCK_CLOSE. 145%nonassoc LSL_BLOCK_OPEN LSL_BLOCK_CLOSE.
146block ::= LSL_BLOCK_OPEN statementList LSL_BLOCK_CLOSE.
147
96%nonassoc LSL_PARAMETER LSL_FUNCTION LSL_STATE. 148%nonassoc LSL_PARAMETER LSL_FUNCTION LSL_STATE.
149parameter ::= type LSL_IDENTIFIER.
150parameterList ::= parameterList LSL_COMMA parameter.
151parameterList ::= parameter.
152parameterList ::= .
153function ::= LSL_IDENTIFIER LSL_PARENTHESIS_OPEN parameterList LSL_PARENTHESIS_CLOSE block.
154function ::= type LSL_IDENTIFIER LSL_PARENTHESIS_OPEN parameterList LSL_PARENTHESIS_CLOSE block.
155
156state ::= LSL_IDENTIFIER block.
157
158%nonassoc LSL_SCRIPT.
159script ::= script state.
160script ::= script function.
161script ::= script statement(A). { A->left = param->ast; param->ast = A; }
162script ::= statement(A). { A->left = param->ast; param->ast = A; }
97 163
98%nonassoc LSL_SPACE LSL_COMMENT LSL_COMMENT_LINE LSL_UNKNOWN. 164%nonassoc LSL_SPACE LSL_COMMENT LSL_COMMENT_LINE LSL_UNKNOWN.
99 165