Changeset 39
- Timestamp:
- 06/05/08 22:56:08 (7 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
axdt/trunk/org.axdt.as3/src/org/axdt/as3/imp/parser/AS3Parser.g
r37 r39 151 151 public IAst getDeclaration() { return decl; } 152 152 ./ 153 QIdent$QIdent ::= NamespaceMod DBL_COLON$ Ident154 153 155 154 -- cunit … … 165 164 TypeSpaceEntry ::= InterfaceDeclaration 166 165 TypeSpaceEntry ::= NamespaceDeclaration 166 TypeSpaceEntry ::= NamespaceDirective 167 167 TypeSpaceEntry ::= FieldDeclaration 168 168 TypeSpaceEntry ::= MethodDeclaration … … 224 224 ClassMemberDeclaration ::= MethodDeclaration 225 225 ClassMemberDeclaration ::= NamespaceDeclaration 226 ClassMemberDeclaration ::= NamespaceDirective 226 227 227 228 ClassMemberDeclaration$EmptyDeclaration ::= SEMI$ … … 230 231 NamespaceDeclaration$NamespaceDeclaration ::= Modifiers namespace IDENTIFIER$Name 231 232 NamespaceDeclaration$NamespaceDeclaration ::= Modifiers namespace IDENTIFIER$Name ASSIGN$ Expression$Initializer 233 234 NamespaceDirective$NamespaceDirective ::= use$ namespace$ Ident SemiOpt$ 235 232 236 233 237 FieldDeclaration$FieldDeclaration ::= Annotations Modifiers FieldType VariableDeclarators SemiOpt … … 316 320 | SuperStatement 317 321 | ThrowStatement 322 | NamespaceDirective 318 323 EmptyStatement ::= SEMI 319 324 … … 357 362 ForStatementNoShortIf$ForStatement ::= for$ LPAREN$ ForHead RPAREN$ StatementNoShortIf$Statement 358 363 ForStatementNoShortIf$ForStatement ::= for$ each$ LPAREN$ ForHead RPAREN$ StatementNoShortIf$Statement 364 /. 365 $action_type.SymbolTable symbolTable; 366 public void setSymbolTable($action_type.SymbolTable symbolTable) { this.symbolTable = symbolTable; } 367 public $action_type.SymbolTable getSymbolTable() { return symbolTable; } 368 ./ 359 369 360 370 ContinueStatement$ContinueStatement ::= continue$ SemiOpt$ … … 391 401 -- expressions 392 402 Primary$Primary ::= Literal 393 | MethodInvocation394 | ArrayAccess395 | FieldAccess396 | InstanceCreationExpression397 | EncapsulatedExpression398 | this399 | super400 403 | ArrayLiteral 401 404 | ObjectLiteral 402 405 | FunctionExpression 403 | QIdent 404 405 FunctionExpression$FunctionExpression ::= function$ ParameterBlock COLON$ ReturnType Block 406 | InstanceCreationExpression 407 | EncapsulatedExpression 408 | Ident 409 | this 410 | super 411 FunctionExpression$FunctionExpression ::= function$ ParameterBlock ReturnType Block 406 412 FunctionExpression$FunctionExpression ::= function$ ParameterBlock Block 407 413 /. … … 410 416 public $action_type.SymbolTable getSymbolTable() { return symbolTable; } 411 417 ./ 412 413 418 EncapsulatedExpression ::= LPAREN$ Expression RPAREN$ 414 419 InstanceCreationExpression ::= new$ Type Arguments 415 416 420 Arguments$Arguments ::= LPAREN$ %empty RPAREN$ 417 421 | LPAREN$ ElementList RPAREN$ 418 419 422 ElementList$$Expression ::= Expression 420 | ElementList COMMA Expression 421 422 FieldAccess$FieldAccess ::= QIdent | Ident 423 FieldAccess$FieldAccess ::= Primary$Base DOT$ Ident 424 425 MethodInvocation ::= MethodReference Arguments 423 | ElementList COMMA Expression 424 425 FieldAccess$FieldAccess ::= Primary 426 FieldAccess$FieldAccess ::= Secondary DOT$ Ident 427 428 Secondary ::= FieldAccess 429 | MethodInvocation 430 | ArrayAccess 431 432 MethodInvocation ::= Secondary Arguments 426 433 427 MethodReference$MethodReference ::= QIdent | Ident 428 MethodReference$MethodReference ::= Primary$Base DOT$ Ident 429 430 ArrayAccess$ArrayAccess ::= Name$Base LBRACK$ Expression$Access RBRACK$ 431 ArrayAccess$ArrayAccess ::= Primary$Base LBRACK$ Expression$Access RBRACK$ 432 433 PostfixExpression ::= Primary 434 PostfixExpression ::= Name 434 ArrayAccess$ArrayAccess ::= Secondary LBRACK$ Expression$Access RBRACK$ 435 436 PostfixExpression ::= Secondary 437 PostfixExpression ::= QualifiedExpression 435 438 PostfixExpression ::= PostIncrementExpression 436 439 PostfixExpression ::= PostDecrementExpression 440 441 QualifiedExpression ::= Secondary DBL_COLON$ PostfixExpression 437 442 438 443 PostIncrementExpression ::= PostfixExpression$Expression INC$ … … 480 485 InclusiveOrExpression ::= ExclusiveOrExpression 481 486 InclusiveOrExpression$InclusiveOrExpression ::= InclusiveOrExpression$Left BOR$ ExclusiveOrExpression$Right 482 487 483 488 ConditionalAndExpression ::= InclusiveOrExpression 484 489 ConditionalAndExpression$ConditionalAndExpression ::= ConditionalAndExpression$Left LAND$ InclusiveOrExpression$Right … … 539 544 if (n instanceof MethodDeclaration) 540 545 return ((MethodDeclaration) n).getSymbolTable(); 546 if (n instanceof FunctionExpression) 547 return ((FunctionExpression) n).getSymbolTable(); 541 548 if (n instanceof ClassBody) 542 549 return ((ClassBody) n).getSymbolTable(); 543 550 if (n instanceof InterfaceBody) 544 551 return ((InterfaceBody) n).getSymbolTable(); 552 if (n instanceof ForStatement) 553 return ((ForStatement) n).getSymbolTable(); 545 554 } 546 555 return getTopLevelSymbolTable(); axdt/trunk/org.axdt.as3/src/org/axdt/as3/imp/parser/SymbolTableVisitor.java
r37 r39 16 16 import org.axdt.as3.imp.parser.Ast.ExpressionStatement; 17 17 import org.axdt.as3.imp.parser.Ast.FieldDeclaration; 18 import org.axdt.as3.imp.parser.Ast.ForStatement; 18 19 import org.axdt.as3.imp.parser.Ast.FormalParameter; 19 20 import org.axdt.as3.imp.parser.Ast.FunctionExpression; … … 141 142 parser.symbolTableStack.pop(); 142 143 } 144 public boolean visit(ForStatement n) { 145 n.setSymbolTable(pushNewTable()); 146 return true; 147 } 148 149 public void endVisit(ForStatement n) { 150 parser.symbolTableStack.pop(); 151 } 143 152 144 153 @Override
