コード例 #1
0
  // $ANTLR start "arguments"
  // AnnotationParser.g:97:1: arguments : argument ( COMMA arguments )? -> argument ( arguments )? ;
  public final AnnotationParser.arguments_return arguments() throws RecognitionException {
    AnnotationParser.arguments_return retval = new AnnotationParser.arguments_return();
    retval.start = input.LT(1);

    AnnotationCommonTree root_0 = null;

    CommonToken COMMA11 = null;
    AnnotationParser.argument_return argument10 = null;

    AnnotationParser.arguments_return arguments12 = null;

    AnnotationCommonTree COMMA11_tree = null;
    RewriteRuleTokenStream stream_COMMA = new RewriteRuleTokenStream(adaptor, "token COMMA");
    RewriteRuleSubtreeStream stream_argument =
        new RewriteRuleSubtreeStream(adaptor, "rule argument");
    RewriteRuleSubtreeStream stream_arguments =
        new RewriteRuleSubtreeStream(adaptor, "rule arguments");
    try {
      // AnnotationParser.g:98:3: ( argument ( COMMA arguments )? -> argument ( arguments )? )
      // AnnotationParser.g:98:5: argument ( COMMA arguments )?
      {
        pushFollow(FOLLOW_argument_in_arguments230);
        argument10 = argument();

        state._fsp--;

        stream_argument.add(argument10.getTree());
        // AnnotationParser.g:98:15: ( COMMA arguments )?
        int alt4 = 2;
        int LA4_0 = input.LA(1);

        if ((LA4_0 == COMMA)) {
          alt4 = 1;
        }
        switch (alt4) {
          case 1:
            // AnnotationParser.g:98:16: COMMA arguments
            {
              COMMA11 = (CommonToken) match(input, COMMA, FOLLOW_COMMA_in_arguments234);
              stream_COMMA.add(COMMA11);

              pushFollow(FOLLOW_arguments_in_arguments236);
              arguments12 = arguments();

              state._fsp--;

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

        // AST REWRITE
        // elements: arguments, 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 = (AnnotationCommonTree) adaptor.nil();
        // 99:5: -> argument ( arguments )?
        {
          adaptor.addChild(root_0, stream_argument.nextTree());
          // AnnotationParser.g:99:17: ( arguments )?
          if (stream_arguments.hasNext()) {
            adaptor.addChild(root_0, stream_arguments.nextTree());
          }
          stream_arguments.reset();
        }

        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;
  }
コード例 #2
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;
  }