コード例 #1
0
ファイル: DefaultPack.java プロジェクト: cns-iu/nwb
  public Pack fromDefault(Pack pack) {
    Rule rule = pack.getRule();
    Target target = rule.getTarget();
    TuplePrototype targetPrototype = target.getPrototype();

    Function call = pack.getPriorCall();
    if (call == null) {
      throw new DefaultPackExpansionException("Cannot use implicit pack in a call-free chain.");
    }
    TuplePrototype callPrototype = target.getPrototype();

    if (callPrototype.size() != targetPrototype.size()) {
      throw new DefaultPackExpansionException(
          "Default pack cannot be created because tuple prototypes are of different lengths.");
    }

    Pack newPack = (Pack) adaptor.dupNode(pack);

    for (int i = 0; i < targetPrototype.size(); i++) {
      TupleRef ref = (TupleRef) adaptor.create(TUPLE_REF, "");
      adaptor.addChild(ref, adaptor.create(NUMBER, Integer.toString(i)));
      adaptor.addChild(newPack, ref);
    }

    return newPack;
  }
コード例 #2
0
  // $ANTLR start "json_argument"
  // AnnotationParser.g:125:1: json_argument : STRING_LITERAL ASIG ( STRING_LITERAL | STRING ) ;
  public final AnnotationParser.json_argument_return json_argument() throws RecognitionException {
    AnnotationParser.json_argument_return retval = new AnnotationParser.json_argument_return();
    retval.start = input.LT(1);

    AnnotationCommonTree root_0 = null;

    CommonToken STRING_LITERAL24 = null;
    CommonToken ASIG25 = null;
    CommonToken set26 = null;

    AnnotationCommonTree STRING_LITERAL24_tree = null;
    AnnotationCommonTree ASIG25_tree = null;
    AnnotationCommonTree set26_tree = null;

    try {
      // AnnotationParser.g:126:3: ( STRING_LITERAL ASIG ( STRING_LITERAL | STRING ) )
      // AnnotationParser.g:126:5: STRING_LITERAL ASIG ( STRING_LITERAL | STRING )
      {
        root_0 = (AnnotationCommonTree) adaptor.nil();

        STRING_LITERAL24 =
            (CommonToken) match(input, STRING_LITERAL, FOLLOW_STRING_LITERAL_in_json_argument386);
        STRING_LITERAL24_tree = (AnnotationCommonTree) adaptor.create(STRING_LITERAL24);
        adaptor.addChild(root_0, STRING_LITERAL24_tree);

        ASIG25 = (CommonToken) match(input, ASIG, FOLLOW_ASIG_in_json_argument388);
        ASIG25_tree = (AnnotationCommonTree) adaptor.create(ASIG25);
        adaptor.addChild(root_0, ASIG25_tree);

        set26 = (CommonToken) input.LT(1);
        if (input.LA(1) == STRING || input.LA(1) == STRING_LITERAL) {
          input.consume();
          adaptor.addChild(root_0, (AnnotationCommonTree) adaptor.create(set26));
          state.errorRecovery = false;
        } else {
          MismatchedSetException mse = new MismatchedSetException(null, input);
          throw mse;
        }
      }

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

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

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

    } finally {
    }
    return retval;
  }
コード例 #3
0
  // $ANTLR start "orexpression"
  // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:75:1: orexpression : logicalexpression (
  // OR logicalexpression )* ;
  public final CriteriaParser.orexpression_return orexpression() throws RecognitionException {
    CriteriaParser.orexpression_return retval = new CriteriaParser.orexpression_return();
    retval.start = input.LT(1);

    Object root_0 = null;

    Token OR6 = null;
    CriteriaParser.logicalexpression_return logicalexpression5 = null;

    CriteriaParser.logicalexpression_return logicalexpression7 = null;

    Object OR6_tree = null;

    try {
      // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:75:14: ( logicalexpression ( OR
      // logicalexpression )* )
      // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:75:16: logicalexpression ( OR
      // logicalexpression )*
      {
        root_0 = (Object) adaptor.nil();

        pushFollow(FOLLOW_logicalexpression_in_orexpression406);
        logicalexpression5 = logicalexpression();

        state._fsp--;

        adaptor.addChild(root_0, logicalexpression5.getTree());
        // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:75:34: ( OR logicalexpression )*
        loop2:
        do {
          int alt2 = 2;
          switch (input.LA(1)) {
            case OR:
              {
                alt2 = 1;
              }
              break;
          }

          switch (alt2) {
            case 1:
              // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:75:35: OR logicalexpression
              {
                OR6 = (Token) match(input, OR, FOLLOW_OR_in_orexpression409);
                OR6_tree = (Object) adaptor.create(OR6);
                root_0 = (Object) adaptor.becomeRoot(OR6_tree, root_0);

                pushFollow(FOLLOW_logicalexpression_in_orexpression412);
                logicalexpression7 = logicalexpression();

                state._fsp--;

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

            default:
              break loop2;
          }
        } 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;
  }
コード例 #4
0
  // $ANTLR start "andexpression"
  // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:72:1: andexpression : orexpression ( AND
  // orexpression )* ;
  public final CriteriaParser.andexpression_return andexpression() throws RecognitionException {
    CriteriaParser.andexpression_return retval = new CriteriaParser.andexpression_return();
    retval.start = input.LT(1);

    Object root_0 = null;

    Token AND3 = null;
    CriteriaParser.orexpression_return orexpression2 = null;

    CriteriaParser.orexpression_return orexpression4 = null;

    Object AND3_tree = null;

    try {
      // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:72:15: ( orexpression ( AND
      // orexpression )* )
      // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:72:17: orexpression ( AND
      // orexpression )*
      {
        root_0 = (Object) adaptor.nil();

        pushFollow(FOLLOW_orexpression_in_andexpression389);
        orexpression2 = orexpression();

        state._fsp--;

        adaptor.addChild(root_0, orexpression2.getTree());
        // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:72:30: ( AND orexpression )*
        loop1:
        do {
          int alt1 = 2;
          switch (input.LA(1)) {
            case AND:
              {
                alt1 = 1;
              }
              break;
          }

          switch (alt1) {
            case 1:
              // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:72:31: AND orexpression
              {
                AND3 = (Token) match(input, AND, FOLLOW_AND_in_andexpression392);
                AND3_tree = (Object) adaptor.create(AND3);
                root_0 = (Object) adaptor.becomeRoot(AND3_tree, root_0);

                pushFollow(FOLLOW_orexpression_in_andexpression395);
                orexpression4 = orexpression();

                state._fsp--;

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

            default:
              break loop1;
          }
        } 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;
  }
コード例 #5
0
  // $ANTLR start "eText"
  // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:274:1: eText : ( '\\'' TEXT '\\'' | '\"' TEXT '\"' | TEXT );
  public final CommandLineParser.eText_return eText() throws RecognitionException {
    CommandLineParser.eText_return retval = new CommandLineParser.eText_return();
    retval.start = input.LT(1);

    CommonTree root_0 = null;

    Token char_literal11 = null;
    Token TEXT12 = null;
    Token char_literal13 = null;
    Token char_literal14 = null;
    Token TEXT15 = null;
    Token char_literal16 = null;
    Token TEXT17 = null;

    CommonTree char_literal11_tree = null;
    CommonTree TEXT12_tree = null;
    CommonTree char_literal13_tree = null;
    CommonTree char_literal14_tree = null;
    CommonTree TEXT15_tree = null;
    CommonTree char_literal16_tree = null;
    CommonTree TEXT17_tree = null;

    try {
      // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:274:7: ( '\\'' TEXT '\\'' | '\"' TEXT '\"' | TEXT )
      int alt6 = 3;
      switch (input.LA(1)) {
        case 9:
          {
            alt6 = 1;
          }
          break;
        case 10:
          {
            alt6 = 2;
          }
          break;
        case TEXT:
          {
            alt6 = 3;
          }
          break;
        default:
          NoViableAltException nvae = new NoViableAltException("", 6, 0, input);

          throw nvae;
      }

      switch (alt6) {
        case 1:
          // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:275:3: '\\'' TEXT '\\''
          {
            root_0 = (CommonTree) adaptor.nil();

            char_literal11 = (Token) match(input, 9, FOLLOW_9_in_eText324);
            char_literal11_tree = (CommonTree) adaptor.create(char_literal11);
            adaptor.addChild(root_0, char_literal11_tree);

            TEXT12 = (Token) match(input, TEXT, FOLLOW_TEXT_in_eText326);
            TEXT12_tree = (CommonTree) adaptor.create(TEXT12);
            adaptor.addChild(root_0, TEXT12_tree);

            char_literal13 = (Token) match(input, 9, FOLLOW_9_in_eText328);
            char_literal13_tree = (CommonTree) adaptor.create(char_literal13);
            adaptor.addChild(root_0, char_literal13_tree);
          }
          break;
        case 2:
          // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:276:4: '\"' TEXT '\"'
          {
            root_0 = (CommonTree) adaptor.nil();

            char_literal14 = (Token) match(input, 10, FOLLOW_10_in_eText333);
            char_literal14_tree = (CommonTree) adaptor.create(char_literal14);
            adaptor.addChild(root_0, char_literal14_tree);

            TEXT15 = (Token) match(input, TEXT, FOLLOW_TEXT_in_eText335);
            TEXT15_tree = (CommonTree) adaptor.create(TEXT15);
            adaptor.addChild(root_0, TEXT15_tree);

            char_literal16 = (Token) match(input, 10, FOLLOW_10_in_eText338);
            char_literal16_tree = (CommonTree) adaptor.create(char_literal16);
            adaptor.addChild(root_0, char_literal16_tree);
          }
          break;
        case 3:
          // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:277:8: TEXT
          {
            root_0 = (CommonTree) adaptor.nil();

            TEXT17 = (Token) match(input, TEXT, FOLLOW_TEXT_in_eText347);
            TEXT17_tree = (CommonTree) adaptor.create(TEXT17);
            adaptor.addChild(root_0, TEXT17_tree);
          }
          break;
      }
      retval.stop = input.LT(-1);

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

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

    } finally {
    }
    return retval;
  }
コード例 #6
0
  // $ANTLR start "named_argument"
  // AnnotationParser.g:112:1: named_argument : param= STRING ASIG rhtype -> ^( NAMED_ARG $param
  // rhtype ) ;
  public final AnnotationParser.named_argument_return named_argument() throws RecognitionException {
    AnnotationParser.named_argument_return retval = new AnnotationParser.named_argument_return();
    retval.start = input.LT(1);

    AnnotationCommonTree root_0 = null;

    CommonToken param = null;
    CommonToken ASIG16 = null;
    AnnotationParser.rhtype_return rhtype17 = null;

    AnnotationCommonTree param_tree = null;
    AnnotationCommonTree ASIG16_tree = null;
    RewriteRuleTokenStream stream_ASIG = new RewriteRuleTokenStream(adaptor, "token ASIG");
    RewriteRuleTokenStream stream_STRING = new RewriteRuleTokenStream(adaptor, "token STRING");
    RewriteRuleSubtreeStream stream_rhtype = new RewriteRuleSubtreeStream(adaptor, "rule rhtype");
    try {
      // AnnotationParser.g:113:3: (param= STRING ASIG rhtype -> ^( NAMED_ARG $param rhtype ) )
      // AnnotationParser.g:113:5: param= STRING ASIG rhtype
      {
        param = (CommonToken) match(input, STRING, FOLLOW_STRING_in_named_argument310);
        stream_STRING.add(param);

        ASIG16 = (CommonToken) match(input, ASIG, FOLLOW_ASIG_in_named_argument312);
        stream_ASIG.add(ASIG16);

        pushFollow(FOLLOW_rhtype_in_named_argument314);
        rhtype17 = rhtype();

        state._fsp--;

        stream_rhtype.add(rhtype17.getTree());

        // AST REWRITE
        // elements: rhtype, param
        // token labels: param
        // rule labels: retval
        // token list labels:
        // rule list labels:
        // wildcard labels:
        retval.tree = root_0;
        RewriteRuleTokenStream stream_param =
            new RewriteRuleTokenStream(adaptor, "token param", param);
        RewriteRuleSubtreeStream stream_retval =
            new RewriteRuleSubtreeStream(
                adaptor, "rule retval", retval != null ? retval.tree : null);

        root_0 = (AnnotationCommonTree) adaptor.nil();
        // 114:5: -> ^( NAMED_ARG $param rhtype )
        {
          // AnnotationParser.g:114:8: ^( NAMED_ARG $param rhtype )
          {
            AnnotationCommonTree root_1 = (AnnotationCommonTree) adaptor.nil();
            root_1 =
                (AnnotationCommonTree)
                    adaptor.becomeRoot(
                        (AnnotationCommonTree) adaptor.create(NAMED_ARG, "NAMED_ARG"), root_1);

            adaptor.addChild(root_1, stream_param.nextNode());
            adaptor.addChild(root_1, stream_rhtype.nextTree());

            adaptor.addChild(root_0, root_1);
          }
        }

        retval.tree = root_0;
      }

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

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

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

    } finally {
    }
    return retval;
  }
コード例 #7
0
  // $ANTLR start "literal_argument"
  // AnnotationParser.g:107:1: literal_argument : param= STRING_LITERAL -> ^( LITERAL_ARG $param) ;
  public final AnnotationParser.literal_argument_return literal_argument()
      throws RecognitionException {
    AnnotationParser.literal_argument_return retval =
        new AnnotationParser.literal_argument_return();
    retval.start = input.LT(1);

    AnnotationCommonTree root_0 = null;

    CommonToken param = null;

    AnnotationCommonTree param_tree = null;
    RewriteRuleTokenStream stream_STRING_LITERAL =
        new RewriteRuleTokenStream(adaptor, "token STRING_LITERAL");

    try {
      // AnnotationParser.g:108:3: (param= STRING_LITERAL -> ^( LITERAL_ARG $param) )
      // AnnotationParser.g:108:5: param= STRING_LITERAL
      {
        param =
            (CommonToken)
                match(input, STRING_LITERAL, FOLLOW_STRING_LITERAL_in_literal_argument282);
        stream_STRING_LITERAL.add(param);

        // AST REWRITE
        // elements: param
        // token labels: param
        // rule labels: retval
        // token list labels:
        // rule list labels:
        // wildcard labels:
        retval.tree = root_0;
        RewriteRuleTokenStream stream_param =
            new RewriteRuleTokenStream(adaptor, "token param", param);
        RewriteRuleSubtreeStream stream_retval =
            new RewriteRuleSubtreeStream(
                adaptor, "rule retval", retval != null ? retval.tree : null);

        root_0 = (AnnotationCommonTree) adaptor.nil();
        // 109:5: -> ^( LITERAL_ARG $param)
        {
          // AnnotationParser.g:109:8: ^( LITERAL_ARG $param)
          {
            AnnotationCommonTree root_1 = (AnnotationCommonTree) adaptor.nil();
            root_1 =
                (AnnotationCommonTree)
                    adaptor.becomeRoot(
                        (AnnotationCommonTree) adaptor.create(LITERAL_ARG, "LITERAL_ARG"), root_1);

            adaptor.addChild(root_1, stream_param.nextNode());

            adaptor.addChild(root_0, root_1);
          }
        }

        retval.tree = root_0;
      }

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

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

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

    } finally {
    }
    return retval;
  }
コード例 #8
0
ファイル: FlumeShellParser.java プロジェクト: hammer/flume
  // $ANTLR start "literal"
  // /home/jon/flume/src/antlr/FlumeShell.g:93:1: literal : ( DQuoteLiteral -> ^( DQUOTE
  // DQuoteLiteral ) | SQuoteLiteral -> ^( SQUOTE SQuoteLiteral ) | Argument -> ^( STRING Argument )
  // );
  public final FlumeShellParser.literal_return literal() throws RecognitionException {
    FlumeShellParser.literal_return retval = new FlumeShellParser.literal_return();
    retval.start = input.LT(1);

    Object root_0 = null;

    Token DQuoteLiteral8 = null;
    Token SQuoteLiteral9 = null;
    Token Argument10 = null;

    Object DQuoteLiteral8_tree = null;
    Object SQuoteLiteral9_tree = null;
    Object Argument10_tree = null;
    RewriteRuleTokenStream stream_Argument = new RewriteRuleTokenStream(adaptor, "token Argument");
    RewriteRuleTokenStream stream_DQuoteLiteral =
        new RewriteRuleTokenStream(adaptor, "token DQuoteLiteral");
    RewriteRuleTokenStream stream_SQuoteLiteral =
        new RewriteRuleTokenStream(adaptor, "token SQuoteLiteral");

    try {
      // /home/jon/flume/src/antlr/FlumeShell.g:94:5: ( DQuoteLiteral -> ^( DQUOTE DQuoteLiteral ) |
      // SQuoteLiteral -> ^( SQUOTE SQuoteLiteral ) | Argument -> ^( STRING Argument ) )
      int alt3 = 3;
      switch (input.LA(1)) {
        case DQuoteLiteral:
          {
            alt3 = 1;
          }
          break;
        case SQuoteLiteral:
          {
            alt3 = 2;
          }
          break;
        case Argument:
          {
            alt3 = 3;
          }
          break;
        default:
          NoViableAltException nvae = new NoViableAltException("", 3, 0, input);

          throw nvae;
      }

      switch (alt3) {
        case 1:
          // /home/jon/flume/src/antlr/FlumeShell.g:94:9: DQuoteLiteral
          {
            DQuoteLiteral8 =
                (Token) match(input, DQuoteLiteral, FOLLOW_DQuoteLiteral_in_literal150);
            stream_DQuoteLiteral.add(DQuoteLiteral8);

            // AST REWRITE
            // elements: DQuoteLiteral
            // token labels:
            // rule labels: retval
            // token list labels:
            // rule list labels:
            // wildcard labels:
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval =
                new RewriteRuleSubtreeStream(
                    adaptor, "rule retval", retval != null ? retval.tree : null);

            root_0 = (Object) adaptor.nil();
            // 94:23: -> ^( DQUOTE DQuoteLiteral )
            {
              // /home/jon/flume/src/antlr/FlumeShell.g:94:26: ^( DQUOTE DQuoteLiteral )
              {
                Object root_1 = (Object) adaptor.nil();
                root_1 =
                    (Object) adaptor.becomeRoot((Object) adaptor.create(DQUOTE, "DQUOTE"), root_1);

                adaptor.addChild(root_1, stream_DQuoteLiteral.nextNode());

                adaptor.addChild(root_0, root_1);
              }
            }

            retval.tree = root_0;
          }
          break;
        case 2:
          // /home/jon/flume/src/antlr/FlumeShell.g:95:9: SQuoteLiteral
          {
            SQuoteLiteral9 =
                (Token) match(input, SQuoteLiteral, FOLLOW_SQuoteLiteral_in_literal170);
            stream_SQuoteLiteral.add(SQuoteLiteral9);

            // AST REWRITE
            // elements: SQuoteLiteral
            // token labels:
            // rule labels: retval
            // token list labels:
            // rule list labels:
            // wildcard labels:
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval =
                new RewriteRuleSubtreeStream(
                    adaptor, "rule retval", retval != null ? retval.tree : null);

            root_0 = (Object) adaptor.nil();
            // 95:23: -> ^( SQUOTE SQuoteLiteral )
            {
              // /home/jon/flume/src/antlr/FlumeShell.g:95:26: ^( SQUOTE SQuoteLiteral )
              {
                Object root_1 = (Object) adaptor.nil();
                root_1 =
                    (Object) adaptor.becomeRoot((Object) adaptor.create(SQUOTE, "SQUOTE"), root_1);

                adaptor.addChild(root_1, stream_SQuoteLiteral.nextNode());

                adaptor.addChild(root_0, root_1);
              }
            }

            retval.tree = root_0;
          }
          break;
        case 3:
          // /home/jon/flume/src/antlr/FlumeShell.g:96:9: Argument
          {
            Argument10 = (Token) match(input, Argument, FOLLOW_Argument_in_literal188);
            stream_Argument.add(Argument10);

            // AST REWRITE
            // elements: Argument
            // token labels:
            // rule labels: retval
            // token list labels:
            // rule list labels:
            // wildcard labels:
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval =
                new RewriteRuleSubtreeStream(
                    adaptor, "rule retval", retval != null ? retval.tree : null);

            root_0 = (Object) adaptor.nil();
            // 96:21: -> ^( STRING Argument )
            {
              // /home/jon/flume/src/antlr/FlumeShell.g:96:24: ^( STRING Argument )
              {
                Object root_1 = (Object) adaptor.nil();
                root_1 =
                    (Object) adaptor.becomeRoot((Object) adaptor.create(STRING, "STRING"), root_1);

                adaptor.addChild(root_1, stream_Argument.nextNode());

                adaptor.addChild(root_0, root_1);
              }
            }

            retval.tree = root_0;
          }
          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;
  }
コード例 #9
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;
  }
コード例 #10
0
  // $ANTLR start "argument_list"
  // AnnotationParser.g:78:1: argument_list : ( PARAM_START ( arguments )? PARAM_END )? -> ^(
  // ARGUMENT_LIST ( arguments )? ) ;
  public final AnnotationParser.argument_list_return argument_list() throws RecognitionException {
    AnnotationParser.argument_list_return retval = new AnnotationParser.argument_list_return();
    retval.start = input.LT(1);

    AnnotationCommonTree root_0 = null;

    CommonToken PARAM_START4 = null;
    CommonToken PARAM_END6 = null;
    AnnotationParser.arguments_return arguments5 = null;

    AnnotationCommonTree PARAM_START4_tree = null;
    AnnotationCommonTree PARAM_END6_tree = null;
    RewriteRuleTokenStream stream_PARAM_START =
        new RewriteRuleTokenStream(adaptor, "token PARAM_START");
    RewriteRuleTokenStream stream_PARAM_END =
        new RewriteRuleTokenStream(adaptor, "token PARAM_END");
    RewriteRuleSubtreeStream stream_arguments =
        new RewriteRuleSubtreeStream(adaptor, "rule arguments");
    try {
      // AnnotationParser.g:79:3: ( ( PARAM_START ( arguments )? PARAM_END )? -> ^( ARGUMENT_LIST (
      // arguments )? ) )
      // AnnotationParser.g:79:5: ( PARAM_START ( arguments )? PARAM_END )?
      {
        // AnnotationParser.g:79:5: ( PARAM_START ( arguments )? PARAM_END )?
        int alt2 = 2;
        int LA2_0 = input.LA(1);

        if ((LA2_0 == PARAM_START)) {
          alt2 = 1;
        }
        switch (alt2) {
          case 1:
            // AnnotationParser.g:79:6: PARAM_START ( arguments )? PARAM_END
            {
              PARAM_START4 =
                  (CommonToken) match(input, PARAM_START, FOLLOW_PARAM_START_in_argument_list122);
              stream_PARAM_START.add(PARAM_START4);

              // AnnotationParser.g:79:18: ( arguments )?
              int alt1 = 2;
              int LA1_0 = input.LA(1);

              if ((LA1_0 == JSON_START || LA1_0 == STRING || LA1_0 == STRING_LITERAL)) {
                alt1 = 1;
              }
              switch (alt1) {
                case 1:
                  // AnnotationParser.g:79:18: arguments
                  {
                    pushFollow(FOLLOW_arguments_in_argument_list124);
                    arguments5 = arguments();

                    state._fsp--;

                    stream_arguments.add(arguments5.getTree());
                  }
                  break;
              }

              PARAM_END6 =
                  (CommonToken) match(input, PARAM_END, FOLLOW_PARAM_END_in_argument_list127);
              stream_PARAM_END.add(PARAM_END6);
            }
            break;
        }

        // AST REWRITE
        // elements: arguments
        // token labels:
        // rule labels: retval
        // token list labels:
        // rule list labels:
        // wildcard labels:
        retval.tree = root_0;
        RewriteRuleSubtreeStream stream_retval =
            new RewriteRuleSubtreeStream(
                adaptor, "rule retval", retval != null ? retval.tree : null);

        root_0 = (AnnotationCommonTree) adaptor.nil();
        // 80:5: -> ^( ARGUMENT_LIST ( arguments )? )
        {
          // AnnotationParser.g:80:8: ^( ARGUMENT_LIST ( arguments )? )
          {
            AnnotationCommonTree root_1 = (AnnotationCommonTree) adaptor.nil();
            root_1 =
                (AnnotationCommonTree)
                    adaptor.becomeRoot(
                        (AnnotationCommonTree) adaptor.create(ARGUMENT_LIST, "ARGUMENT_LIST"),
                        root_1);

            // AnnotationParser.g:80:24: ( arguments )?
            if (stream_arguments.hasNext()) {
              adaptor.addChild(root_1, stream_arguments.nextTree());
            }
            stream_arguments.reset();

            adaptor.addChild(root_0, root_1);
          }
        }

        retval.tree = root_0;
      }

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

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

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

    } finally {
    }
    return retval;
  }
コード例 #11
0
  // $ANTLR start "annotation"
  // AnnotationParser.g:72:1: annotation : AT ann_class argument_list -> ^( ANNOTATION ann_class
  // argument_list ) ;
  public final AnnotationParser.annotation_return annotation() throws RecognitionException {
    AnnotationParser.annotation_return retval = new AnnotationParser.annotation_return();
    retval.start = input.LT(1);

    AnnotationCommonTree root_0 = null;

    CommonToken AT1 = null;
    AnnotationParser.ann_class_return ann_class2 = null;

    AnnotationParser.argument_list_return argument_list3 = null;

    AnnotationCommonTree AT1_tree = null;
    RewriteRuleTokenStream stream_AT = new RewriteRuleTokenStream(adaptor, "token AT");
    RewriteRuleSubtreeStream stream_argument_list =
        new RewriteRuleSubtreeStream(adaptor, "rule argument_list");
    RewriteRuleSubtreeStream stream_ann_class =
        new RewriteRuleSubtreeStream(adaptor, "rule ann_class");
    try {
      // AnnotationParser.g:73:3: ( AT ann_class argument_list -> ^( ANNOTATION ann_class
      // argument_list ) )
      // AnnotationParser.g:73:5: AT ann_class argument_list
      {
        AT1 = (CommonToken) match(input, AT, FOLLOW_AT_in_annotation90);
        stream_AT.add(AT1);

        pushFollow(FOLLOW_ann_class_in_annotation92);
        ann_class2 = ann_class();

        state._fsp--;

        stream_ann_class.add(ann_class2.getTree());
        pushFollow(FOLLOW_argument_list_in_annotation94);
        argument_list3 = argument_list();

        state._fsp--;

        stream_argument_list.add(argument_list3.getTree());

        // AST REWRITE
        // elements: argument_list, ann_class
        // token labels:
        // rule labels: retval
        // token list labels:
        // rule list labels:
        // wildcard labels:
        retval.tree = root_0;
        RewriteRuleSubtreeStream stream_retval =
            new RewriteRuleSubtreeStream(
                adaptor, "rule retval", retval != null ? retval.tree : null);

        root_0 = (AnnotationCommonTree) adaptor.nil();
        // 74:5: -> ^( ANNOTATION ann_class argument_list )
        {
          // AnnotationParser.g:74:7: ^( ANNOTATION ann_class argument_list )
          {
            AnnotationCommonTree root_1 = (AnnotationCommonTree) adaptor.nil();
            root_1 =
                (AnnotationCommonTree)
                    adaptor.becomeRoot(
                        (AnnotationCommonTree) adaptor.create(ANNOTATION, "ANNOTATION"), root_1);

            adaptor.addChild(root_1, stream_ann_class.nextTree());
            adaptor.addChild(root_1, stream_argument_list.nextTree());

            adaptor.addChild(root_0, root_1);
          }
        }

        retval.tree = root_0;
      }

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

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

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

    } finally {
    }
    return retval;
  }
コード例 #12
0
  // $ANTLR start "rhtype"
  // AnnotationParser.g:129:1: rhtype : (param= STRING -> ^( RHTYPE $param) | param= STRING_LITERAL
  // -> ^( RHTYPE $param) | json );
  public final AnnotationParser.rhtype_return rhtype() throws RecognitionException {
    AnnotationParser.rhtype_return retval = new AnnotationParser.rhtype_return();
    retval.start = input.LT(1);

    AnnotationCommonTree root_0 = null;

    CommonToken param = null;
    AnnotationParser.json_return json27 = null;

    AnnotationCommonTree param_tree = null;
    RewriteRuleTokenStream stream_STRING_LITERAL =
        new RewriteRuleTokenStream(adaptor, "token STRING_LITERAL");
    RewriteRuleTokenStream stream_STRING = new RewriteRuleTokenStream(adaptor, "token STRING");

    try {
      // AnnotationParser.g:130:3: (param= STRING -> ^( RHTYPE $param) | param= STRING_LITERAL -> ^(
      // RHTYPE $param) | json )
      int alt8 = 3;
      switch (input.LA(1)) {
        case STRING:
          {
            alt8 = 1;
          }
          break;
        case STRING_LITERAL:
          {
            alt8 = 2;
          }
          break;
        case JSON_START:
          {
            alt8 = 3;
          }
          break;
        default:
          NoViableAltException nvae = new NoViableAltException("", 8, 0, input);

          throw nvae;
      }

      switch (alt8) {
        case 1:
          // AnnotationParser.g:130:5: param= STRING
          {
            param = (CommonToken) match(input, STRING, FOLLOW_STRING_in_rhtype411);
            stream_STRING.add(param);

            // AST REWRITE
            // elements: param
            // token labels: param
            // rule labels: retval
            // token list labels:
            // rule list labels:
            // wildcard labels:
            retval.tree = root_0;
            RewriteRuleTokenStream stream_param =
                new RewriteRuleTokenStream(adaptor, "token param", param);
            RewriteRuleSubtreeStream stream_retval =
                new RewriteRuleSubtreeStream(
                    adaptor, "rule retval", retval != null ? retval.tree : null);

            root_0 = (AnnotationCommonTree) adaptor.nil();
            // 131:5: -> ^( RHTYPE $param)
            {
              // AnnotationParser.g:131:8: ^( RHTYPE $param)
              {
                AnnotationCommonTree root_1 = (AnnotationCommonTree) adaptor.nil();
                root_1 =
                    (AnnotationCommonTree)
                        adaptor.becomeRoot(
                            (AnnotationCommonTree) adaptor.create(RHTYPE, "RHTYPE"), root_1);

                adaptor.addChild(root_1, stream_param.nextNode());

                adaptor.addChild(root_0, root_1);
              }
            }

            retval.tree = root_0;
          }
          break;
        case 2:
          // AnnotationParser.g:132:5: param= STRING_LITERAL
          {
            param = (CommonToken) match(input, STRING_LITERAL, FOLLOW_STRING_LITERAL_in_rhtype432);
            stream_STRING_LITERAL.add(param);

            // AST REWRITE
            // elements: param
            // token labels: param
            // rule labels: retval
            // token list labels:
            // rule list labels:
            // wildcard labels:
            retval.tree = root_0;
            RewriteRuleTokenStream stream_param =
                new RewriteRuleTokenStream(adaptor, "token param", param);
            RewriteRuleSubtreeStream stream_retval =
                new RewriteRuleSubtreeStream(
                    adaptor, "rule retval", retval != null ? retval.tree : null);

            root_0 = (AnnotationCommonTree) adaptor.nil();
            // 133:5: -> ^( RHTYPE $param)
            {
              // AnnotationParser.g:133:8: ^( RHTYPE $param)
              {
                AnnotationCommonTree root_1 = (AnnotationCommonTree) adaptor.nil();
                root_1 =
                    (AnnotationCommonTree)
                        adaptor.becomeRoot(
                            (AnnotationCommonTree) adaptor.create(RHTYPE, "RHTYPE"), root_1);

                adaptor.addChild(root_1, stream_param.nextNode());

                adaptor.addChild(root_0, root_1);
              }
            }

            retval.tree = root_0;
          }
          break;
        case 3:
          // AnnotationParser.g:134:5: json
          {
            root_0 = (AnnotationCommonTree) adaptor.nil();

            pushFollow(FOLLOW_json_in_rhtype451);
            json27 = json();

            state._fsp--;

            adaptor.addChild(root_0, json27.getTree());
          }
          break;
      }
      retval.stop = input.LT(-1);

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

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

    } finally {
    }
    return retval;
  }
コード例 #13
0
  // $ANTLR start "json_arguments"
  // AnnotationParser.g:121:1: json_arguments : json_argument ( COMMA ( json_argument ) )* ;
  public final AnnotationParser.json_arguments_return json_arguments() throws RecognitionException {
    AnnotationParser.json_arguments_return retval = new AnnotationParser.json_arguments_return();
    retval.start = input.LT(1);

    AnnotationCommonTree root_0 = null;

    CommonToken COMMA22 = null;
    AnnotationParser.json_argument_return json_argument21 = null;

    AnnotationParser.json_argument_return json_argument23 = null;

    AnnotationCommonTree COMMA22_tree = null;

    try {
      // AnnotationParser.g:122:3: ( json_argument ( COMMA ( json_argument ) )* )
      // AnnotationParser.g:122:5: json_argument ( COMMA ( json_argument ) )*
      {
        root_0 = (AnnotationCommonTree) adaptor.nil();

        pushFollow(FOLLOW_json_argument_in_json_arguments362);
        json_argument21 = json_argument();

        state._fsp--;

        adaptor.addChild(root_0, json_argument21.getTree());
        // AnnotationParser.g:122:19: ( COMMA ( json_argument ) )*
        loop7:
        do {
          int alt7 = 2;
          int LA7_0 = input.LA(1);

          if ((LA7_0 == COMMA)) {
            alt7 = 1;
          }

          switch (alt7) {
            case 1:
              // AnnotationParser.g:122:20: COMMA ( json_argument )
              {
                COMMA22 = (CommonToken) match(input, COMMA, FOLLOW_COMMA_in_json_arguments365);
                COMMA22_tree = (AnnotationCommonTree) adaptor.create(COMMA22);
                adaptor.addChild(root_0, COMMA22_tree);

                // AnnotationParser.g:122:26: ( json_argument )
                // AnnotationParser.g:122:27: json_argument
                {
                  pushFollow(FOLLOW_json_argument_in_json_arguments368);
                  json_argument23 = json_argument();

                  state._fsp--;

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

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

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

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

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

    } finally {
    }
    return retval;
  }
コード例 #14
0
  // $ANTLR start "json"
  // AnnotationParser.g:117:1: json : JSON_START ( json_arguments )? JSON_END ;
  public final AnnotationParser.json_return json() throws RecognitionException {
    AnnotationParser.json_return retval = new AnnotationParser.json_return();
    retval.start = input.LT(1);

    AnnotationCommonTree root_0 = null;

    CommonToken JSON_START18 = null;
    CommonToken JSON_END20 = null;
    AnnotationParser.json_arguments_return json_arguments19 = null;

    AnnotationCommonTree JSON_START18_tree = null;
    AnnotationCommonTree JSON_END20_tree = null;

    try {
      // AnnotationParser.g:118:3: ( JSON_START ( json_arguments )? JSON_END )
      // AnnotationParser.g:118:5: JSON_START ( json_arguments )? JSON_END
      {
        root_0 = (AnnotationCommonTree) adaptor.nil();

        JSON_START18 = (CommonToken) match(input, JSON_START, FOLLOW_JSON_START_in_json342);
        JSON_START18_tree = (AnnotationCommonTree) adaptor.create(JSON_START18);
        adaptor.addChild(root_0, JSON_START18_tree);

        // AnnotationParser.g:118:16: ( json_arguments )?
        int alt6 = 2;
        int LA6_0 = input.LA(1);

        if ((LA6_0 == STRING_LITERAL)) {
          alt6 = 1;
        }
        switch (alt6) {
          case 1:
            // AnnotationParser.g:118:16: json_arguments
            {
              pushFollow(FOLLOW_json_arguments_in_json344);
              json_arguments19 = json_arguments();

              state._fsp--;

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

        JSON_END20 = (CommonToken) match(input, JSON_END, FOLLOW_JSON_END_in_json347);
        JSON_END20_tree = (AnnotationCommonTree) adaptor.create(JSON_END20);
        adaptor.addChild(root_0, JSON_END20_tree);
      }

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

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

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

    } finally {
    }
    return retval;
  }
コード例 #15
0
  // $ANTLR start "logicalexpression"
  // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:77:1: logicalexpression :
  // arithmeticexpression ( ( LT | LTE | GT | GTE | IS | NE ) arithmeticexpression )* ;
  public final CriteriaParser.logicalexpression_return logicalexpression()
      throws RecognitionException {
    CriteriaParser.logicalexpression_return retval = new CriteriaParser.logicalexpression_return();
    retval.start = input.LT(1);

    Object root_0 = null;

    Token set9 = null;
    CriteriaParser.arithmeticexpression_return arithmeticexpression8 = null;

    CriteriaParser.arithmeticexpression_return arithmeticexpression10 = null;

    Object set9_tree = null;

    try {
      // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:77:19: ( arithmeticexpression ( ( LT
      // | LTE | GT | GTE | IS | NE ) arithmeticexpression )* )
      // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:77:21: arithmeticexpression ( ( LT |
      // LTE | GT | GTE | IS | NE ) arithmeticexpression )*
      {
        root_0 = (Object) adaptor.nil();

        pushFollow(FOLLOW_arithmeticexpression_in_logicalexpression422);
        arithmeticexpression8 = arithmeticexpression();

        state._fsp--;

        adaptor.addChild(root_0, arithmeticexpression8.getTree());
        // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:77:42: ( ( LT | LTE | GT | GTE |
        // IS | NE ) arithmeticexpression )*
        loop3:
        do {
          int alt3 = 2;
          switch (input.LA(1)) {
            case LT:
            case LTE:
            case GT:
            case GTE:
            case IS:
            case NE:
              {
                alt3 = 1;
              }
              break;
          }

          switch (alt3) {
            case 1:
              // com/pmerienne/eventmonitoring/shared/parser/Criteria.g:77:43: ( LT | LTE | GT | GTE
              // | IS | NE ) arithmeticexpression
              {
                set9 = (Token) input.LT(1);
                set9 = (Token) input.LT(1);
                if ((input.LA(1) >= LT && input.LA(1) <= NE)) {
                  input.consume();
                  root_0 = (Object) adaptor.becomeRoot((Object) adaptor.create(set9), root_0);
                  state.errorRecovery = false;
                } else {
                  MismatchedSetException mse = new MismatchedSetException(null, input);
                  throw mse;
                }

                pushFollow(FOLLOW_arithmeticexpression_in_logicalexpression450);
                arithmeticexpression10 = arithmeticexpression();

                state._fsp--;

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

            default:
              break loop3;
          }
        } 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;
  }
コード例 #16
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;
  }
コード例 #17
0
  // $ANTLR start "namespace"
  // AnnotationParser.g:87:1: namespace : ns= STRING BSLASH -> ^( NSPART $ns) ;
  public final AnnotationParser.namespace_return namespace() throws RecognitionException {
    AnnotationParser.namespace_return retval = new AnnotationParser.namespace_return();
    retval.start = input.LT(1);

    AnnotationCommonTree root_0 = null;

    CommonToken ns = null;
    CommonToken BSLASH9 = null;

    AnnotationCommonTree ns_tree = null;
    AnnotationCommonTree BSLASH9_tree = null;
    RewriteRuleTokenStream stream_BSLASH = new RewriteRuleTokenStream(adaptor, "token BSLASH");
    RewriteRuleTokenStream stream_STRING = new RewriteRuleTokenStream(adaptor, "token STRING");

    try {
      // AnnotationParser.g:88:3: (ns= STRING BSLASH -> ^( NSPART $ns) )
      // AnnotationParser.g:88:5: ns= STRING BSLASH
      {
        ns = (CommonToken) match(input, STRING, FOLLOW_STRING_in_namespace175);
        stream_STRING.add(ns);

        BSLASH9 = (CommonToken) match(input, BSLASH, FOLLOW_BSLASH_in_namespace177);
        stream_BSLASH.add(BSLASH9);

        // AST REWRITE
        // elements: ns
        // token labels: ns
        // rule labels: retval
        // token list labels:
        // rule list labels:
        // wildcard labels:
        retval.tree = root_0;
        RewriteRuleTokenStream stream_ns = new RewriteRuleTokenStream(adaptor, "token ns", ns);
        RewriteRuleSubtreeStream stream_retval =
            new RewriteRuleSubtreeStream(
                adaptor, "rule retval", retval != null ? retval.tree : null);

        root_0 = (AnnotationCommonTree) adaptor.nil();
        // 89:4: -> ^( NSPART $ns)
        {
          // AnnotationParser.g:89:6: ^( NSPART $ns)
          {
            AnnotationCommonTree root_1 = (AnnotationCommonTree) adaptor.nil();
            root_1 =
                (AnnotationCommonTree)
                    adaptor.becomeRoot(
                        (AnnotationCommonTree) adaptor.create(NSPART, "NSPART"), root_1);

            adaptor.addChild(root_1, stream_ns.nextNode());

            adaptor.addChild(root_0, root_1);
          }
        }

        retval.tree = root_0;
      }

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

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

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

    } finally {
    }
    return retval;
  }
コード例 #18
0
  // $ANTLR start "classname"
  // AnnotationParser.g:92:1: classname : cn= STRING -> ^( CLASSNAME $cn) ;
  public final AnnotationParser.classname_return classname() throws RecognitionException {
    AnnotationParser.classname_return retval = new AnnotationParser.classname_return();
    retval.start = input.LT(1);

    AnnotationCommonTree root_0 = null;

    CommonToken cn = null;

    AnnotationCommonTree cn_tree = null;
    RewriteRuleTokenStream stream_STRING = new RewriteRuleTokenStream(adaptor, "token STRING");

    try {
      // AnnotationParser.g:93:3: (cn= STRING -> ^( CLASSNAME $cn) )
      // AnnotationParser.g:93:5: cn= STRING
      {
        cn = (CommonToken) match(input, STRING, FOLLOW_STRING_in_classname205);
        stream_STRING.add(cn);

        // AST REWRITE
        // elements: cn
        // token labels: cn
        // rule labels: retval
        // token list labels:
        // rule list labels:
        // wildcard labels:
        retval.tree = root_0;
        RewriteRuleTokenStream stream_cn = new RewriteRuleTokenStream(adaptor, "token cn", cn);
        RewriteRuleSubtreeStream stream_retval =
            new RewriteRuleSubtreeStream(
                adaptor, "rule retval", retval != null ? retval.tree : null);

        root_0 = (AnnotationCommonTree) adaptor.nil();
        // 94:5: -> ^( CLASSNAME $cn)
        {
          // AnnotationParser.g:94:7: ^( CLASSNAME $cn)
          {
            AnnotationCommonTree root_1 = (AnnotationCommonTree) adaptor.nil();
            root_1 =
                (AnnotationCommonTree)
                    adaptor.becomeRoot(
                        (AnnotationCommonTree) adaptor.create(CLASSNAME, "CLASSNAME"), root_1);

            adaptor.addChild(root_1, stream_cn.nextNode());

            adaptor.addChild(root_0, root_1);
          }
        }

        retval.tree = root_0;
      }

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

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

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

    } finally {
    }
    return retval;
  }
コード例 #19
0
ファイル: FlumeShellParser.java プロジェクト: hammer/flume
  // $ANTLR start "command"
  // /home/jon/flume/src/antlr/FlumeShell.g:90:1: command : ( literal )+ -> ^( CMD ( literal )+ ) ;
  public final FlumeShellParser.command_return command() throws RecognitionException {
    FlumeShellParser.command_return retval = new FlumeShellParser.command_return();
    retval.start = input.LT(1);

    Object root_0 = null;

    FlumeShellParser.literal_return literal7 = null;

    RewriteRuleSubtreeStream stream_literal = new RewriteRuleSubtreeStream(adaptor, "rule literal");
    try {
      // /home/jon/flume/src/antlr/FlumeShell.g:90:9: ( ( literal )+ -> ^( CMD ( literal )+ ) )
      // /home/jon/flume/src/antlr/FlumeShell.g:90:11: ( literal )+
      {
        // /home/jon/flume/src/antlr/FlumeShell.g:90:11: ( literal )+
        int cnt2 = 0;
        loop2:
        do {
          int alt2 = 2;
          int LA2_0 = input.LA(1);

          if (((LA2_0 >= DQuoteLiteral && LA2_0 <= Argument))) {
            alt2 = 1;
          }

          switch (alt2) {
            case 1:
              // /home/jon/flume/src/antlr/FlumeShell.g:90:11: literal
              {
                pushFollow(FOLLOW_literal_in_command122);
                literal7 = literal();

                state._fsp--;

                stream_literal.add(literal7.getTree());
              }
              break;

            default:
              if (cnt2 >= 1) break loop2;
              EarlyExitException eee = new EarlyExitException(2, input);
              throw eee;
          }
          cnt2++;
        } while (true);

        // AST REWRITE
        // elements: literal
        // token labels:
        // rule labels: retval
        // token list labels:
        // rule list labels:
        // wildcard labels:
        retval.tree = root_0;
        RewriteRuleSubtreeStream stream_retval =
            new RewriteRuleSubtreeStream(
                adaptor, "rule retval", retval != null ? retval.tree : null);

        root_0 = (Object) adaptor.nil();
        // 90:20: -> ^( CMD ( literal )+ )
        {
          // /home/jon/flume/src/antlr/FlumeShell.g:90:23: ^( CMD ( literal )+ )
          {
            Object root_1 = (Object) adaptor.nil();
            root_1 = (Object) adaptor.becomeRoot((Object) adaptor.create(CMD, "CMD"), root_1);

            if (!(stream_literal.hasNext())) {
              throw new RewriteEarlyExitException();
            }
            while (stream_literal.hasNext()) {
              adaptor.addChild(root_1, stream_literal.nextTree());
            }
            stream_literal.reset();

            adaptor.addChild(root_0, root_1);
          }
        }

        retval.tree = root_0;
      }

      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;
  }