SQLParser.java

/* Generated By:JavaCC: Do not edit this line. SQLParser.java */
package net.metanotion.sqlc.parser;

import net.metanotion.sqlc.parser.syntaxtree.*;
import java.util.Vector;


public class SQLParser implements SQLParserConstants {

  final public Functions Functions() throws ParseException {
   NodeOptional n0 = new NodeOptional();
   PkgDecl n1;
   NodeListOptional n2 = new NodeListOptional();
   Import n3;
   NodeOptional n4 = new NodeOptional();
   NodeToken n5;
   Token n6;
   NodeToken n7;
   Token n8;
   NodeToken n9;
   Token n10;
   NodeToken n11;
   Token n12;
   NodeListOptional n13 = new NodeListOptional();
   Function n14;
   NodeToken n15;
   Token n16;
   NodeToken n17;
   Token n18;
    if (jj_2_1(3)) {
      n1 = PkgDecl();
        n0.addNode(n1);
    } else {
      ;
    }
    label_1:
    while (true) {
      if (jj_2_2(3)) {
        ;
      } else {
        break label_1;
      }
      n3 = Import();
        n2.addNode(n3);
    }
     n2.nodes.trimToSize();
    if (jj_2_3(3)) {
      n6 = jj_consume_token(KW_PUBLIC);
                       n5 = JTBToolkit.makeNodeToken(n6);
        n4.addNode(n5);
    } else {
      ;
    }
    n8 = jj_consume_token(KW_CLASS);
                   n7 = JTBToolkit.makeNodeToken(n8);
    n10 = jj_consume_token(ID);
              n9 = JTBToolkit.makeNodeToken(n10);
    n12 = jj_consume_token(CL_CURLY);
                    n11 = JTBToolkit.makeNodeToken(n12);
    label_2:
    while (true) {
      if (jj_2_4(3)) {
        ;
      } else {
        break label_2;
      }
      n14 = Function();
        n13.addNode(n14);
    }
     n13.nodes.trimToSize();
    n16 = jj_consume_token(CR_CURLY);
                    n15 = JTBToolkit.makeNodeToken(n16);
    n18 = jj_consume_token(0);
      n18.beginColumn++; n18.endColumn++;
      n17 = JTBToolkit.makeNodeToken(n18);
     {if (true) return new Functions(n0,n2,n4,n7,n9,n11,n13,n15,n17);}
    throw new Error("Missing return statement in function");
  }

  final public PkgDecl PkgDecl() throws ParseException {
   NodeToken n0;
   Token n1;
   QName n2;
   NodeToken n3;
   Token n4;
    n1 = jj_consume_token(KW_PACKAGE);
                     n0 = JTBToolkit.makeNodeToken(n1);
    n2 = QName();
    n4 = jj_consume_token(OP_SEMI);
                  n3 = JTBToolkit.makeNodeToken(n4);
     {if (true) return new PkgDecl(n0,n2,n3);}
    throw new Error("Missing return statement in function");
  }

  final public Import Import() throws ParseException {
   NodeToken n0;
   Token n1;
   QName n2;
   NodeOptional n3 = new NodeOptional();
   NodeSequence n4;
   NodeToken n5;
   Token n6;
   NodeToken n7;
   Token n8;
   NodeOptional n9 = new NodeOptional();
   NodeToken n10;
   Token n11;
   NodeToken n12;
   Token n13;
    n1 = jj_consume_token(KW_IMPORT);
                    n0 = JTBToolkit.makeNodeToken(n1);
    n2 = QName();
    if (jj_2_5(3)) {
        n4 = new NodeSequence(2);
      n6 = jj_consume_token(KW_AS);
                   n5 = JTBToolkit.makeNodeToken(n6);
        n4.addNode(n5);
      n8 = jj_consume_token(ID);
                n7 = JTBToolkit.makeNodeToken(n8);
        n4.addNode(n7);
        n3.addNode(n4);
    } else {
      ;
    }
    if (jj_2_6(3)) {
      n11 = jj_consume_token(KW_IMPLICIT);
                          n10 = JTBToolkit.makeNodeToken(n11);
        n9.addNode(n10);
    } else {
      ;
    }
    n13 = jj_consume_token(OP_SEMI);
                   n12 = JTBToolkit.makeNodeToken(n13);
     {if (true) return new Import(n0,n2,n3,n9,n12);}
    throw new Error("Missing return statement in function");
  }

  final public Function Function() throws ParseException {
   TypeExpr n0;
   NodeToken n1;
   Token n2;
   ParamList n3;
   Body n4;
    n0 = TypeExpr();
    n2 = jj_consume_token(C_ID);
               n1 = JTBToolkit.makeNodeToken(n2);
    n3 = ParamList();
    n4 = Body();
     {if (true) return new Function(n0,n1,n3,n4);}
    throw new Error("Missing return statement in function");
  }

  final public TypeExpr TypeExpr() throws ParseException {
   QCName n0;
   NodeOptional n1 = new NodeOptional();
   NodeSequence n2;
   NodeToken n3;
   Token n4;
   TypeExpr n5;
   NodeToken n6;
   Token n7;
    n0 = QCName();
    if (jj_2_7(3)) {
        n2 = new NodeSequence(3);
      n4 = jj_consume_token(L_BRACE);
                     n3 = JTBToolkit.makeNodeToken(n4);
        n2.addNode(n3);
      n5 = TypeExpr();
        n2.addNode(n5);
      n7 = jj_consume_token(R_BRACE);
                     n6 = JTBToolkit.makeNodeToken(n7);
        n2.addNode(n6);
        n1.addNode(n2);
    } else {
      ;
    }
     {if (true) return new TypeExpr(n0,n1);}
    throw new Error("Missing return statement in function");
  }

  final public TypeList TypeList() throws ParseException {
   TypeExpr n0;
   NodeListOptional n1 = new NodeListOptional();
   NodeSequence n2;
   NodeToken n3;
   Token n4;
   TypeExpr n5;
    n0 = TypeExpr();
    label_3:
    while (true) {
      if (jj_2_8(3)) {
        ;
      } else {
        break label_3;
      }
        n2 = new NodeSequence(2);
      n4 = jj_consume_token(OP_COMMA);
                      n3 = JTBToolkit.makeNodeToken(n4);
        n2.addNode(n3);
      n5 = TypeExpr();
        n2.addNode(n5);
        n1.addNode(n2);
    }
     n1.nodes.trimToSize();
     {if (true) return new TypeList(n0,n1);}
    throw new Error("Missing return statement in function");
  }

  final public ParamList ParamList() throws ParseException {
   NodeToken n0;
   Token n1;
   NodeOptional n2 = new NodeOptional();
   Params n3;
   NodeToken n4;
   Token n5;
    n1 = jj_consume_token(L_PAREN);
                  n0 = JTBToolkit.makeNodeToken(n1);
    if (jj_2_9(3)) {
      n3 = Params();
        n2.addNode(n3);
    } else {
      ;
    }
    n5 = jj_consume_token(R_PAREN);
                  n4 = JTBToolkit.makeNodeToken(n5);
     {if (true) return new ParamList(n0,n2,n4);}
    throw new Error("Missing return statement in function");
  }

  final public Params Params() throws ParseException {
   Param n0;
   NodeListOptional n1 = new NodeListOptional();
   NodeSequence n2;
   NodeToken n3;
   Token n4;
   Param n5;
    n0 = Param();
    label_4:
    while (true) {
      if (jj_2_10(3)) {
        ;
      } else {
        break label_4;
      }
        n2 = new NodeSequence(2);
      n4 = jj_consume_token(OP_COMMA);
                      n3 = JTBToolkit.makeNodeToken(n4);
        n2.addNode(n3);
      n5 = Param();
        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 Param Param() throws ParseException {
   QCName n0;
   NodeToken n1;
   Token n2;
    n0 = QCName();
    n2 = jj_consume_token(C_ID);
               n1 = JTBToolkit.makeNodeToken(n2);
     {if (true) return new Param(n0,n1);}
    throw new Error("Missing return statement in function");
  }

  final public QName QName() throws ParseException {
   NodeToken n0;
   Token n1;
   NodeListOptional n2 = new NodeListOptional();
   NodeSequence n3;
   NodeToken n4;
   Token n5;
   NodeToken n6;
   Token n7;
    n1 = jj_consume_token(ID);
             n0 = JTBToolkit.makeNodeToken(n1);
    label_5:
    while (true) {
      if (jj_2_11(3)) {
        ;
      } else {
        break label_5;
      }
        n3 = new NodeSequence(2);
      n5 = jj_consume_token(OP_DOT);
                    n4 = JTBToolkit.makeNodeToken(n5);
        n3.addNode(n4);
      n7 = jj_consume_token(ID);
                n6 = JTBToolkit.makeNodeToken(n7);
        n3.addNode(n6);
        n2.addNode(n3);
    }
     n2.nodes.trimToSize();
     {if (true) return new QName(n0,n2);}
    throw new Error("Missing return statement in function");
  }

  final public QCName QCName() throws ParseException {
   NodeToken n0;
   Token n1;
   NodeListOptional n2 = new NodeListOptional();
   NodeSequence n3;
   NodeToken n4;
   Token n5;
   NodeToken n6;
   Token n7;
    n1 = jj_consume_token(C_ID);
               n0 = JTBToolkit.makeNodeToken(n1);
    label_6:
    while (true) {
      if (jj_2_12(3)) {
        ;
      } else {
        break label_6;
      }
        n3 = new NodeSequence(2);
      n5 = jj_consume_token(COP_DOT);
                     n4 = JTBToolkit.makeNodeToken(n5);
        n3.addNode(n4);
      n7 = jj_consume_token(C_ID);
                  n6 = JTBToolkit.makeNodeToken(n7);
        n3.addNode(n6);
        n2.addNode(n3);
    }
     n2.nodes.trimToSize();
     {if (true) return new QCName(n0,n2);}
    throw new Error("Missing return statement in function");
  }

  final public QVName QVName() throws ParseException {
   NodeToken n0;
   Token n1;
   NodeListOptional n2 = new NodeListOptional();
   NodeSequence n3;
   NodeToken n4;
   Token n5;
   NodeToken n6;
   Token n7;
    n1 = jj_consume_token(VID);
              n0 = JTBToolkit.makeNodeToken(n1);
    label_7:
    while (true) {
      if (jj_2_13(3)) {
        ;
      } else {
        break label_7;
      }
        n3 = new NodeSequence(2);
      n5 = jj_consume_token(VDOT);
                  n4 = JTBToolkit.makeNodeToken(n5);
        n3.addNode(n4);
      n7 = jj_consume_token(VID);
                 n6 = JTBToolkit.makeNodeToken(n7);
        n3.addNode(n6);
        n2.addNode(n3);
    }
     n2.nodes.trimToSize();
     {if (true) return new QVName(n0,n2);}
    throw new Error("Missing return statement in function");
  }

  final public Body Body() throws ParseException {
   NodeToken n0;
   Token n1;
   NodeListOptional n2 = new NodeListOptional();
   SQL n3;
   NodeToken n4;
   Token n5;
    n1 = jj_consume_token(L_CURLY);
                  n0 = JTBToolkit.makeNodeToken(n1);
    label_8:
    while (true) {
      if (jj_2_14(3)) {
        ;
      } else {
        break label_8;
      }
      n3 = SQL();
        n2.addNode(n3);
    }
     n2.nodes.trimToSize();
    n5 = jj_consume_token(R_CURLY);
                  n4 = JTBToolkit.makeNodeToken(n5);
     {if (true) return new Body(n0,n2,n4);}
    throw new Error("Missing return statement in function");
  }

  final public SQL SQL() throws ParseException {
   NodeChoice n0;
   PassThru n1;
   VarStmt n2;
    if (jj_2_15(3)) {
      n1 = PassThru();
        n0 = new NodeChoice(n1, 0);
    } else if (jj_2_16(3)) {
      n2 = VarStmt();
        n0 = new NodeChoice(n2, 1);
    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
     {if (true) return new SQL(n0);}
    throw new Error("Missing return statement in function");
  }

  final public PassThru PassThru() 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;
    if (jj_2_17(3)) {
      n2 = jj_consume_token(SELECT);
                    n1 = JTBToolkit.makeNodeToken(n2);
        n0 = new NodeChoice(n1, 0);
    } else if (jj_2_18(3)) {
      n4 = jj_consume_token(WITH);
                  n3 = JTBToolkit.makeNodeToken(n4);
        n0 = new NodeChoice(n3, 1);
    } else if (jj_2_19(3)) {
      n6 = jj_consume_token(SQL_DS_ESC);
                        n5 = JTBToolkit.makeNodeToken(n6);
        n0 = new NodeChoice(n5, 2);
    } else if (jj_2_20(3)) {
      n8 = jj_consume_token(SQL_BS_ESC);
                        n7 = JTBToolkit.makeNodeToken(n8);
        n0 = new NodeChoice(n7, 3);
    } else if (jj_2_21(3)) {
      n10 = jj_consume_token(SQL_CHAR);
                       n9 = JTBToolkit.makeNodeToken(n10);
        n0 = new NodeChoice(n9, 4);
    } else if (jj_2_22(3)) {
      n12 = jj_consume_token(SQL_OP_SEMI);
                          n11 = JTBToolkit.makeNodeToken(n12);
        n0 = new NodeChoice(n11, 5);
    } else if (jj_2_23(3)) {
      n14 = jj_consume_token(SQL_STRING_LITERAL);
                                 n13 = JTBToolkit.makeNodeToken(n14);
        n0 = new NodeChoice(n13, 6);
    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
     {if (true) return new PassThru(n0);}
    throw new Error("Missing return statement in function");
  }

  final public VarStmt VarStmt() throws ParseException {
   NodeToken n0;
   Token n1;
   NodeChoice n2;
   MacroVar n3;
   InVar n4;
   OutVar n5;
    n1 = jj_consume_token(VAR_BEG);
                  n0 = JTBToolkit.makeNodeToken(n1);
    if (jj_2_24(3)) {
      n3 = MacroVar();
           n2 = new NodeChoice(n3, 0);
    } else if (jj_2_25(3)) {
      n4 = InVar();
           n2 = new NodeChoice(n4, 1);
    } else if (jj_2_26(3)) {
      n5 = OutVar();
           n2 = new NodeChoice(n5, 2);
    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
     {if (true) return new VarStmt(n0,n2);}
    throw new Error("Missing return statement in function");
  }

  final public MacroVar MacroVar() throws ParseException {
   NodeToken n0;
   Token n1;
   NodeToken n2;
   Token n3;
   NodeToken n4;
   Token n5;
    n1 = jj_consume_token(VAT);
              n0 = JTBToolkit.makeNodeToken(n1);
    n3 = jj_consume_token(VID);
              n2 = JTBToolkit.makeNodeToken(n3);
    n5 = jj_consume_token(VAR_END);
                  n4 = JTBToolkit.makeNodeToken(n5);
     {if (true) return new MacroVar(n0,n2,n4);}
    throw new Error("Missing return statement in function");
  }

  final public InVar InVar() throws ParseException {
   NodeToken n0;
   Token n1;
   NodeToken n2;
   Token n3;
    n1 = jj_consume_token(VID);
              n0 = JTBToolkit.makeNodeToken(n1);
    n3 = jj_consume_token(VAR_END);
                  n2 = JTBToolkit.makeNodeToken(n3);
     {if (true) return new InVar(n0,n2);}
    throw new Error("Missing return statement in function");
  }

  final public OutVar OutVar() throws ParseException {
   NodeToken n0;
   Token n1;
   NodeToken n2;
   Token n3;
   NodeOptional n4 = new NodeOptional();
   QVName n5;
   NodeToken n6;
   Token n7;
    n1 = jj_consume_token(OUT);
              n0 = JTBToolkit.makeNodeToken(n1);
    n3 = jj_consume_token(VID);
              n2 = JTBToolkit.makeNodeToken(n3);
    if (jj_2_27(3)) {
      n5 = QVName();
        n4.addNode(n5);
    } else {
      ;
    }
    n7 = jj_consume_token(VAR_END);
                  n6 = JTBToolkit.makeNodeToken(n7);
     {if (true) return new OutVar(n0,n2,n4,n6);}
    throw new Error("Missing return statement in function");
  }

  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); }
  }

  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); }
  }

  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); }
  }

  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); }
  }

  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); }
  }

  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); }
  }

  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); }
  }

  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); }
  }

  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); }
  }

  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); }
  }

  private boolean jj_2_11(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_11(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(10, xla); }
  }

  private boolean jj_2_12(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_12(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(11, xla); }
  }

  private boolean jj_2_13(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_13(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(12, xla); }
  }

  private boolean jj_2_14(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_14(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(13, xla); }
  }

  private boolean jj_2_15(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_15(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(14, xla); }
  }

  private boolean jj_2_16(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_16(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(15, xla); }
  }

  private boolean jj_2_17(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_17(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(16, xla); }
  }

  private boolean jj_2_18(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_18(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(17, xla); }
  }

  private boolean jj_2_19(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_19(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(18, xla); }
  }

  private boolean jj_2_20(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_20(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(19, xla); }
  }

  private boolean jj_2_21(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_21(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(20, xla); }
  }

  private boolean jj_2_22(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_22(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(21, xla); }
  }

  private boolean jj_2_23(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_23(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(22, xla); }
  }

  private boolean jj_2_24(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_24(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(23, xla); }
  }

  private boolean jj_2_25(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_25(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(24, xla); }
  }

  private boolean jj_2_26(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_26(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(25, xla); }
  }

  private boolean jj_2_27(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_27(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(26, xla); }
  }

  private boolean jj_3_10() {
    if (jj_scan_token(OP_COMMA)) return true;
    if (jj_3R_14()) return true;
    return false;
  }

  private boolean jj_3R_21() {
    if (jj_scan_token(VID)) return true;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3_13()) { jj_scanpos = xsp; break; }
    }
    return false;
  }

  private boolean jj_3_2() {
    if (jj_3R_10()) return true;
    return false;
  }

  private boolean jj_3_21() {
    if (jj_scan_token(SQL_CHAR)) return true;
    return false;
  }

  private boolean jj_3_27() {
    if (jj_3R_21()) return true;
    return false;
  }

  private boolean jj_3_20() {
    if (jj_scan_token(SQL_BS_ESC)) return true;
    return false;
  }

  private boolean jj_3R_13() {
    if (jj_3R_14()) return true;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3_10()) { jj_scanpos = xsp; break; }
    }
    return false;
  }

  private boolean jj_3_1() {
    if (jj_3R_9()) return true;
    return false;
  }

  private boolean jj_3R_11() {
    if (jj_3R_12()) return true;
    if (jj_scan_token(C_ID)) return true;
    if (jj_3R_23()) return true;
    return false;
  }

  private boolean jj_3R_20() {
    if (jj_scan_token(OUT)) return true;
    if (jj_scan_token(VID)) return true;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_27()) jj_scanpos = xsp;
    if (jj_scan_token(VAR_END)) return true;
    return false;
  }

  private boolean jj_3_19() {
    if (jj_scan_token(SQL_DS_ESC)) return true;
    return false;
  }

  private boolean jj_3_18() {
    if (jj_scan_token(WITH)) return true;
    return false;
  }

  private boolean jj_3_17() {
    if (jj_scan_token(SELECT)) return true;
    return false;
  }

  private boolean jj_3R_16() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_17()) {
    jj_scanpos = xsp;
    if (jj_3_18()) {
    jj_scanpos = xsp;
    if (jj_3_19()) {
    jj_scanpos = xsp;
    if (jj_3_20()) {
    jj_scanpos = xsp;
    if (jj_3_21()) {
    jj_scanpos = xsp;
    if (jj_3_22()) {
    jj_scanpos = xsp;
    if (jj_3_23()) return true;
    }
    }
    }
    }
    }
    }
    return false;
  }

  private boolean jj_3_9() {
    if (jj_3R_13()) return true;
    return false;
  }

  private boolean jj_3_6() {
    if (jj_scan_token(KW_IMPLICIT)) return true;
    return false;
  }

  private boolean jj_3_12() {
    if (jj_scan_token(COP_DOT)) return true;
    if (jj_scan_token(C_ID)) return true;
    return false;
  }

  private boolean jj_3R_23() {
    if (jj_scan_token(L_PAREN)) return true;
    return false;
  }

  private boolean jj_3R_19() {
    if (jj_scan_token(VID)) return true;
    if (jj_scan_token(VAR_END)) return true;
    return false;
  }

  private boolean jj_3R_24() {
    if (jj_scan_token(C_ID)) return true;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3_12()) { jj_scanpos = xsp; break; }
    }
    return false;
  }

  private boolean jj_3_5() {
    if (jj_scan_token(KW_AS)) return true;
    if (jj_scan_token(ID)) return true;
    return false;
  }

  private boolean jj_3R_10() {
    if (jj_scan_token(KW_IMPORT)) return true;
    if (jj_3R_22()) return true;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_5()) jj_scanpos = xsp;
    xsp = jj_scanpos;
    if (jj_3_6()) jj_scanpos = xsp;
    if (jj_scan_token(OP_SEMI)) return true;
    return false;
  }

  private boolean jj_3_16() {
    if (jj_3R_17()) return true;
    return false;
  }

  private boolean jj_3R_18() {
    if (jj_scan_token(VAT)) return true;
    if (jj_scan_token(VID)) return true;
    if (jj_scan_token(VAR_END)) return true;
    return false;
  }

  private boolean jj_3_15() {
    if (jj_3R_16()) return true;
    return false;
  }

  private boolean jj_3_8() {
    if (jj_scan_token(OP_COMMA)) return true;
    if (jj_3R_12()) return true;
    return false;
  }

  private boolean jj_3R_15() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_15()) {
    jj_scanpos = xsp;
    if (jj_3_16()) return true;
    }
    return false;
  }

  private boolean jj_3_11() {
    if (jj_scan_token(OP_DOT)) return true;
    if (jj_scan_token(ID)) return true;
    return false;
  }

  private boolean jj_3R_22() {
    if (jj_scan_token(ID)) return true;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3_11()) { jj_scanpos = xsp; break; }
    }
    return false;
  }

  private boolean jj_3_26() {
    if (jj_3R_20()) return true;
    return false;
  }

  private boolean jj_3_25() {
    if (jj_3R_19()) return true;
    return false;
  }

  private boolean jj_3R_9() {
    if (jj_scan_token(KW_PACKAGE)) return true;
    if (jj_3R_22()) return true;
    if (jj_scan_token(OP_SEMI)) return true;
    return false;
  }

  private boolean jj_3_14() {
    if (jj_3R_15()) return true;
    return false;
  }

  private boolean jj_3_24() {
    if (jj_3R_18()) return true;
    return false;
  }

  private boolean jj_3R_17() {
    if (jj_scan_token(VAR_BEG)) return true;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_24()) {
    jj_scanpos = xsp;
    if (jj_3_25()) {
    jj_scanpos = xsp;
    if (jj_3_26()) return true;
    }
    }
    return false;
  }

  private boolean jj_3_7() {
    if (jj_scan_token(L_BRACE)) return true;
    if (jj_3R_12()) return true;
    if (jj_scan_token(R_BRACE)) return true;
    return false;
  }

  private boolean jj_3R_14() {
    if (jj_3R_24()) return true;
    if (jj_scan_token(C_ID)) return true;
    return false;
  }

  private boolean jj_3R_12() {
    if (jj_3R_24()) return true;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_7()) jj_scanpos = xsp;
    return false;
  }

  private boolean jj_3_4() {
    if (jj_3R_11()) return true;
    return false;
  }

  private boolean jj_3_13() {
    if (jj_scan_token(VDOT)) return true;
    if (jj_scan_token(VID)) return true;
    return false;
  }

  private boolean jj_3_23() {
    if (jj_scan_token(SQL_STRING_LITERAL)) return true;
    return false;
  }

  private boolean jj_3_3() {
    if (jj_scan_token(KW_PUBLIC)) return true;
    return false;
  }

  private boolean jj_3_22() {
    if (jj_scan_token(SQL_OP_SEMI)) return true;
    return false;
  }

  /** Generated Token Manager. */
  public SQLParserTokenManager token_source;
  SimpleCharStream jj_input_stream;
  /** Current token. */
  public Token token;
  /** Next token. */
  public Token jj_nt;
  private int jj_ntk;
  private Token jj_scanpos, jj_lastpos;
  private int jj_la;
  private int jj_gen;
  final private int[] jj_la1 = new int[0];
  static private int[] jj_la1_0;
  static private int[] jj_la1_1;
  static {
      jj_la1_init_0();
      jj_la1_init_1();
   }
   private static void jj_la1_init_0() {
      jj_la1_0 = new int[] {};
   }
   private static void jj_la1_init_1() {
      jj_la1_1 = new int[] {};
   }
  final private JJCalls[] jj_2_rtns = new JJCalls[27];
  private boolean jj_rescan = false;
  private int jj_gc = 0;

  /** Constructor with InputStream. */
  public SQLParser(java.io.InputStream stream) {
     this(stream, null);
  }
  /** Constructor with InputStream and supplied encoding */
  public SQLParser(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 SQLParserTokenManager(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 0; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  /** 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 < 0; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  /** Constructor. */
  public SQLParser(java.io.Reader stream) {
    jj_input_stream = new SimpleCharStream(stream, 1, 1);
    token_source = new SQLParserTokenManager(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 0; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  /** 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 < 0; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  /** Constructor with generated Token Manager. */
  public SQLParser(SQLParserTokenManager tm) {
    token_source = tm;
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 0; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  /** Reinitialise. */
  public void ReInit(SQLParserTokenManager tm) {
    token_source = tm;
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 0; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  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++;
      if (++jj_gc > 100) {
        jj_gc = 0;
        for (int i = 0; i < jj_2_rtns.length; i++) {
          JJCalls c = jj_2_rtns[i];
          while (c != null) {
            if (c.gen < jj_gen) c.first = null;
            c = c.next;
          }
        }
      }
      return token;
    }
    token = oldToken;
    jj_kind = kind;
    throw generateParseException();
  }

  static private final class LookaheadSuccess extends java.lang.Error { }
  final private LookaheadSuccess jj_ls = new LookaheadSuccess();
  private boolean jj_scan_token(int kind) {
    if (jj_scanpos == jj_lastpos) {
      jj_la--;
      if (jj_scanpos.next == null) {
        jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
      } else {
        jj_lastpos = jj_scanpos = jj_scanpos.next;
      }
    } else {
      jj_scanpos = jj_scanpos.next;
    }
    if (jj_rescan) {
      int i = 0; Token tok = token;
      while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
      if (tok != null) jj_add_error_token(kind, i);
    }
    if (jj_scanpos.kind != kind) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
    return false;
  }


/** 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;
  private int[] jj_lasttokens = new int[100];
  private int jj_endpos;

  private void jj_add_error_token(int kind, int pos) {
    if (pos >= 100) return;
    if (pos == jj_endpos + 1) {
      jj_lasttokens[jj_endpos++] = kind;
    } else if (jj_endpos != 0) {
      jj_expentry = new int[jj_endpos];
      for (int i = 0; i < jj_endpos; i++) {
        jj_expentry[i] = jj_lasttokens[i];
      }
      jj_entries_loop: for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) {
        int[] oldentry = (int[])(it.next());
        if (oldentry.length == jj_expentry.length) {
          for (int i = 0; i < jj_expentry.length; i++) {
            if (oldentry[i] != jj_expentry[i]) {
              continue jj_entries_loop;
            }
          }
          jj_expentries.add(jj_expentry);
          break jj_entries_loop;
        }
      }
      if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
    }
  }

  /** Generate ParseException. */
  public ParseException generateParseException() {
    jj_expentries.clear();
    boolean[] la1tokens = new boolean[59];
    if (jj_kind >= 0) {
      la1tokens[jj_kind] = true;
      jj_kind = -1;
    }
    for (int i = 0; i < 0; 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;
          }
          if ((jj_la1_1[i] & (1<<j)) != 0) {
            la1tokens[32+j] = true;
          }
        }
      }
    }
    for (int i = 0; i < 59; i++) {
      if (la1tokens[i]) {
        jj_expentry = new int[1];
        jj_expentry[0] = i;
        jj_expentries.add(jj_expentry);
      }
    }
    jj_endpos = 0;
    jj_rescan_token();
    jj_add_error_token(0, 0);
    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() {
  }

  private void jj_rescan_token() {
    jj_rescan = true;
    for (int i = 0; i < 27; i++) {
    try {
      JJCalls p = jj_2_rtns[i];
      do {
        if (p.gen > jj_gen) {
          jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
          switch (i) {
            case 0: jj_3_1(); break;
            case 1: jj_3_2(); break;
            case 2: jj_3_3(); break;
            case 3: jj_3_4(); break;
            case 4: jj_3_5(); break;
            case 5: jj_3_6(); break;
            case 6: jj_3_7(); break;
            case 7: jj_3_8(); break;
            case 8: jj_3_9(); break;
            case 9: jj_3_10(); break;
            case 10: jj_3_11(); break;
            case 11: jj_3_12(); break;
            case 12: jj_3_13(); break;
            case 13: jj_3_14(); break;
            case 14: jj_3_15(); break;
            case 15: jj_3_16(); break;
            case 16: jj_3_17(); break;
            case 17: jj_3_18(); break;
            case 18: jj_3_19(); break;
            case 19: jj_3_20(); break;
            case 20: jj_3_21(); break;
            case 21: jj_3_22(); break;
            case 22: jj_3_23(); break;
            case 23: jj_3_24(); break;
            case 24: jj_3_25(); break;
            case 25: jj_3_26(); break;
            case 26: jj_3_27(); break;
          }
        }
        p = p.next;
      } while (p != null);
      } catch(LookaheadSuccess ls) { }
    }
    jj_rescan = false;
  }

  private void jj_save(int index, int xla) {
    JJCalls p = jj_2_rtns[index];
    while (p.gen > jj_gen) {
      if (p.next == null) { p = p.next = new JJCalls(); break; }
      p = p.next;
    }
    p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
  }

  static final class JJCalls {
    int gen;
    Token first;
    int arg;
    JJCalls next;
  }

}

class JTBToolkit {
   static NodeToken makeNodeToken(Token t) {
      return new NodeToken(t.image.intern(), t.kind, t.beginLine, t.beginColumn, t.endLine, t.endColumn);
   }
}