// Exp e1,e2;
 public Object visit(ArrayLookup n) { // Implementado
   Object ep1 = n.e1.accept(this);
   Object ep2 = n.e2.accept(this);
   if (ep1 instanceof String && ep1 instanceof String) {
     String exp1 = (String) ep1;
     String exp2 = (String) ep2;
     if (exp2.equalsIgnoreCase("IntegerType") && exp1.equalsIgnoreCase("IntArrayType"))
       return "IntegerType";
     else {
       error.add("Expressao invalida! Tipos incorretos no Array! Linha: " + n.getLine_number());
     }
   }
   return null;
 }
Esempio n. 2
0
 @Override
 public void visit(ArrayLookup arrayLookup) {
   if (arrayLookup.getArray() != null) arrayLookup.getArray().accept(this);
   System.out.print("[");
   if (arrayLookup.getIndex() != null) arrayLookup.getIndex().accept(this);
 }