diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-12-29 10:27:38 -0700 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-12-29 10:27:38 -0700 |
commit | bae6192c54533e8da95d8ae1ed4d4eccee28c39a (patch) | |
tree | f27b03b518894420992ad1a3ed3ee1a07935ca4b /src/parser.y | |
parent | 550d4f13ace49e3d442e43d46cd066f174709400 (diff) | |
download | stage-bae6192c54533e8da95d8ae1ed4d4eccee28c39a.tar.gz stage-bae6192c54533e8da95d8ae1ed4d4eccee28c39a.tar.bz2 stage-bae6192c54533e8da95d8ae1ed4d4eccee28c39a.tar.xz stage-bae6192c54533e8da95d8ae1ed4d4eccee28c39a.zip |
Getting close to realy running.
Diffstat (limited to 'src/parser.y')
-rw-r--r-- | src/parser.y | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/parser.y b/src/parser.y index 90c771d..e6210d1 100644 --- a/src/parser.y +++ b/src/parser.y | |||
@@ -96,7 +96,8 @@ gameDecls: | |||
96 | ; | 96 | ; |
97 | 97 | ||
98 | globalDecl: | 98 | globalDecl: |
99 | | tokGlobal '{' globalExprList '}' | 99 | | tokGlobal '{' { bld.beginGlobal(); } globalExprList '}' |
100 | { bld.closeGlobal(); } | ||
100 | ; | 101 | ; |
101 | 102 | ||
102 | globalExprList: | 103 | globalExprList: |
@@ -134,11 +135,11 @@ function: tokFunction tokIdent { bld.beginFunction( *($2) ); } '(' funcParamList | |||
134 | ; | 135 | ; |
135 | 136 | ||
136 | funcParamList: | 137 | funcParamList: |
137 | | tokIdent { bld.addParam( *($1) ); } funcParamListEx | 138 | | tokIdent { bld.addFunctionParam( *($1) ); } funcParamListEx |
138 | ; | 139 | ; |
139 | 140 | ||
140 | funcParamListEx: | 141 | funcParamListEx: |
141 | | funcParamListEx ',' tokIdent { bld.addParam( *($3) ); } | 142 | | funcParamListEx ',' tokIdent { bld.addFunctionParam( *($3) ); } |
142 | ; | 143 | ; |
143 | 144 | ||
144 | cmpltExprList: | 145 | cmpltExprList: |
@@ -156,7 +157,8 @@ cmpltExpr: expr ';' | |||
156 | bld.closeNode(); | 157 | bld.closeNode(); |
157 | bld.addNode( AstNode::tScope ); | 158 | bld.addNode( AstNode::tScope ); |
158 | } tokDo '{' cmpltExprList '}' { | 159 | } tokDo '{' cmpltExprList '}' { |
159 | bld.closeNode(); bld.closeNode(); | 160 | bld.closeNode(); |
161 | bld.closeNode(); | ||
160 | } | 162 | } |
161 | ; | 163 | ; |
162 | 164 | ||
@@ -198,7 +200,7 @@ literal: tokInt { bld.addLiteral( Variable( $1 ) ); } | |||
198 | ; | 200 | ; |
199 | 201 | ||
200 | expr: literal | 202 | expr: literal |
201 | | tokIdent '(' listValues ')' | 203 | | tokIdent '(' funcCallParams ')' { bld.addFuncCall( *($1) ); } |
202 | | varRef | 204 | | varRef |
203 | | varRef '=' expr { bld.addNode( AstNode::tStore ); } | 205 | | varRef '=' expr { bld.addNode( AstNode::tStore ); } |
204 | | varRef tokPlusAssign expr { bld.addNode( AstNode::tPlusStore ); } | 206 | | varRef tokPlusAssign expr { bld.addNode( AstNode::tPlusStore ); } |
@@ -227,6 +229,14 @@ expr: literal | |||
227 | | '-' expr %prec NEG { bld.addNode( AstNode::tNegate ); } | 229 | | '-' expr %prec NEG { bld.addNode( AstNode::tNegate ); } |
228 | ; | 230 | ; |
229 | 231 | ||
232 | funcCallParams: | ||
233 | | expr funcCallParamsEx | ||
234 | ; | ||
235 | |||
236 | funcCallParamsEx: | ||
237 | | funcCallParamsEx ',' expr | ||
238 | ; | ||
239 | |||
230 | listValues: expr | 240 | listValues: expr |
231 | | listValues ',' expr | 241 | | listValues ',' expr |
232 | ; | 242 | ; |
@@ -235,12 +245,13 @@ dictValues: expr ':' expr | |||
235 | | dictValues ',' expr ':' expr | 245 | | dictValues ',' expr ':' expr |
236 | ; | 246 | ; |
237 | 247 | ||
238 | commandDecl: tokCommand ':' tokString commandParamList '{' cmpltExprList '}' | 248 | commandDecl: tokCommand ':' tokString { bld.beginCommand( *$3 ); } |
249 | commandParamList '{' cmpltExprList '}' { bld.closeCommand(); } | ||
239 | ; | 250 | ; |
240 | 251 | ||
241 | commandParamList: | 252 | commandParamList: |
242 | | commandParamList tokString | 253 | | commandParamList tokString { bld.addCommandLiteral( *$2 ); } |
243 | | commandParamList tokIdent | 254 | | commandParamList tokIdent { bld.addCommandParam( *$2 ); } |
244 | ; | 255 | ; |
245 | %% | 256 | %% |
246 | /* | 257 | /* |