⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 commandparser.java

📁 一个对等计算发生器
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* Generated By:JavaCC: Do not edit this line. CommandParser.java */
package de.uniba.wiai.lspi.util.console.parser;

import java.io.*;

/**
 * @author   sven
 * @version 1.0.1
 */
public class CommandParser implements CommandParserConstants {


        public static String parse(String toParse) throws ParseException{
            StringReader reader = new StringReader(toParse);
            CommandParser parser = new CommandParser(reader);
            String command = parser.command();
            return command;
        }

        public static java.util.Map<String, String> parseParams(String toParse) throws ParseException{
                StringReader reader = new StringReader(toParse);
                CommandParser parser = new CommandParser(reader);
                return parser.parameters();
        }

  final public String command() throws ParseException {
        String commandName = "";
        Token token;
    if (jj_2_4(3)) {
      token = jj_consume_token(WORD);
      label_1:
      while (true) {
        if (jj_2_1(3)) {
          jj_consume_token(PARAMSTART);
          jj_consume_token(WORD);
          jj_consume_token(WORD);
        } else if (jj_2_2(3)) {
          jj_consume_token(PARAMSTART);
          jj_consume_token(WORD);
        } else {
          jj_consume_token(-1);
          throw new ParseException();
        }
        if (jj_2_3(3)) {
          ;
        } else {
          break label_1;
        }
      }
                commandName = token.image;
                {if (true) return commandName;}
    } else if (jj_2_5(3)) {
      token = jj_consume_token(WORD);
                commandName = token.image;
                {if (true) return commandName;}
    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

  final public java.util.Map<String, String> parameters() throws ParseException {
        java.util.Map<String, String> p = new java.util.HashMap<String, String>();
        int index = 0;
        String ps[][] = new String[100][2];
        Token t;
    if (jj_2_9(3)) {
      t = jj_consume_token(WORD);
      label_2:
      while (true) {
        if (jj_2_6(3)) {
          jj_consume_token(PARAMSTART);
          t = jj_consume_token(WORD);
                  ps[index][0]=t.image;
          t = jj_consume_token(WORD);
                  ps[index++][1]=t.image;
        } else if (jj_2_7(3)) {
          jj_consume_token(PARAMSTART);
          t = jj_consume_token(WORD);
                 ps[index++][0]=t.image;
        } else {
          jj_consume_token(-1);
          throw new ParseException();
        }
        if (jj_2_8(3)) {
          ;
        } else {
          break label_2;
        }
      }
                 for (int i = 0; i < index; i++){
                        String pn = ps[i][0];
                        String pv = "";
                        if (ps[i][1] != null){
                                pv = ps[i][1];
                        }
                        p.put(pn, pv);
                }
                {if (true) return p;}
    } else if (jj_2_10(3)) {
      t = jj_consume_token(WORD);
                 {if (true) return p;}
    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

  final private boolean jj_2_1(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_1(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(0, xla); }
  }

  final private boolean jj_2_2(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_2(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(1, xla); }
  }

  final private boolean jj_2_3(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_3(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(2, xla); }
  }

  final private boolean jj_2_4(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_4(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(3, xla); }
  }

  final private boolean jj_2_5(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_5(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(4, xla); }
  }

  final private boolean jj_2_6(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_6(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(5, xla); }
  }

  final private boolean jj_2_7(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_7(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(6, xla); }
  }

  final private boolean jj_2_8(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_8(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(7, xla); }
  }

  final private boolean jj_2_9(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_9(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(8, xla); }
  }

  final private boolean jj_2_10(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_10(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(9, xla); }
  }

  final private boolean jj_3_7() {
    if (jj_scan_token(PARAMSTART)) return true;
    if (jj_scan_token(WORD)) return true;
    return false;
  }

  final private boolean jj_3_5() {
    if (jj_scan_token(WORD)) return true;
    return false;
  }

  final private boolean jj_3_4() {
    if (jj_scan_token(WORD)) return true;
    Token xsp;
    if (jj_3_3()) return true;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3_3()) { jj_scanpos = xsp; break; }
    }
    return false;
  }

  final private boolean jj_3_6() {
    if (jj_scan_token(PARAMSTART)) return true;
    if (jj_scan_token(WORD)) return true;
    if (jj_scan_token(WORD)) return true;
    return false;
  }

  final private boolean jj_3_8() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_6()) {
    jj_scanpos = xsp;
    if (jj_3_7()) return true;
    }
    return false;
  }

  final private boolean jj_3_2() {
    if (jj_scan_token(PARAMSTART)) return true;
    if (jj_scan_token(WORD)) return true;
    return false;
  }

  final private boolean jj_3_10() {
    if (jj_scan_token(WORD)) return true;
    return false;
  }

  final private boolean jj_3_9() {
    if (jj_scan_token(WORD)) return true;
    Token xsp;
    if (jj_3_8()) return true;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3_8()) { jj_scanpos = xsp; break; }
    }
    return false;
  }

  final private boolean jj_3_1() {
    if (jj_scan_token(PARAMSTART)) return true;
    if (jj_scan_token(WORD)) return true;
    if (jj_scan_token(WORD)) return true;
    return false;
  }

  final private boolean jj_3_3() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_1()) {
    jj_scanpos = xsp;
    if (jj_3_2()) return true;
    }
    return false;
  }

  public CommandParserTokenManager token_source;
  SimpleCharStream jj_input_stream;
  public Token token;
  public Token jj_nt;
  private int jj_ntk;
  private Token jj_scanpos;
  private Token jj_lastpos;
  private int jj_la;
  public boolean lookingAhead = false;
  private boolean jj_semLA;
  private int jj_gen;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -