// Exp e; // Statement s1,s2; public Object visit(If n) { // Implementado Object ep = n.e.accept(this); if (ep instanceof String) { String exp = (String) ep; if (!exp.equalsIgnoreCase("BooleanType")) error.add("Expressao no If nao eh um booleano! Linha: " + n.getLine_number()); } n.s1.accept(this); n.s2.accept(this); return null; }
@Override public void visit(If ifStm) { System.out.print("if ("); if (ifStm.getCondExp() != null) ifStm.getCondExp().accept(this); System.out.println(")"); System.out.print("\t\t\t"); if (ifStm.getTrueStm() != null) ifStm.getTrueStm().accept(this); System.out.println(); System.out.println("\t\telse"); System.out.print("\t\t\t"); if (ifStm.getFalseStm() != null) ifStm.getFalseStm().accept(this); }