请问:以下是我用javacc编译后生成的java文件,我想在jsp中输入一个日期,如果符合我的编译器要求则刷新页面,否则输出错误对话框,请问怎么弄?希望大家做出jsp并把要修改的地方告诉我,谢谢!
package Riqi;
/*编译者:潘霄*/
/*日期:2005-12-19*/
/* Generated By:JavaCC: Do not edit this line. Riqi.java */
import java.lang.*;
public class Riqi implements RiqiConstants {
public static void main(String[] args) throws ParseException,TokenMgrError{
Riqi riqi = new Riqi(System.in);
try{
riqi.start();
}catch(Exception e){
System.out.println("输入错误");
}
}
static final public void start() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case NUMBER:
start1();
break;
case HOOK:
start2();
break;
case LBRACKET:
start3();
break;
case CNUMBER:
start4();
break;
case WHICH:
start5();
break;
default:
jj_la1[0] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
static final public void start1() throws ParseException {
jj_consume_token(NUMBER);
jj_consume_token(NUMBER);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case HOOK:
jj_consume_token(HOOK);
jj_consume_token(HOOK);
break;
case NUMBER:
jj_consume_token(NUMBER);
jj_consume_token(NUMBER);
break;
default:
jj_la1[1] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 0:
jj_consume_token(0);
break;
case MINUS:
jj_consume_token(MINUS);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case NUMBER:
jj_consume_token(NUMBER);
jj_consume_token(NUMBER);
break;
case HOOK:
jj_consume_token(HOOK);
jj_consume_token(HOOK);
break;
default:
jj_la1[2] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 0:
jj_consume_token(0);
break;
case NUMBER:
jj_consume_token(NUMBER);
jj_consume_token(NUMBER);
jj_consume_token(0);
break;
case MINUS:
jj_consume_token(MINUS);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case HOOK:
jj_consume_token(HOOK);
jj_consume_token(HOOK);
break;
case NUMBER:
jj_consume_token(NUMBER);
jj_consume_token(NUMBER);
break;
case LBRACKET:
jj_consume_token(LBRACKET);
jj_consume_token(NUMBER);
jj_consume_token(NUMBER);
jj_consume_token(RBRACKET);
break;
default:
jj_la1[3] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
break;
default:
jj_la1[4] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
break;
default:
jj_la1[5] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
jj_consume_token(0);
}
static final public void start2() throws ParseException {
jj_consume_token(HOOK);
jj_consume_token(HOOK);
jj_consume_token(HOOK);
jj_consume_token(HOOK);
jj_consume_token(MINUS);
jj_consume_token(HOOK);
jj_consume_token(HOOK);
jj_consume_token(MINUS);
jj_consume_token(LBRACKET);
jj_consume_token(NUMBER);
jj_consume_token(NUMBER);
jj_consume_token(RBRACKET);
jj_consume_token(0);
}
static final public void start3() throws ParseException {
jj_consume_token(LBRACKET);
jj_consume_token(NUMBER);
jj_consume_token(NUMBER);
jj_consume_token(NUMBER);
jj_consume_token(NUMBER);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case RBRACKET:
jj_consume_token(RBRACKET);
jj_consume_token(MINUS);
jj_consume_token(LBRACKET);
jj_consume_token(NUMBER);
jj_consume_token(NUMBER);
jj_consume_token(RBRACKET);
jj_consume_token(MINUS);
jj_consume_token(LBRACKET);
jj_consume_token(NUMBER);
jj_consume_token(NUMBER);
jj_consume_token(RBRACKET);
break;
case MINUS:
jj_consume_token(MINUS);
jj_consume_token(NUMBER);
jj_consume_token(NUMBER);
jj_consume_token(NUMBER);
jj_consume_token(NUMBER);
jj_consume_token(RBRACKET);
break;
default:
jj_la1[6] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
jj_consume_token(0);
}
static final public void start4() throws ParseException {
jj_consume_token(CNUMBER);
jj_consume_token(CNUMBER);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case CENTURY:
jj_consume_token(CENTURY);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case CNUMBER:
jj_consume_token(CNUMBER);
jj_consume_token(CNUMBER);
break;
case NUMBER:
jj_consume_token(NUMBER);
jj_consume_token(NUMBER);
break;
default:
jj_la1[7] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
jj_consume_token(AGE);
break;
case CNUMBER:
jj_consume_token(CNUMBER);
jj_consume_token(CNUMBER);
jj_consume_token(YEAR);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case WHICH:
jj_consume_token(WHICH);
jj_consume_token(MONTH);
jj_consume_token(CNUMBER);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case CNUMBER:
jj_consume_token(CNUMBER);
break;
default:
jj_la1[8] = jj_gen;
;
}
jj_consume_token(DAY);
break;
case CNUMBER:
jj_consume_token(CNUMBER);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case CNUMBER:
jj_consume_token(CNUMBER);
break;
default:
jj_la1[9] = jj_gen;
;
}
jj_consume_token(MONTH);
jj_consume_token(CNUMBER);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case CNUMBER:
jj_consume_token(CNUMBER);
break;
default:
jj_la1[10] = jj_gen;
;
}
jj_consume_token(DAY);
break;
default:
jj_la1[11] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
break;
default:
jj_la1[12] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
jj_consume_token(0);
}
static final public void start5() throws ParseException {
jj_consume_token(WHICH);
jj_consume_token(YEAR);
jj_consume_token(CNUMBER);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case CNUMBER:
jj_consume_token(CNUMBER);
break;
default:
jj_la1[13] = jj_gen;
;
}
jj_consume_token(MONTH);
jj_consume_token(CNUMBER);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case CNUMBER:
jj_consume_token(CNUMBER);
break;
default:
jj_la1[14] = jj_gen;
;
}
jj_consume_token(DAY);
}
static private boolean jj_initialized_once = false;
static public RiqiTokenManager token_source;
static SimpleCharStream jj_input_stream;
static public Token token, jj_nt;
static private int jj_ntk;
static private int jj_gen;
static final private int[] jj_la1 = new int[15];
static private int[] jj_la1_0;
static {
jj_la1_0();
}
private static void jj_la1_0() {
jj_la1_0 = new int[] {0x222c0,0x240,0x240,0x2c0,0x441,0x401,0x500,0x2040,0x2000,0x2000,0x2000,0x22000,0x2800,0x2000,0x2000,};
}
public Riqi(java.io.InputStream stream) {
if (jj_initialized_once) {
System.out.println("ERROR: Second call to constructor of static parser. You must");
System.out.println(" either use ReInit() or set the JavaCC option STATIC to false");
System.out.println(" during parser generation.");
throw new Error();
}
jj_initialized_once = true;
jj_input_stream = new SimpleCharStream(stream, 1, 1);
token_source = new RiqiTokenManager(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 15; i++) jj_la1[i] = -1;
}
static public void ReInit(java.io.InputStream stream) {
jj_input_stream.ReInit(stream, 1, 1);
token_source.ReInit(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 15; i++) jj_la1[i] = -1;
}
public Riqi(java.io.Reader stream) {
if (jj_initialized_once) {
System.out.println("ERROR: Second call to constructor of static parser. You must");
System.out.println(" either use ReInit() or set the JavaCC option STATIC to false");
System.out.println(" during parser generation.");
throw new Error();
}
jj_initialized_once = true;
jj_input_stream = new SimpleCharStream(stream, 1, 1);
token_source = new RiqiTokenManager(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 15; i++) jj_la1[i] = -1;
}
static public void ReInit(java.io.Reader stream) {
jj_input_stream.ReInit(stream, 1, 1);
token_source.ReInit(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 15; i++) jj_la1[i] = -1;
}
public Riqi(RiqiTokenManager tm) {
if (jj_initialized_once) {
System.out.println("ERROR: Second call to constructor of static parser. You must");
System.out.println(" either use ReInit() or set the JavaCC option STATIC to false");
System.out.println(" during parser generation.");
throw new Error();
}
jj_initialized_once = true;
token_source = tm;
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 15; i++) jj_la1[i] = -1;
}
public void ReInit(RiqiTokenManager tm) {
token_source = tm;
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 15; i++) jj_la1[i] = -1;
}
static final private Token jj_consume_token(int kind) throws ParseException {
Token oldToken;
if ((oldToken = token).next != null) token = token.next;
else token = token.next = token_source.getNextToken();
jj_ntk = -1;
if (token.kind == kind) {
jj_gen++;
return token;
}
token = oldToken;
jj_kind = kind;
throw generateParseException();
}
static final public Token getNextToken() {
if (token.next != null) token = token.next;
else token = token.next = token_source.getNextToken();
jj_ntk = -1;
jj_gen++;
return token;
}
static final public Token getToken(int index) {
Token t = token;
for (int i = 0; i < index; i++) {
if (t.next != null) t = t.next;
else t = t.next = token_source.getNextToken();
}
return t;
}
static final private int jj_ntk() {
if ((jj_nt=token.next) == null)
return (jj_ntk = (token.next=token_source.getNextToken()).kind);
else
return (jj_ntk = jj_nt.kind);
}
static private java.util.Vector jj_expentries = new java.util.Vector();
static private int[] jj_expentry;
static private int jj_kind = -1;
static public ParseException generateParseException() {
jj_expentries.removeAllElements();
boolean[] la1tokens = new boolean[19];
for (int i = 0; i < 19; i++) {
la1tokens[i] = false;
}
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 15; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
if ((jj_la1_0[i] & (1<<j)) != 0) {
la1tokens[j] = true;
}
}
}
}
for (int i = 0; i < 19; i++) {
if (la1tokens[i]) {
jj_expentry = new int[1];
jj_expentry[0] = i;
jj_expentries.addElement(jj_expentry);
}
}
int[][] exptokseq = new int[jj_expentries.size()][];
for (int i = 0; i < jj_expentries.size(); i++) {
exptokseq[i] = (int[])jj_expentries.elementAt(i);
}
return new ParseException(token, exptokseq, tokenImage);
}
static final public void enable_tracing() {
}
static final public void disable_tracing() {
}
}