static final public int factor() throws ParseException {
  Token var;
  Token number;
  int value;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case NUMBER:
      number = jj_consume_token(NUMBER);
        {if (true) return Integer.parseInt(number.image);}
      break;
    case VAR:
      var = jj_consume_token(VAR);
        if (!variables.keySet().contains(var.image))
        {
          System.out.println("Variable " + var.image + " has not been declared!");
          System.exit(1);
        }
        used.add(var.image);

        {if (true) return variables.get(var.image);}
      break;
    case OPENBRACKET:
      jj_consume_token(OPENBRACKET);
      value = expr();
      jj_consume_token(CLOSEBRACKET);
          {if (true) return value;}
      break;
    default:
      jj_la1[4] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }