aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-16 04:22:33 +1000
committerDavid Walter Seikel2012-01-16 04:22:33 +1000
commita8c049e977b7dc50bbb5e92ba81f0fb4a2057a2e (patch)
tree5235392863ea1de60d2f3bedcf46628b17d23ed1
parentMore clean up, and tiredness descends. (diff)
downloadSledjHamr-a8c049e977b7dc50bbb5e92ba81f0fb4a2057a2e.zip
SledjHamr-a8c049e977b7dc50bbb5e92ba81f0fb4a2057a2e.tar.gz
SledjHamr-a8c049e977b7dc50bbb5e92ba81f0fb4a2057a2e.tar.bz2
SledjHamr-a8c049e977b7dc50bbb5e92ba81f0fb4a2057a2e.tar.xz
Lemon parser more complete now, may even be more correct.
-rw-r--r--LuaSL/src/LuaSL_lemon_yaccer.y29
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
66exprList ::= exprList LSL_COMMA expr.
67exprList ::= expr.
68exprList ::= .
69expr ::= LSL_IDENTIFIER LSL_PARENTHESIS_OPEN exprList LSL_PARENTHESIS_CLOSE.
65expr(A) ::= LSL_PARENTHESIS_OPEN(B) expr(C) LSL_PARENTHESIS_CLOSE(D). { A = addParenthesis(B, C, D); } 70expr(A) ::= LSL_PARENTHESIS_OPEN(B) expr(C) LSL_PARENTHESIS_CLOSE(D). { A = addParenthesis(B, C, D); }
66expr(A) ::= LSL_PARENTHESIS_OPEN(B) type(C) LSL_PARENTHESIS_CLOSE(D). { A = addTypecast(B, C, D); } 71expr(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.
70expr ::= LSL_IDENTIFIER LSL_ASSIGNMENT_CONCATENATE expr. 74expr ::= 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
87exprList ::= exprList LSL_COMMA expr.
88exprList ::= expr.
89exprList ::= .
90
91%nonassoc LSL_FLOAT. 91%nonassoc LSL_FLOAT.
92expr(A) ::= LSL_FLOAT(B). { B->basicType = OT_float; A = B; } 92expr(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.
109statement ::= LSL_DO block LSL_WHILE LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE LSL_STATEMENT. 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. 110statement ::= 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 111
114statement ::= LSL_IF LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE block. [LSL_ELSE] 112ifBlock ::= ifBlock LSL_ELSE block.
115statement ::= LSL_IF LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE statement. [LSL_ELSE] 113ifBlock ::= block.
116statement ::= LSL_IF LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE block LSL_ELSE block. 114statement ::= 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
119statement ::= LSL_JUMP LSL_IDENTIFIER LSL_STATEMENT. 116statement ::= LSL_JUMP LSL_IDENTIFIER LSL_STATEMENT.
120statement ::= LSL_RETURN expr LSL_STATEMENT. 117statement ::= LSL_RETURN expr LSL_STATEMENT.
121statement ::= LSL_RETURN LSL_STATEMENT. 118statement ::= LSL_RETURN LSL_STATEMENT.
122statement ::= LSL_STATE_CHANGE LSL_IDENTIFIER LSL_STATEMENT. 119statement ::= LSL_STATE_CHANGE LSL_IDENTIFIER LSL_STATEMENT.
123statement ::= LSL_WHILE LSL_WHILE LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE block. 120statement ::= LSL_WHILE LSL_WHILE LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE block.
124statement ::= LSL_WHILE LSL_WHILE LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE statement.
125 121
126%nonassoc LSL_LABEL. 122%nonassoc LSL_LABEL.
127target ::= LSL_LABEL LSL_IDENTIFIER LSL_STATEMENT. 123target ::= 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.
139block ::= LSL_BLOCK_OPEN statementList LSL_BLOCK_CLOSE. 135block ::= LSL_BLOCK_OPEN statementList LSL_BLOCK_CLOSE.
136block ::= statement.
140 137
141%nonassoc LSL_PARAMETER LSL_FUNCTION LSL_STATE. 138%nonassoc LSL_PARAMETER LSL_FUNCTION LSL_STATE.
142parameter ::= type LSL_IDENTIFIER. 139parameter ::= type LSL_IDENTIFIER.
143parameterList ::= parameterList LSL_COMMA parameter. 140parameterList ::= parameterList LSL_COMMA parameter.
144parameterList ::= parameter. 141parameterList ::= parameter.
145parameterList ::= . 142parameterList ::= .
146function ::= LSL_IDENTIFIER LSL_PARENTHESIS_OPEN parameterList LSL_PARENTHESIS_CLOSE block.
147function ::= type LSL_IDENTIFIER LSL_PARENTHESIS_OPEN parameterList LSL_PARENTHESIS_CLOSE block. 143function ::= type LSL_IDENTIFIER LSL_PARENTHESIS_OPEN parameterList LSL_PARENTHESIS_CLOSE block.
144functionList ::= functionList function.
145functionList ::= .
148 146
149state ::= LSL_IDENTIFIER block. 147stateBlock ::= LSL_BLOCK_OPEN functionList LSL_BLOCK_CLOSE.
148state ::= LSL_IDENTIFIER stateBlock.
150 149
151%nonassoc LSL_SCRIPT. 150%nonassoc LSL_SCRIPT.
152script ::= script state. 151script ::= script state.
153script ::= script function. 152script ::= script function.
154script ::= script statement(A). { A->left = param->ast; param->ast = A; } 153script ::= script statement(A). { A->left = param->ast; param->ast = A; }
155script ::= statement(A). { A->left = param->ast; param->ast = A; } 154script ::= .
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