Пример #1
0
  // $ANTLR start "nonSwitchOption"
  // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:279:1: nonSwitchOption : t= TEXT ->;
  public final CommandLineParser.nonSwitchOption_return nonSwitchOption()
      throws RecognitionException {
    CommandLineParser.nonSwitchOption_return retval =
        new CommandLineParser.nonSwitchOption_return();
    retval.start = input.LT(1);

    CommonTree root_0 = null;

    Token t = null;

    CommonTree t_tree = null;
    RewriteRuleTokenStream stream_TEXT = new RewriteRuleTokenStream(adaptor, "token TEXT");

    try {
      // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:280:2: (t= TEXT ->)
      // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:280:4: t= TEXT
      {
        t = (Token) match(input, TEXT, FOLLOW_TEXT_in_nonSwitchOption359);
        stream_TEXT.add(t);

        // AST REWRITE
        // elements:
        // 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 = (CommonTree) adaptor.nil();
        // 280:11: ->
        {
          adaptor.addChild(root_0, new UnknownOption(t));
        }

        retval.tree = root_0;
      }

      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;
  }
Пример #2
0
  // $ANTLR start "option"
  // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:254:1: option : ( '-' switchOption -> switchOption | nonSwitchOption -> nonSwitchOption );
  public final CommandLineParser.option_return option() throws RecognitionException {
    CommandLineParser.option_return retval = new CommandLineParser.option_return();
    retval.start = input.LT(1);

    CommonTree root_0 = null;

    Token char_literal4 = null;
    CommandLineParser.switchOption_return switchOption5 = null;

    CommandLineParser.nonSwitchOption_return nonSwitchOption6 = null;

    CommonTree char_literal4_tree = null;
    RewriteRuleTokenStream stream_7 = new RewriteRuleTokenStream(adaptor, "token 7");
    RewriteRuleSubtreeStream stream_switchOption =
        new RewriteRuleSubtreeStream(adaptor, "rule switchOption");
    RewriteRuleSubtreeStream stream_nonSwitchOption =
        new RewriteRuleSubtreeStream(adaptor, "rule nonSwitchOption");
    try {
      // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:254:8: ( '-' switchOption -> switchOption | nonSwitchOption -> nonSwitchOption )
      int alt4 = 2;
      int LA4_0 = input.LA(1);

      if ((LA4_0 == 7)) {
        alt4 = 1;
      } else if ((LA4_0 == TEXT)) {
        alt4 = 2;
      } else {
        NoViableAltException nvae = new NoViableAltException("", 4, 0, input);

        throw nvae;
      }
      switch (alt4) {
        case 1:
          // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:254:10: '-' switchOption
          {
            char_literal4 = (Token) match(input, 7, FOLLOW_7_in_option95);
            stream_7.add(char_literal4);

            pushFollow(FOLLOW_switchOption_in_option97);
            switchOption5 = switchOption();

            state._fsp--;

            stream_switchOption.add(switchOption5.getTree());

            // AST REWRITE
            // elements: switchOption
            // 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 = (CommonTree) adaptor.nil();
            // 254:27: -> switchOption
            {
              adaptor.addChild(root_0, stream_switchOption.nextTree());
            }

            retval.tree = root_0;
          }
          break;
        case 2:
          // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:255:3: nonSwitchOption
          {
            pushFollow(FOLLOW_nonSwitchOption_in_option107);
            nonSwitchOption6 = nonSwitchOption();

            state._fsp--;

            stream_nonSwitchOption.add(nonSwitchOption6.getTree());

            // AST REWRITE
            // elements: nonSwitchOption
            // 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 = (CommonTree) adaptor.nil();
            // 255:20: -> nonSwitchOption
            {
              adaptor.addChild(root_0, stream_nonSwitchOption.nextTree());
            }

            retval.tree = root_0;
          }
          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;
  }