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

📄 mtgrammar.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* Generated By:JavaCC: Do not edit this line. mtGrammar.java */package org.apache.derby.impl.tools.ij;import java.util.Hashtable;import java.util.Vector;import java.io.IOException;import org.apache.derby.iapi.tools.i18n.*;public class mtGrammar implements mtGrammarConstants {        private LocalizedOutput currOut;        private LocalizedInput currIn;        mtGrammar() { }//// start of BNF rules//  final public mtTestSuite grammarStatement() throws ParseException {        Vector cases = null;        Vector init = null;        Vector last = null;        int     threads = 0;        mtTime time;    threads = numThreads();    time = runTime();    switch (jj_nt.kind) {    case INIT:      init = init();      break;    default:      jj_la1[0] = jj_gen;      ;    }    cases = cases();    switch (jj_nt.kind) {    case LAST:      last = last();      break;    default:      jj_la1[1] = jj_gen;      ;    }    jj_consume_token(0);                {if (true) return new mtTestSuite(threads, time, init, cases, last);}    throw new Error("Missing return statement in function");  }  final public int numThreads() throws ParseException {        Token   t;    jj_consume_token(THREADS);    t = jj_consume_token(INT);                int val = Integer.decode(t.image).intValue();                {if (true) return val;}    throw new Error("Missing return statement in function");  }  final public mtTime runTime() throws ParseException {        mtTime time;    jj_consume_token(RUNTIME);    time = time();                {if (true) return time;}    throw new Error("Missing return statement in function");  }  final public Vector cases() throws ParseException {        Vector testCases = new Vector(5);    label_1:    while (true) {      testCase(testCases);      switch (jj_nt.kind) {      case CASE:        ;        break;      default:        jj_la1[2] = jj_gen;        break label_1;      }    }                {if (true) return testCases;}    throw new Error("Missing return statement in function");  }  final public void testCase(Vector testCases) throws ParseException {        Token   t;        mtTestCase testCase = new mtTestCase();    jj_consume_token(CASE);    t = jj_consume_token(WORD);    caseInfo(testCase);                testCase.setName(t.image);                testCases.addElement(testCase);  }  final public Vector init() throws ParseException {        Vector testCases = new Vector(5);    label_2:    while (true) {      initCase(testCases);      switch (jj_nt.kind) {      case INIT:        ;        break;      default:        jj_la1[3] = jj_gen;        break label_2;      }    }                {if (true) return testCases;}    throw new Error("Missing return statement in function");  }  final public void initCase(Vector testCases) throws ParseException {        Token   t;        mtTestCase testCase = new mtTestCase();    jj_consume_token(INIT);    t = jj_consume_token(WORD);    caseInfo(testCase);                testCase.setName(t.image);                testCases.addElement(testCase);  }  final public Vector last() throws ParseException {        Vector testCases = new Vector(1);    label_3:    while (true) {      lastCase(testCases);      switch (jj_nt.kind) {      case LAST:        ;        break;      default:        jj_la1[4] = jj_gen;        break label_3;      }    }                {if (true) return testCases;}    throw new Error("Missing return statement in function");  }  final public void lastCase(Vector testCases) throws ParseException {        Token   t;        mtTestCase testCase = new mtTestCase();    jj_consume_token(LAST);    t = jj_consume_token(WORD);    caseInfo(testCase);                testCase.setName(t.image);                testCases.addElement(testCase);  }  final public void caseInfo(mtTestCase testCase) throws ParseException {        String  file;        String  prop = null;        int     weight = 50;        Hashtable errorList = null;        String  description = null;    file = scriptFile();                testCase.setFile(file);    switch (jj_nt.kind) {    case PROPERTIES:      prop = propFile();      break;    default:      jj_la1[5] = jj_gen;      ;    }                testCase.setPropFile(prop);    switch (jj_nt.kind) {    case WEIGHT:      weight = weight();      break;    default:      jj_la1[6] = jj_gen;      ;    }                testCase.setWeight(weight);    switch (jj_nt.kind) {    case IGNOREERRORS:      errorList = ignoreErrors();      break;    default:      jj_la1[7] = jj_gen;      ;    }                if (errorList == null)                        errorList = new Hashtable();                testCase.setIgnoreErrors(errorList);    switch (jj_nt.kind) {    case DESCRIPTION:      description = description();      break;    default:      jj_la1[8] = jj_gen;      ;    }                testCase.setDescription(description);  }  final public String scriptFile() throws ParseException {        Token   t;    jj_consume_token(FILE);    t = jj_consume_token(WORD);                {if (true) return t.image;}    throw new Error("Missing return statement in function");  }  final public String propFile() throws ParseException {        Token   t;    jj_consume_token(PROPERTIES);    t = jj_consume_token(WORD);                {if (true) return t.image;}    throw new Error("Missing return statement in function");  }  final public int weight() throws ParseException {        Token   t;    jj_consume_token(WEIGHT);    t = jj_consume_token(INT);                int val = Integer.decode(t.image).intValue();                if (val > 100 || val < 1)                {                        System.out.println("LINE "+t.beginLine +": Weight '"+t.image                                                        +"' is invalid, must be between 1..100"                                                        +" -- defaulting to 50.");                        val = 50;                }                {if (true) return val;}    throw new Error("Missing return statement in function");  }  final public String description() throws ParseException {        Token   t;    jj_consume_token(DESCRIPTION);    t = jj_consume_token(STRING);                {if (true) return t.image;}    throw new Error("Missing return statement in function");  }  final public Hashtable ignoreErrors() throws ParseException {        // note: we need a non-null errorlist even        // if there is nothing in it        Hashtable errorList = new Hashtable();    jj_consume_token(IGNOREERRORS);    getError(errorList);    label_4:    while (true) {      switch (jj_nt.kind) {      case COMMA:        ;        break;      default:        jj_la1[9] = jj_gen;        break label_4;      }      jj_consume_token(COMMA);      getError(errorList);    }                {if (true) return errorList;}    throw new Error("Missing return statement in function");  }  final public void getError(Hashtable errorList) throws ParseException {        String  s;    s = word_or_int();                if (errorList == null)                {                }                errorList.put(s, new Integer(0));  }  final public String word_or_int() throws ParseException {        Token   t;    switch (jj_nt.kind) {    case WORD:      t = jj_consume_token(WORD);                {if (true) return t.image;}      break;    case INT:      t = jj_consume_token(INT);                {if (true) return t.image;}      break;    default:      jj_la1[10] = jj_gen;      jj_consume_token(-1);      throw new ParseException();    }    throw new Error("Missing return statement in function");  }/*** Possible formats:**** 	HH:MM:SS** 	   MM:SS** 	      SS*/  final public mtTime time() throws ParseException {        Token h, m, s;    if (jj_2_1(4)) {      h = jj_consume_token(INT);      jj_consume_token(COLON);      m = jj_consume_token(INT);      jj_consume_token(COLON);      s = jj_consume_token(INT);                {if (true) return new mtTime(                                Integer.decode(h.image).intValue(),                                Integer.decode(m.image).intValue(),                                Integer.decode(s.image).intValue());}    } else if (jj_2_2(2)) {

⌨️ 快捷键说明

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