TestLogParser.java
/* Generated By:JavaCC: Do not edit this line. TestLogParser.java */
package net.metanotion.sqltest.parser;
import net.metanotion.sqltest.parser.syntaxtree.*;
import java.util.Vector;
public class TestLogParser implements TestLogParserConstants {
final public Expressions Expressions() throws ParseException {
NodeListOptional n0 = new NodeListOptional();
TestStatement n1;
label_1:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LET:
case EXECUTE:
case IMPORT:
case CHECK:
;
break;
default:
jj_la1[0] = jj_gen;
break label_1;
}
n1 = TestStatement();
n0.addNode(n1);
}
n0.nodes.trimToSize();
{if (true) return new Expressions(n0);}
throw new Error("Missing return statement in function");
}
final public TestStatement TestStatement() throws ParseException {
NodeChoice n0;
SideEffect n1;
TestExpression n2;
Capture n3;
Imports n4;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case EXECUTE:
n1 = SideEffect();
n0 = new NodeChoice(n1, 0);
break;
case CHECK:
n2 = TestExpression();
n0 = new NodeChoice(n2, 1);
break;
case LET:
n3 = Capture();
n0 = new NodeChoice(n3, 2);
break;
case IMPORT:
n4 = Imports();
n0 = new NodeChoice(n4, 3);
break;
default:
jj_la1[1] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return new TestStatement(n0);}
throw new Error("Missing return statement in function");
}
final public Executable Executable() throws ParseException {
NodeChoice n0;
Apply n1;
NodeToken n2;
Token n3;
NodeToken n4;
Token n5;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ID:
n1 = Apply();
n0 = new NodeChoice(n1, 0);
break;
case STRING_LITERAL:
n3 = jj_consume_token(STRING_LITERAL);
n2 = JTBToolkit.makeNodeToken(n3);
n0 = new NodeChoice(n2, 1);
break;
case SQSTRING_LITERAL:
n5 = jj_consume_token(SQSTRING_LITERAL);
n4 = JTBToolkit.makeNodeToken(n5);
n0 = new NodeChoice(n4, 2);
break;
default:
jj_la1[2] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return new Executable(n0);}
throw new Error("Missing return statement in function");
}
final public SideEffect SideEffect() throws ParseException {
NodeToken n0;
Token n1;
Executable n2;
NodeToken n3;
Token n4;
n1 = jj_consume_token(EXECUTE);
n0 = JTBToolkit.makeNodeToken(n1);
n2 = Executable();
n4 = jj_consume_token(OP_SEMI);
n3 = JTBToolkit.makeNodeToken(n4);
{if (true) return new SideEffect(n0,n2,n3);}
throw new Error("Missing return statement in function");
}
final public Capture Capture() throws ParseException {
NodeToken n0;
Token n1;
NodeToken n2;
Token n3;
NodeToken n4;
Token n5;
Executable n6;
NodeToken n7;
Token n8;
n1 = jj_consume_token(LET);
n0 = JTBToolkit.makeNodeToken(n1);
n3 = jj_consume_token(ID);
n2 = JTBToolkit.makeNodeToken(n3);
n5 = jj_consume_token(OP_EQ);
n4 = JTBToolkit.makeNodeToken(n5);
n6 = Executable();
n8 = jj_consume_token(OP_SEMI);
n7 = JTBToolkit.makeNodeToken(n8);
{if (true) return new Capture(n0,n2,n4,n6,n7);}
throw new Error("Missing return statement in function");
}
final public TestExpression TestExpression() throws ParseException {
NodeToken n0;
Token n1;
Executable n2;
NodeToken n3;
Token n4;
ValueExpr n5;
NodeToken n6;
Token n7;
n1 = jj_consume_token(CHECK);
n0 = JTBToolkit.makeNodeToken(n1);
n2 = Executable();
n4 = jj_consume_token(OP_EQ);
n3 = JTBToolkit.makeNodeToken(n4);
n5 = ValueExpr();
n7 = jj_consume_token(OP_SEMI);
n6 = JTBToolkit.makeNodeToken(n7);
{if (true) return new TestExpression(n0,n2,n3,n5,n6);}
throw new Error("Missing return statement in function");
}
final public Imports Imports() throws ParseException {
NodeToken n0;
Token n1;
NodeToken n2;
Token n3;
NodeListOptional n4 = new NodeListOptional();
NodeSequence n5;
NodeToken n6;
Token n7;
NodeToken n8;
Token n9;
NodeOptional n10 = new NodeOptional();
NodeSequence n11;
NodeToken n12;
Token n13;
NodeToken n14;
Token n15;
NodeToken n16;
Token n17;
n1 = jj_consume_token(IMPORT);
n0 = JTBToolkit.makeNodeToken(n1);
n3 = jj_consume_token(ID);
n2 = JTBToolkit.makeNodeToken(n3);
label_2:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case OP_DOT:
;
break;
default:
jj_la1[3] = jj_gen;
break label_2;
}
n5 = new NodeSequence(2);
n7 = jj_consume_token(OP_DOT);
n6 = JTBToolkit.makeNodeToken(n7);
n5.addNode(n6);
n9 = jj_consume_token(ID);
n8 = JTBToolkit.makeNodeToken(n9);
n5.addNode(n8);
n4.addNode(n5);
}
n4.nodes.trimToSize();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case AS:
n11 = new NodeSequence(2);
n13 = jj_consume_token(AS);
n12 = JTBToolkit.makeNodeToken(n13);
n11.addNode(n12);
n15 = jj_consume_token(ID);
n14 = JTBToolkit.makeNodeToken(n15);
n11.addNode(n14);
n10.addNode(n11);
break;
default:
jj_la1[4] = jj_gen;
;
}
n17 = jj_consume_token(OP_SEMI);
n16 = JTBToolkit.makeNodeToken(n17);
{if (true) return new Imports(n0,n2,n4,n10,n16);}
throw new Error("Missing return statement in function");
}
final public SimpleValue SimpleValue() throws ParseException {
NodeChoice n0;
Literal n1;
NodeToken n2;
Token n3;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ERROR_LITERAL:
case ANY_LITERAL:
case BOOLEAN_LITERAL:
case NULL_LITERAL:
case DECIMAL_LITERAL:
case FLOAT_LITERAL:
case STRING_LITERAL:
case SQSTRING_LITERAL:
n1 = Literal();
n0 = new NodeChoice(n1, 0);
break;
case ID:
n3 = jj_consume_token(ID);
n2 = JTBToolkit.makeNodeToken(n3);
n0 = new NodeChoice(n2, 1);
break;
default:
jj_la1[5] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return new SimpleValue(n0);}
throw new Error("Missing return statement in function");
}
final public Apply Apply() throws ParseException {
NodeOptional n0 = new NodeOptional();
NodeSequence n1;
NodeToken n2;
Token n3;
NodeToken n4;
Token n5;
NodeToken n6;
Token n7;
NodeToken n8;
Token n9;
NodeOptional n10 = new NodeOptional();
Params n11;
NodeToken n12;
Token n13;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ID:
n1 = new NodeSequence(2);
n3 = jj_consume_token(ID);
n2 = JTBToolkit.makeNodeToken(n3);
n1.addNode(n2);
n5 = jj_consume_token(OP_DOT);
n4 = JTBToolkit.makeNodeToken(n5);
n1.addNode(n4);
n0.addNode(n1);
break;
default:
jj_la1[6] = jj_gen;
;
}
n7 = jj_consume_token(ID);
n6 = JTBToolkit.makeNodeToken(n7);
n9 = jj_consume_token(L_PAREN);
n8 = JTBToolkit.makeNodeToken(n9);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ERROR_LITERAL:
case ANY_LITERAL:
case BOOLEAN_LITERAL:
case NULL_LITERAL:
case ID:
case DECIMAL_LITERAL:
case FLOAT_LITERAL:
case STRING_LITERAL:
case SQSTRING_LITERAL:
n11 = Params();
n10.addNode(n11);
break;
default:
jj_la1[7] = jj_gen;
;
}
n13 = jj_consume_token(R_PAREN);
n12 = JTBToolkit.makeNodeToken(n13);
{if (true) return new Apply(n0,n6,n8,n10,n12);}
throw new Error("Missing return statement in function");
}
final public Params Params() throws ParseException {
SimpleValue n0;
NodeListOptional n1 = new NodeListOptional();
NodeSequence n2;
NodeToken n3;
Token n4;
SimpleValue n5;
n0 = SimpleValue();
label_3:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case OP_COMMA:
;
break;
default:
jj_la1[8] = jj_gen;
break label_3;
}
n2 = new NodeSequence(2);
n4 = jj_consume_token(OP_COMMA);
n3 = JTBToolkit.makeNodeToken(n4);
n2.addNode(n3);
n5 = SimpleValue();
n2.addNode(n5);
n1.addNode(n2);
}
n1.nodes.trimToSize();
{if (true) return new Params(n0,n1);}
throw new Error("Missing return statement in function");
}
final public Literal Literal() throws ParseException {
NodeChoice n0;
NodeToken n1;
Token n2;
NodeToken n3;
Token n4;
NodeToken n5;
Token n6;
NodeToken n7;
Token n8;
NodeToken n9;
Token n10;
NodeToken n11;
Token n12;
NodeToken n13;
Token n14;
NodeToken n15;
Token n16;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case DECIMAL_LITERAL:
n2 = jj_consume_token(DECIMAL_LITERAL);
n1 = JTBToolkit.makeNodeToken(n2);
n0 = new NodeChoice(n1, 0);
break;
case FLOAT_LITERAL:
n4 = jj_consume_token(FLOAT_LITERAL);
n3 = JTBToolkit.makeNodeToken(n4);
n0 = new NodeChoice(n3, 1);
break;
case STRING_LITERAL:
n6 = jj_consume_token(STRING_LITERAL);
n5 = JTBToolkit.makeNodeToken(n6);
n0 = new NodeChoice(n5, 2);
break;
case SQSTRING_LITERAL:
n8 = jj_consume_token(SQSTRING_LITERAL);
n7 = JTBToolkit.makeNodeToken(n8);
n0 = new NodeChoice(n7, 3);
break;
case BOOLEAN_LITERAL:
n10 = jj_consume_token(BOOLEAN_LITERAL);
n9 = JTBToolkit.makeNodeToken(n10);
n0 = new NodeChoice(n9, 4);
break;
case NULL_LITERAL:
n12 = jj_consume_token(NULL_LITERAL);
n11 = JTBToolkit.makeNodeToken(n12);
n0 = new NodeChoice(n11, 5);
break;
case ERROR_LITERAL:
n14 = jj_consume_token(ERROR_LITERAL);
n13 = JTBToolkit.makeNodeToken(n14);
n0 = new NodeChoice(n13, 6);
break;
case ANY_LITERAL:
n16 = jj_consume_token(ANY_LITERAL);
n15 = JTBToolkit.makeNodeToken(n16);
n0 = new NodeChoice(n15, 7);
break;
default:
jj_la1[9] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return new Literal(n0);}
throw new Error("Missing return statement in function");
}
final public ValueExpr ValueExpr() throws ParseException {
NodeChoice n0;
Literal n1;
Obj n2;
Arr n3;
NodeToken n4;
Token n5;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ERROR_LITERAL:
case ANY_LITERAL:
case BOOLEAN_LITERAL:
case NULL_LITERAL:
case DECIMAL_LITERAL:
case FLOAT_LITERAL:
case STRING_LITERAL:
case SQSTRING_LITERAL:
n1 = Literal();
n0 = new NodeChoice(n1, 0);
break;
case L_CURLY:
n2 = Obj();
n0 = new NodeChoice(n2, 1);
break;
case L_BRACE:
n3 = Arr();
n0 = new NodeChoice(n3, 2);
break;
case ID:
n5 = jj_consume_token(ID);
n4 = JTBToolkit.makeNodeToken(n5);
n0 = new NodeChoice(n4, 3);
break;
default:
jj_la1[10] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return new ValueExpr(n0);}
throw new Error("Missing return statement in function");
}
final public Obj Obj() throws ParseException {
NodeToken n0;
Token n1;
NodeOptional n2 = new NodeOptional();
WithParams n3;
NodeToken n4;
Token n5;
n1 = jj_consume_token(L_CURLY);
n0 = JTBToolkit.makeNodeToken(n1);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ID:
case STRING_LITERAL:
case SQSTRING_LITERAL:
n3 = WithParams();
n2.addNode(n3);
break;
default:
jj_la1[11] = jj_gen;
;
}
n5 = jj_consume_token(R_CURLY);
n4 = JTBToolkit.makeNodeToken(n5);
{if (true) return new Obj(n0,n2,n4);}
throw new Error("Missing return statement in function");
}
final public Arr Arr() throws ParseException {
NodeToken n0;
Token n1;
NodeOptional n2 = new NodeOptional();
ValueList n3;
NodeToken n4;
Token n5;
n1 = jj_consume_token(L_BRACE);
n0 = JTBToolkit.makeNodeToken(n1);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ERROR_LITERAL:
case ANY_LITERAL:
case BOOLEAN_LITERAL:
case NULL_LITERAL:
case ID:
case L_BRACE:
case L_CURLY:
case DECIMAL_LITERAL:
case FLOAT_LITERAL:
case STRING_LITERAL:
case SQSTRING_LITERAL:
n3 = ValueList();
n2.addNode(n3);
break;
default:
jj_la1[12] = jj_gen;
;
}
n5 = jj_consume_token(R_BRACE);
n4 = JTBToolkit.makeNodeToken(n5);
{if (true) return new Arr(n0,n2,n4);}
throw new Error("Missing return statement in function");
}
final public ValueList ValueList() throws ParseException {
ValueExpr n0;
NodeListOptional n1 = new NodeListOptional();
NodeSequence n2;
NodeToken n3;
Token n4;
ValueExpr n5;
n0 = ValueExpr();
label_4:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case OP_COMMA:
;
break;
default:
jj_la1[13] = jj_gen;
break label_4;
}
n2 = new NodeSequence(2);
n4 = jj_consume_token(OP_COMMA);
n3 = JTBToolkit.makeNodeToken(n4);
n2.addNode(n3);
n5 = ValueExpr();
n2.addNode(n5);
n1.addNode(n2);
}
n1.nodes.trimToSize();
{if (true) return new ValueList(n0,n1);}
throw new Error("Missing return statement in function");
}
final public WithParams WithParams() throws ParseException {
WithParam n0;
NodeListOptional n1 = new NodeListOptional();
NodeSequence n2;
NodeToken n3;
Token n4;
WithParam n5;
n0 = WithParam();
label_5:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case OP_COMMA:
;
break;
default:
jj_la1[14] = jj_gen;
break label_5;
}
n2 = new NodeSequence(2);
n4 = jj_consume_token(OP_COMMA);
n3 = JTBToolkit.makeNodeToken(n4);
n2.addNode(n3);
n5 = WithParam();
n2.addNode(n5);
n1.addNode(n2);
}
n1.nodes.trimToSize();
{if (true) return new WithParams(n0,n1);}
throw new Error("Missing return statement in function");
}
final public Key Key() throws ParseException {
NodeChoice n0;
NodeToken n1;
Token n2;
NodeToken n3;
Token n4;
NodeToken n5;
Token n6;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ID:
n2 = jj_consume_token(ID);
n1 = JTBToolkit.makeNodeToken(n2);
n0 = new NodeChoice(n1, 0);
break;
case STRING_LITERAL:
n4 = jj_consume_token(STRING_LITERAL);
n3 = JTBToolkit.makeNodeToken(n4);
n0 = new NodeChoice(n3, 1);
break;
case SQSTRING_LITERAL:
n6 = jj_consume_token(SQSTRING_LITERAL);
n5 = JTBToolkit.makeNodeToken(n6);
n0 = new NodeChoice(n5, 2);
break;
default:
jj_la1[15] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return new Key(n0);}
throw new Error("Missing return statement in function");
}
final public WithParam WithParam() throws ParseException {
Key n0;
NodeToken n1;
Token n2;
SimpleValue n3;
n0 = Key();
n2 = jj_consume_token(OP_WITH);
n1 = JTBToolkit.makeNodeToken(n2);
n3 = SimpleValue();
{if (true) return new WithParam(n0,n1,n3);}
throw new Error("Missing return statement in function");
}
/** Generated Token Manager. */
public TestLogParserTokenManager token_source;
SimpleCharStream jj_input_stream;
/** Current token. */
public Token token;
/** Next token. */
public Token jj_nt;
private int jj_ntk;
private int jj_gen;
final private int[] jj_la1 = new int[16];
static private int[] jj_la1_0;
static {
jj_la1_init_0();
}
private static void jj_la1_init_0() {
jj_la1_0 = new int[] {0x53000,0x53000,0xc0200000,0x100,0x20000,0xf038c000,0x200000,0xf038c000,0x80,0xf018c000,0xf538c000,0xc0200000,0xf538c000,0x80,0x80,0xc0200000,};
}
/** Constructor with InputStream. */
public TestLogParser(java.io.InputStream stream) {
this(stream, null);
}
/** Constructor with InputStream and supplied encoding */
public TestLogParser(java.io.InputStream stream, String encoding) {
try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
token_source = new TestLogParserTokenManager(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 16; i++) jj_la1[i] = -1;
}
/** Reinitialise. */
public void ReInit(java.io.InputStream stream) {
ReInit(stream, null);
}
/** Reinitialise. */
public void ReInit(java.io.InputStream stream, String encoding) {
try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
token_source.ReInit(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 16; i++) jj_la1[i] = -1;
}
/** Constructor. */
public TestLogParser(java.io.Reader stream) {
jj_input_stream = new SimpleCharStream(stream, 1, 1);
token_source = new TestLogParserTokenManager(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 16; i++) jj_la1[i] = -1;
}
/** Reinitialise. */
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 < 16; i++) jj_la1[i] = -1;
}
/** Constructor with generated Token Manager. */
public TestLogParser(TestLogParserTokenManager tm) {
token_source = tm;
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 16; i++) jj_la1[i] = -1;
}
/** Reinitialise. */
public void ReInit(TestLogParserTokenManager tm) {
token_source = tm;
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 16; i++) jj_la1[i] = -1;
}
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();
}
/** Get the next Token. */
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;
}
/** Get the specific 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;
}
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.List jj_expentries = new java.util.ArrayList();
private int[] jj_expentry;
private int jj_kind = -1;
/** Generate ParseException. */
public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[32];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 16; 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 < 32; i++) {
if (la1tokens[i]) {
jj_expentry = new int[1];
jj_expentry[0] = i;
jj_expentries.add(jj_expentry);
}
}
int[][] exptokseq = new int[jj_expentries.size()][];
for (int i = 0; i < jj_expentries.size(); i++) {
exptokseq[i] = (int[])jj_expentries.get(i);
}
return new ParseException(token, exptokseq, tokenImage);
}
/** Enable tracing. */
final public void enable_tracing() {
}
/** Disable tracing. */
final public void disable_tracing() {
}
}
class JTBToolkit {
static NodeToken makeNodeToken(Token t) {
return new NodeToken(t.image.intern(), t.kind, t.beginLine, t.beginColumn, t.endLine, t.endColumn);
}
}