ContinueBreakNode cbn=new ContinueBreakNode(true);
cbn.setNumLine(pn.getLine());
blockstatements.add(cbn);
-
+ ParseNode idopt_pn=pn.getChild("identifier_opt");
+ ParseNode name_pn=idopt_pn.getChild("name");
+ // name_pn.getTerminal() gives you the label
} else if (isNode(pn,"genreach")) {
String graphName = pn.getChild("graphName").getTerminal();
blockstatements.add( new GenReachNode( graphName ) );
non terminal ParseNode for_init_opt, for_init;
non terminal ParseNode for_update_opt, for_update;
non terminal ParseNode statement_expression_list;
-//non terminal ParseNode identifier_opt;
+non terminal ParseNode identifier_opt;
non terminal ParseNode break_statement, continue_statement;
non terminal ParseNode return_statement;
non terminal ParseNode throw_statement;
:}
;
-//identifier_opt ::=
-// | IDENTIFIER
-// ;
+identifier_opt ::= {: RESULT=new ParseNode("identifier_opt",parser.lexer.line_num);
+ :}
+ | IDENTIFIER:id {:
+ ParseNode pn=new ParseNode("identifier_opt",parser.lexer.line_num);
+ pn.addChild("name").addChild(id);
+ RESULT=pn;
+ :}
+ ;
break_statement ::=
- BREAK
-//identifier_opt
-SEMICOLON {: RESULT=new ParseNode("break",parser.lexer.line_num); :}
+ BREAK identifier_opt:id SEMICOLON {:
+ ParseNode pn=new ParseNode("break",parser.lexer.line_num);
+ pn.addChild(id);
+ RESULT=pn;
+ :}
;
continue_statement ::=