/* Generated By:JavaCC: Do not edit this line. ErrorParser.java */
package dods.dap.parser;
import dods.dap.*;
public class ErrorParser implements ErrorParserConstants {
private DODSException exception;
final public void ErrorObject(DODSException exception) throws ParseException {
this.exception = exception;
jj_consume_token(ERROR);
jj_consume_token(16);
Contents();
jj_consume_token(17);
jj_consume_token(18);
}
final public void Contents() throws ParseException {
Description();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case PTYPE:
Program();
break;
default:
jj_la1[0] = jj_gen;
;
}
}
final public void Description() throws ParseException {
Code();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case MSG:
Message();
break;
default:
jj_la1[1] = jj_gen;
;
}
}
final public void Program() throws ParseException {
ProgramType();
ProgramCode();
}
final public void Code() throws ParseException {
Token t;
jj_consume_token(CODE);
jj_consume_token(19);
t = jj_consume_token(INT);
jj_consume_token(18);
try {
exception.setErrorCode(Integer.parseInt(t.image));
}
catch (NumberFormatException e) {
exception.setErrorCode(-1); /* Error setting error code */
}
}
final public void Message() throws ParseException {
Token t;
jj_consume_token(MSG);
jj_consume_token(19);
t = jj_consume_token(STR);
jj_consume_token(18);
exception.setErrorMessage(t.image);
}
final public void ProgramType() throws ParseException {
Token t;
jj_consume_token(PTYPE);
jj_consume_token(19);
t = jj_consume_token(INT);
jj_consume_token(18);
try {
exception.setProgramType(Integer.parseInt(t.image));
}
catch (NumberFormatException e) {
exception.setProgramType(-1); /* Error setting program type */
}
}
final public void ProgramCode() throws ParseException {
Token t;
jj_consume_token(PROGRAM);
jj_consume_token(19);
t = jj_consume_token(STR);
jj_consume_token(18);
exception.setProgramSource(t.image);
}
public ErrorParserTokenManager token_source;
SimpleCharStream jj_input_stream;
public Token token, jj_nt;
private int jj_ntk;
private int jj_gen;
final private int[] jj_la1 = new int[2];
final private int[] jj_la1_0 = {0x200,0x100,};
public ErrorParser(java.io.InputStream stream) {
jj_input_stream = new SimpleCharStream(stream, 1, 1);
token_source = new ErrorParserTokenManager(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 2; i++) jj_la1[i] = -1;
}
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 < 2; i++) jj_la1[i] = -1;
}
public ErrorParser(java.io.Reader stream) {
jj_input_stream = new SimpleCharStream(stream, 1, 1);
token_source = new ErrorParserTokenManager(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 2; i++) jj_la1[i] = -1;
}
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 < 2; i++) jj_la1[i] = -1;
}
public ErrorParser(ErrorParserTokenManager tm) {
token_source = tm;
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 2; i++) jj_la1[i] = -1;
}
public void ReInit(ErrorParserTokenManager tm) {
token_source = tm;
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 2; i++) jj_la1[i] = -1;
}
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();
}
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;
}
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;
}
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);
}
private java.util.Vector jj_expentries = new java.util.Vector();
private int[] jj_expentry;
private int jj_kind = -1;
final public ParseException generateParseException() {
jj_expentries.removeAllElements();
boolean[] la1tokens = new boolean[20];
for (int i = 0; i < 20; i++) {
la1tokens[i] = false;
}
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 2; 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 < 20; 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);
}
final public void enable_tracing() {
}
final public void disable_tracing() {
}
}