Ejemplo n.º 1
0
  // $ANTLR start "atom"
  // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:82:1: atom : ( NULL | NUMBER | STRING |
  // FIELD | LPAREN andexpression RPAREN );
  public final CriteriaParser.atom_return atom() throws RecognitionException {
    CriteriaParser.atom_return retval = new CriteriaParser.atom_return();
    retval.start = input.LT(1);

    Object root_0 = null;

    Token NULL14 = null;
    Token NUMBER15 = null;
    Token STRING16 = null;
    Token FIELD17 = null;
    Token LPAREN18 = null;
    Token RPAREN20 = null;
    CriteriaParser.andexpression_return andexpression19 = null;

    Object NULL14_tree = null;
    Object NUMBER15_tree = null;
    Object STRING16_tree = null;
    Object FIELD17_tree = null;
    Object LPAREN18_tree = null;
    Object RPAREN20_tree = null;

    try {
      // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:82:6: ( NULL | NUMBER | STRING |
      // FIELD | LPAREN andexpression RPAREN )
      int alt5 = 5;
      switch (input.LA(1)) {
        case NULL:
          {
            alt5 = 1;
          }
          break;
        case NUMBER:
          {
            alt5 = 2;
          }
          break;
        case STRING:
          {
            alt5 = 3;
          }
          break;
        case FIELD:
          {
            alt5 = 4;
          }
          break;
        case LPAREN:
          {
            alt5 = 5;
          }
          break;
        default:
          NoViableAltException nvae = new NoViableAltException("", 5, 0, input);

          throw nvae;
      }

      switch (alt5) {
        case 1:
          // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:82:8: NULL
          {
            root_0 = (Object) adaptor.nil();

            NULL14 = (Token) match(input, NULL, FOLLOW_NULL_in_atom477);
            NULL14_tree = (Object) adaptor.create(NULL14);
            adaptor.addChild(root_0, NULL14_tree);
          }
          break;
        case 2:
          // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:82:14: NUMBER
          {
            root_0 = (Object) adaptor.nil();

            NUMBER15 = (Token) match(input, NUMBER, FOLLOW_NUMBER_in_atom480);
            NUMBER15_tree = (Object) adaptor.create(NUMBER15);
            adaptor.addChild(root_0, NUMBER15_tree);
          }
          break;
        case 3:
          // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:82:23: STRING
          {
            root_0 = (Object) adaptor.nil();

            STRING16 = (Token) match(input, STRING, FOLLOW_STRING_in_atom484);
            STRING16_tree = (Object) adaptor.create(STRING16);
            adaptor.addChild(root_0, STRING16_tree);
          }
          break;
        case 4:
          // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:82:32: FIELD
          {
            root_0 = (Object) adaptor.nil();

            FIELD17 = (Token) match(input, FIELD, FOLLOW_FIELD_in_atom488);
            FIELD17_tree = (Object) adaptor.create(FIELD17);
            adaptor.addChild(root_0, FIELD17_tree);
          }
          break;
        case 5:
          // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:82:40: LPAREN andexpression
          // RPAREN
          {
            root_0 = (Object) adaptor.nil();

            LPAREN18 = (Token) match(input, LPAREN, FOLLOW_LPAREN_in_atom492);
            pushFollow(FOLLOW_andexpression_in_atom495);
            andexpression19 = andexpression();

            state._fsp--;

            adaptor.addChild(root_0, andexpression19.getTree());
            RPAREN20 = (Token) match(input, RPAREN, FOLLOW_RPAREN_in_atom497);
          }
          break;
      }
      retval.stop = input.LT(-1);

      retval.tree = (Object) adaptor.rulePostProcessing(root_0);
      adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

    } catch (RecognitionException re) {
      reportError(re);
      recover(input, re);
      retval.tree = (Object) adaptor.errorNode(input, retval.start, input.LT(-1), re);

    } finally {
    }
    return retval;
  }
Ejemplo n.º 2
0
  // $ANTLR start "arithmeticexpression"
  // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:79:1: arithmeticexpression : atom (
  // ARITHMETIC_OPERATOR atom )* ;
  public final CriteriaParser.arithmeticexpression_return arithmeticexpression()
      throws RecognitionException {
    CriteriaParser.arithmeticexpression_return retval =
        new CriteriaParser.arithmeticexpression_return();
    retval.start = input.LT(1);

    Object root_0 = null;

    Token ARITHMETIC_OPERATOR12 = null;
    CriteriaParser.atom_return atom11 = null;

    CriteriaParser.atom_return atom13 = null;

    Object ARITHMETIC_OPERATOR12_tree = null;

    try {
      // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:79:22: ( atom ( ARITHMETIC_OPERATOR
      // atom )* )
      // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:79:24: atom ( ARITHMETIC_OPERATOR
      // atom )*
      {
        root_0 = (Object) adaptor.nil();

        pushFollow(FOLLOW_atom_in_arithmeticexpression460);
        atom11 = atom();

        state._fsp--;

        adaptor.addChild(root_0, atom11.getTree());
        // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:79:29: ( ARITHMETIC_OPERATOR atom
        // )*
        loop4:
        do {
          int alt4 = 2;
          switch (input.LA(1)) {
            case ARITHMETIC_OPERATOR:
              {
                alt4 = 1;
              }
              break;
          }

          switch (alt4) {
            case 1:
              // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:79:30: ARITHMETIC_OPERATOR
              // atom
              {
                ARITHMETIC_OPERATOR12 =
                    (Token)
                        match(
                            input,
                            ARITHMETIC_OPERATOR,
                            FOLLOW_ARITHMETIC_OPERATOR_in_arithmeticexpression463);
                ARITHMETIC_OPERATOR12_tree = (Object) adaptor.create(ARITHMETIC_OPERATOR12);
                root_0 = (Object) adaptor.becomeRoot(ARITHMETIC_OPERATOR12_tree, root_0);

                pushFollow(FOLLOW_atom_in_arithmeticexpression466);
                atom13 = atom();

                state._fsp--;

                adaptor.addChild(root_0, atom13.getTree());
              }
              break;

            default:
              break loop4;
          }
        } while (true);
      }

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

      retval.tree = (Object) adaptor.rulePostProcessing(root_0);
      adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

    } catch (RecognitionException re) {
      reportError(re);
      recover(input, re);
      retval.tree = (Object) adaptor.errorNode(input, retval.start, input.LT(-1), re);

    } finally {
    }
    return retval;
  }