@Override public R visit(final LabeledStmt n, final A arg) { { R result = n.getStmt().accept(this, arg); if (result != null) { return result; } } return null; }
final public IfStmt IfStatement() throws ParseException { Expression condition; Statement thenStmt; Statement elseStmt = null; int line; int column; Comment thenCmmt = null; Comment elseCmmt = null; jj_consume_token(IF); line=token.beginLine; column=token.beginColumn; jj_consume_token(LPAREN); condition = Expression(); jj_consume_token(RPAREN); thenStmt = Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ELSE: jj_consume_token(ELSE); elseStmt = Statement(); break; default: jj_la1[112] = jj_gen; ; } IfStmt tmp = new IfStmt(line, column, token.endLine, token.endColumn,condition, thenStmt, elseStmt); thenStmt.setComment(thenCmmt); if (elseStmt != null) elseStmt.setComment(elseCmmt); {if (true) return tmp;} throw new Error("Missing return statement in function"); }
@Override public Node visit(final BlockStmt n, final A arg) { final List<Statement> stmts = n.getStmts(); if (stmts != null) { for (int i = 0; i < stmts.size(); i++) { stmts.set(i, (Statement) stmts.get(i).accept(this, arg)); } removeNulls(stmts); } return n; }
@Override public Node visit(final LabeledStmt n, final A arg) { n.setStmt((Statement) n.getStmt().accept(this, arg)); return n; }
@Override public R visit(final BlockStmt n, final A arg) { if (n.getStmts() != null) { for (final Statement s : n.getStmts()) { { R result = s.accept(this, arg); if (result != null) { return result; } } } } return null; }
@Override public Node visit(final SwitchEntryStmt n, final A arg) { if (n.getLabel() != null) { n.setLabel((Expression) n.getLabel().accept(this, arg)); } final List<Statement> stmts = n.getStmts(); if (stmts != null) { for (int i = 0; i < stmts.size(); i++) { stmts.set(i, (Statement) stmts.get(i).accept(this, arg)); } removeNulls(stmts); } return n; }
@Override public void visit(final LabeledStmt n, final A arg) { visitComment(n.getComment(), arg); n.getStmt().accept(this, arg); }
@Override public R visit(final WhileStmt n, final A arg) { { R result = n.getCondition().accept(this, arg); if (result != null) { return result; } } { R result = n.getBody().accept(this, arg); if (result != null) { return result; } } return null; }
@Override public R visit(final DoStmt n, final A arg) { { R result = n.getBody().accept(this, arg); if (result != null) { return result; } } { R result = n.getCondition().accept(this, arg); if (result != null) { return result; } } return null; }
@Override public R visit(final IfStmt n, final A arg) { { R result = n.getCondition().accept(this, arg); if (result != null) { return result; } } { R result = n.getThenStmt().accept(this, arg); if (result != null) { return result; } } if (n.getElseStmt() != null) { { R result = n.getElseStmt().accept(this, arg); if (result != null) { return result; } } } return null; }
@Override public void visit(final BlockStmt n, final A arg) { visitComment(n.getComment(), arg); if (n.getStmts() != null) { for (final Statement s : n.getStmts()) { s.accept(this, arg); } } }
public void visit(LabeledStmt n, Object arg) { printer.print(n.getLabel()); printer.print(": "); n.getStmt().accept(this, arg); }
public void visit(WhileStmt n, Object arg) { printer.print("while ("); n.getCondition().accept(this, arg); printer.print(") "); n.getBody().accept(this, arg); }
@Override public Node visit(final ForStmt n, final A arg) { final List<Expression> init = n.getInit(); if (init != null) { for (int i = 0; i < init.size(); i++) { init.set(i, (Expression) init.get(i).accept(this, arg)); } removeNulls(init); } if (n.getCompare() != null) { n.setCompare((Expression) n.getCompare().accept(this, arg)); } final List<Expression> update = n.getUpdate(); if (update != null) { for (int i = 0; i < update.size(); i++) { update.set(i, (Expression) update.get(i).accept(this, arg)); } removeNulls(update); } n.setBody((Statement) n.getBody().accept(this, arg)); return n; }
@Override public void visit(final DoStmt n, final A arg) { visitComment(n.getComment(), arg); n.getBody().accept(this, arg); n.getCondition().accept(this, arg); }
@Override public void visit(final WhileStmt n, final A arg) { visitComment(n.getComment(), arg); n.getCondition().accept(this, arg); n.getBody().accept(this, arg); }
@Override public Node visit(final DoStmt n, final A arg) { n.setBody((Statement) n.getBody().accept(this, arg)); n.setCondition((Expression) n.getCondition().accept(this, arg)); return n; }