// $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;
  }
  // $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;
  }
  // $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;
  }
  // $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;
  }
  // $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;
  }
示例#6
0
  // $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;
  }