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

    CommonTree root_0 = null;

    Token t = null;
    Token char_literal7 = null;
    Token WS9 = null;
    CommandLineParser.eText_return eText8 = null;

    CommandLineParser.eText_return eText10 = null;

    CommonTree t_tree = null;
    CommonTree char_literal7_tree = null;
    CommonTree WS9_tree = null;
    RewriteRuleTokenStream stream_WS = new RewriteRuleTokenStream(adaptor, "token WS");
    RewriteRuleTokenStream stream_TEXT = new RewriteRuleTokenStream(adaptor, "token TEXT");
    RewriteRuleTokenStream stream_8 = new RewriteRuleTokenStream(adaptor, "token 8");
    RewriteRuleSubtreeStream stream_eText = new RewriteRuleSubtreeStream(adaptor, "rule eText");

    int index = 0;
    String name = null;
    String value = null;

    try {
      // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:263:2: ({...}? =>t= TEXT -> | {...}? =>t= TEXT -> | {...}? =>t= TEXT -> | {...}? =>t= TEXT -> | {...}? =>t= TEXT -> | {...}? =>t= TEXT '=' eText -> | {...}? =>t= TEXT -> | {...}? =>t= TEXT -> | {...}? =>t= TEXT WS eText -> | t= TEXT ->)
      int alt5 = 10;
      alt5 = dfa5.predict(input);
      switch (alt5) {
        case 1:
          // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:263:4: {...}? =>t= TEXT
          {
            if (!((switchOptions.contains(input.LT(1).getText())))) {
              throw new FailedPredicateException(
                  input, "switchOption", "switchOptions.contains(input.LT(1).getText())");
            }
            t = (Token) match(input, TEXT, FOLLOW_TEXT_in_switchOption135);
            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();
            // 263:78: ->
            {
              adaptor.addChild(root_0, new SwitchNode(t));
            }

            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:264:3: {...}? =>t= TEXT
          {
            if (!((VERBOSE.equals(input.LT(1).getText())
                || input.LT(1).getText().startsWith(VERBOSE + ':')))) {
              throw new FailedPredicateException(
                  input,
                  "switchOption",
                  "VERBOSE.equals(input.LT(1).getText()) || input.LT(1).getText().startsWith(VERBOSE+':')");
            }
            t = (Token) match(input, TEXT, FOLLOW_TEXT_in_switchOption166);
            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();
            // 264:107: ->
            {
              adaptor.addChild(root_0, new SwitchNode(t));
            }

            retval.tree = root_0;
          }
          break;
        case 3:
          // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:265:3: {...}? =>t= TEXT
          {
            if (!((VERSION.equals(input.LT(1).getText())
                || input.LT(1).getText().startsWith(VERSION + ':')))) {
              throw new FailedPredicateException(
                  input,
                  "switchOption",
                  "VERSION.equals(input.LT(1).getText()) || input.LT(1).getText().startsWith(VERSION+':')");
            }
            t = (Token) match(input, TEXT, FOLLOW_TEXT_in_switchOption186);
            stream_TEXT.add(t);

            index = t.getText().indexOf(':');
            if (index > 0) {
              name = t.getText().substring(0, index);
              value = (index + 1) == t.getText().length() ? "" : t.getText().substring(index + 1);
            } else {
              name = t.getText();
            }

            // 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();
            // 265:304: ->
            {
              adaptor.addChild(
                  root_0,
                  index < 0 ? new SwitchNode(t) : new ParametrizedNode(t, name, ":", value));
            }

            retval.tree = root_0;
          }
          break;
        case 4:
          // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:266:3: {...}? =>t= TEXT
          {
            if (!((input.LT(1).getText().startsWith(XSHARE + ':')))) {
              throw new FailedPredicateException(
                  input, "switchOption", "input.LT(1).getText().startsWith(XSHARE+':')");
            }
            t = (Token) match(input, TEXT, FOLLOW_TEXT_in_switchOption203);
            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();
            // 266:60: ->
            {
              adaptor.addChild(root_0, new SwitchNode(t));
            }

            retval.tree = root_0;
          }
          break;
        case 5:
          // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:267:3: {...}? =>t= TEXT
          {
            if (!((input.LT(1).getText().startsWith(XCJNI + ':')))) {
              throw new FailedPredicateException(
                  input, "switchOption", "input.LT(1).getText().startsWith(XCJNI+':')");
            }
            t = (Token) match(input, TEXT, FOLLOW_TEXT_in_switchOption218);
            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();
            // 267:61: ->
            {
              adaptor.addChild(root_0, new SwitchNode(t));
            }

            retval.tree = root_0;
          }
          break;
        case 6:
          // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:268:3: {...}? =>t= TEXT '=' eText
          {
            if (!((input.LT(1).getText().charAt(0) == 'D'))) {
              throw new FailedPredicateException(
                  input, "switchOption", "input.LT(1).getText().charAt(0) == 'D'");
            }
            t = (Token) match(input, TEXT, FOLLOW_TEXT_in_switchOption235);
            stream_TEXT.add(t);

            char_literal7 = (Token) match(input, 8, FOLLOW_8_in_switchOption237);
            stream_8.add(char_literal7);

            pushFollow(FOLLOW_eText_in_switchOption239);
            eText8 = eText();

            state._fsp--;

            stream_eText.add(eText8.getTree());

            // 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();
            // 268:67: ->
            {
              adaptor.addChild(
                  root_0,
                  new UserPropertyNode(
                      t,
                      (eText8 != null ? input.toString(eText8.start, eText8.stop) : null),
                      (t != null ? t.getCharPositionInLine() : 0)));
            }

            retval.tree = root_0;
          }
          break;
        case 7:
          // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:269:3: {...}? =>t= TEXT
          {
            if (!((isParamOption(input.LT(1).getText())))) {
              throw new FailedPredicateException(
                  input, "switchOption", "isParamOption(input.LT(1).getText())");
            }
            t = (Token) match(input, TEXT, FOLLOW_TEXT_in_switchOption257);
            stream_TEXT.add(t);

            index = t.getText().indexOf(':');
            if (index > 0) {
              name = t.getText().substring(0, index);
              value = (index + 1) == t.getText().length() ? "" : t.getText().substring(index + 1);
            }

            // 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();
            // 269:227: ->
            {
              adaptor.addChild(root_0, new ParametrizedNode(t, name, ":", value));
            }

            retval.tree = root_0;
          }
          break;
        case 8:
          // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:270:3: {...}? =>t= TEXT
          {
            if (!((memOptions.matcher(input.LT(1).getText()).matches()))) {
              throw new FailedPredicateException(
                  input, "switchOption", "memOptions.matcher(input.LT(1).getText()).matches()");
            }
            t = (Token) match(input, TEXT, FOLLOW_TEXT_in_switchOption274);
            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();
            // 270:69: ->
            {
              adaptor.addChild(root_0, new ParametrizedNode(t, 3));
            }

            retval.tree = root_0;
          }
          break;
        case 9:
          // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:271:3: {...}? =>t= TEXT WS eText
          {
            if (!((CLASSPATH.equals(input.LT(1).getText())
                || CLASSPATH_LONG.equals(input.LT(1).getText())))) {
              throw new FailedPredicateException(
                  input,
                  "switchOption",
                  "CLASSPATH.equals(input.LT(1).getText()) || CLASSPATH_LONG.equals(input.LT(1).getText())");
            }
            t = (Token) match(input, TEXT, FOLLOW_TEXT_in_switchOption291);
            stream_TEXT.add(t);

            WS9 = (Token) match(input, WS, FOLLOW_WS_in_switchOption293);
            stream_WS.add(WS9);

            pushFollow(FOLLOW_eText_in_switchOption295);
            eText10 = eText();

            state._fsp--;

            stream_eText.add(eText10.getTree());

            // 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();
            // 271:112: ->
            {
              adaptor.addChild(
                  root_0,
                  new ParametrizedNode(
                      t,
                      " ",
                      (eText10 != null ? input.toString(eText10.start, eText10.stop) : null),
                      false));
            }

            retval.tree = root_0;
          }
          break;
        case 10:
          // /Users/tom/Projects/netbeans/jet-main/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/vmo/gen/CommandLine.g:272:3: t= TEXT
          {
            t = (Token) match(input, TEXT, FOLLOW_TEXT_in_switchOption307);
            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();
            // 272:10: ->
            {
              adaptor.addChild(root_0, new UnrecognizedOption(t));
            }

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