// 19.8.5) Constructor Declarations
non terminal ParseNode constructor_declaration, constructor_declarator;
non terminal ParseNode constructor_body;
-//non terminal ParseNode explicit_constructor_invocation;
+non terminal ParseNode explicit_constructor_invocation;
// 19.9.1) Interface Declarations
//non terminal ParseNode interface_declaration;
//non terminal ParseNode extends_interfaces_opt, extends_interfaces;
:}
;
constructor_body ::=
-// LBRACE explicit_constructor_invocation:eci block_statements:bs RBRACE |
-// LBRACE explicit_constructor_invocation RBRACE |
+ LBRACE explicit_constructor_invocation:eci block_statements:bs RBRACE {:
+ ParseNode pn=new ParseNode("constructor_body");
+ pn.addChild(eci);
+ pn.addChild(bs);
+ RESULT=pn;
+ :} |
+ LBRACE explicit_constructor_invocation:eci RBRACE {:
+ ParseNode pn=new ParseNode("constructor_body");
+ pn.addChild(eci);
+ RESULT=pn;
+ :} |
LBRACE block_statements:block RBRACE {:
ParseNode pn=new ParseNode("constructor_body");
pn.addChild(block);
:}
| LBRACE RBRACE {: RESULT=new ParseNode("empty"); :}
;
-//explicit_constructor_invocation ::=
+explicit_constructor_invocation ::=
// THIS LPAREN argument_list_opt RPAREN SEMICOLON
-// | SUPER LPAREN argument_list_opt RPAREN SEMICOLON
+// |
+SUPER LPAREN argument_list_opt:alo RPAREN SEMICOLON {:
+ ParseNode pn=new ParseNode("superinvoke");
+ pn.addChild(alo);
+ RESULT=pn;
+:}
// | primary DOT THIS LPAREN argument_list_opt RPAREN SEMICOLON
// | primary DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON
-// ;
+ ;
// 19.9) Interfaces
pn.addChild("dims_opt").setLiteral(dims);
RESULT=pn;
:}
- | NEW GLOBAL primitive_type:type dim_exprs:dimexpr dims_opt:dims {:
+ | GLOBAL NEW primitive_type:type dim_exprs:dimexpr dims_opt:dims {:
ParseNode pn=new ParseNode("createarray");
pn.addChild(type);
pn.addChild(dimexpr);
pn.addChild("global");
RESULT=pn;
:}
- | NEW GLOBAL class_or_interface_type:type dim_exprs:dimexpr dims_opt:dims {:
+ | GLOBAL NEW class_or_interface_type:type dim_exprs:dimexpr dims_opt:dims {:
ParseNode pn=new ParseNode("createarray");
pn.addChild(type);
pn.addChild(dimexpr);
pn.addChild(args);
RESULT=pn;
:}
-// | SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN
+ | SUPER DOT IDENTIFIER:id LPAREN argument_list_opt:args RPAREN {:
+ ParseNode name=new ParseNode("name");
+ name.addChild("base").addChild("name").addChild("identifier").addChild("super");
+ name.addChild("identifier").addChild(id);
+ ParseNode pn=new ParseNode("methodinvoke1");
+ pn.addChild(name);
+ pn.addChild(args);
+ RESULT=pn;
+ :}
// | name DOT SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN
;
array_access ::=
unary_expression_not_plus_minus ::=
postfix_expression:exp {:
RESULT=exp; :}
-// | COMP unary_expression
+ | COMP unary_expression:exp
+ {: RESULT=(new ParseNode("comp")).addChild(exp).getRoot(); :}
| NOT unary_expression:exp
{: RESULT=(new ParseNode("not")).addChild(exp).getRoot(); :}
| cast_expression:exp {: RESULT=exp; :}
pn.addChild(exp2);
RESULT=pn;
:}
-// | shift_expression URSHIFT additive_expression
+ | shift_expression:exp1 URSHIFT additive_expression:exp2 {:
+ ParseNode pn=new ParseNode("urightshift");
+ pn.addChild(exp1);
+ pn.addChild(exp2);
+ RESULT=pn;
+ :}
;
relational_expression ::=
shift_expression:exp {:
| MINUSEQ {: RESULT=new ParseNode("minuseq"); :}
| LSHIFTEQ {: RESULT=new ParseNode("lshifteq"); :}
| RSHIFTEQ {: RESULT=new ParseNode("rshifteq"); :}
-// | URSHIFTEQ {: RESULT=new ParseNode("urshifteq"); :}
+ | URSHIFTEQ {: RESULT=new ParseNode("urshifteq"); :}
| ANDEQ {: RESULT=new ParseNode("andeq"); :}
| XOREQ {: RESULT=new ParseNode("xoreq"); :}
| OREQ {: RESULT=new ParseNode("oreq"); :}