コード例 #1
0
  // $ANTLR start "argument"
  // /Users/joachim/workspace/MartScript/ANTLR/MartScript.g:42:1: argument : ( LETTER | SEPERATOR |
  // DIGIT | OTHERS )+ ;
  public final MartScriptParser.argument_return argument() throws RecognitionException {
    MartScriptParser.argument_return retval = new MartScriptParser.argument_return();
    retval.start = input.LT(1);

    try {
      // /Users/joachim/workspace/MartScript/ANTLR/MartScript.g:43:2: ( ( LETTER | SEPERATOR | DIGIT
      // | OTHERS )+ )
      // /Users/joachim/workspace/MartScript/ANTLR/MartScript.g:43:4: ( LETTER | SEPERATOR | DIGIT |
      // OTHERS )+
      {
        // /Users/joachim/workspace/MartScript/ANTLR/MartScript.g:43:4: ( LETTER | SEPERATOR | DIGIT
        // | OTHERS )+
        int cnt5 = 0;
        loop5:
        do {
          int alt5 = 2;
          int LA5_0 = input.LA(1);

          if (((LA5_0 >= LETTER && LA5_0 <= DIGIT) || LA5_0 == OTHERS)) {
            alt5 = 1;
          }

          switch (alt5) {
            case 1:
              // /Users/joachim/workspace/MartScript/ANTLR/MartScript.g:
              {
                if ((input.LA(1) >= LETTER && input.LA(1) <= DIGIT) || input.LA(1) == OTHERS) {
                  input.consume();
                  state.errorRecovery = false;
                } else {
                  MismatchedSetException mse = new MismatchedSetException(null, input);
                  throw mse;
                }
              }
              break;

            default:
              if (cnt5 >= 1) break loop5;
              EarlyExitException eee = new EarlyExitException(5, input);
              throw eee;
          }
          cnt5++;
        } while (true);

        parameters.add(input.toString(retval.start, input.LT(-1)));
      }

      retval.stop = input.LT(-1);

    } catch (RecognitionException re) {
      reportError(re);
      recover(input, re);
    } finally {
    }
    return retval;
  }
コード例 #2
0
  // $ANTLR start "action"
  // /Users/joachim/workspace/MartScript/ANTLR/MartScript.g:24:1: action : command NEWLINE ;
  public final void action() throws RecognitionException {
    Action command1 = null;

    try {
      // /Users/joachim/workspace/MartScript/ANTLR/MartScript.g:25:2: ( command NEWLINE )
      // /Users/joachim/workspace/MartScript/ANTLR/MartScript.g:25:4: command NEWLINE
      {
        pushFollow(FOLLOW_command_in_action85);
        command1 = command();

        state._fsp--;

        match(input, NEWLINE, FOLLOW_NEWLINE_in_action87);
        source.add(command1);
      }

    } catch (RecognitionException re) {
      reportError(re);
      recover(input, re);
    } finally {
    }
    return;
  }