Ejemplo n.º 1
0
  public static void error(int err) {
    int n = 0;
    // if(currentToken<tokens.size())
    if (err != 4
        && currentToken != 0
        && (tokens.get(currentToken - 1).getLine() < tokens.get(currentToken).getLine())) {
      n = tokens.get(currentToken - 1).getLine();
    } else {
      n = tokens.get(currentToken).getLine();
    }

    switch (err) {
      case 1:
        gui.writeConsole("Line" + n + ":expected {");
        break;
      case 2:
        gui.writeConsole("Line" + n + ":expected }");
        break;
      case 3:
        gui.writeConsole("Line" + n + ":expected ;");
        break;
      case 4:
        gui.writeConsole("Line" + n + ":expected identifier or keyword");
        break;
      case 5:
        gui.writeConsole("Line" + n + ": expected =");
        break;
      case 6:
        gui.writeConsole("Line" + n + ": expected identifier");
        break;
      case 7:
        gui.writeConsole("Line" + n + ": expected )");
        break;
      case 8:
        gui.writeConsole("Line" + n + ": expected (");
        break;
      case 9:
        gui.writeConsole("Line" + n + ": expected value, identifier, (");
        break;
    }
  }
Ejemplo n.º 2
0
  /**
   * Error
   *
   * @param int code
   */
  public static void error(int code) {
    int n = tokens.get(currentToken - 1).getLine();

    switch (code) {
      case 1:
        gui.writeConsole("Line " + n + ": expected {");
        break;

      case 2:
        gui.writeConsole("Line " + n + ": expected }");
        break;

      case 3:
        gui.writeConsole("Line " + n + ": expected ;");
        break;

      case 4:
        gui.writeConsole("Line " + n + ": expected identifier or keyword");
        break;

      case 5:
        gui.writeConsole("Line " + n + ": expected =");
        break;

      case 6:
        gui.writeConsole("Line " + n + ": expected identifier");
        break;

      case 7:
        gui.writeConsole("Line " + n + ": expected )");
        break;

      case 8:
        gui.writeConsole("Line " + n + ": expected (");
        break;

      case 9:
        gui.writeConsole("Line " + n + ": expected value, identifier, (");
        break;

      case 10:
        gui.writeConsole("Line " + n + ": expected keyword");
        break;

      case 11:
        gui.writeConsole("Line " + n + ": expected type");
        break;
    }
  }