예제 #1
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;
  }
예제 #2
0
  // $ANTLR start "vmOptions"
  // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:251:1: vmOptions : ( ( WS )? option )* ( WS )? -> ( option )* ;
  public final CommandLineParser.vmOptions_return vmOptions() throws RecognitionException {
    CommandLineParser.vmOptions_return retval = new CommandLineParser.vmOptions_return();
    retval.start = input.LT(1);

    CommonTree root_0 = null;

    Token WS1 = null;
    Token WS3 = null;
    CommandLineParser.option_return option2 = null;

    CommonTree WS1_tree = null;
    CommonTree WS3_tree = null;
    RewriteRuleTokenStream stream_WS = new RewriteRuleTokenStream(adaptor, "token WS");
    RewriteRuleSubtreeStream stream_option = new RewriteRuleSubtreeStream(adaptor, "rule option");
    try {
      // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:252:2: ( ( ( WS )? option )* ( WS )? -> ( option )* )
      // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:252:4: ( ( WS )? option )* ( WS )?
      {
        // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:252:4: ( ( WS )? option )*
        loop2:
        do {
          int alt2 = 2;
          int LA2_0 = input.LA(1);

          if ((LA2_0 == WS)) {
            int LA2_1 = input.LA(2);

            if ((LA2_1 == TEXT || LA2_1 == 7)) {
              alt2 = 1;
            }

          } else if ((LA2_0 == TEXT || LA2_0 == 7)) {
            alt2 = 1;
          }

          switch (alt2) {
            case 1:
              // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:252:5: ( WS )? option
              {
                // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:252:5: ( WS )?
                int alt1 = 2;
                int LA1_0 = input.LA(1);

                if ((LA1_0 == WS)) {
                  alt1 = 1;
                }
                switch (alt1) {
                  case 1:
                    // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:252:5: WS
                    {
                      WS1 = (Token) match(input, WS, FOLLOW_WS_in_vmOptions75);
                      stream_WS.add(WS1);
                    }
                    break;
                }

                pushFollow(FOLLOW_option_in_vmOptions77);
                option2 = option();

                state._fsp--;

                stream_option.add(option2.getTree());
              }
              break;

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

        // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:252:16: ( WS )?
        int alt3 = 2;
        int LA3_0 = input.LA(1);

        if ((LA3_0 == WS)) {
          alt3 = 1;
        }
        switch (alt3) {
          case 1:
            // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:252:16: WS
            {
              WS3 = (Token) match(input, WS, FOLLOW_WS_in_vmOptions80);
              stream_WS.add(WS3);
            }
            break;
        }

        // AST REWRITE
        // elements: option
        // 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();
        // 252:20: -> ( option )*
        {
          // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:252:23: ( option )*
          while (stream_option.hasNext()) {
            adaptor.addChild(root_0, stream_option.nextTree());
          }
          stream_option.reset();
        }

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