0001: /* Generated By:JavaCC: Do not edit this line. SqlGrammarTokenManager.java */
0002: package org.apache.beehive.controls.system.jdbc.parser;
0003:
0004: import java.io.StringReader;
0005:
0006: public class SqlGrammarTokenManager implements SqlGrammarConstants {
0007: public java.io.PrintStream debugStream = System.out;
0008:
0009: public void setDebugStream(java.io.PrintStream ds) {
0010: debugStream = ds;
0011: }
0012:
0013: private final int jjStopStringLiteralDfa_0(int pos, long active0) {
0014: switch (pos) {
0015: default:
0016: return -1;
0017: }
0018: }
0019:
0020: private final int jjStartNfa_0(int pos, long active0) {
0021: return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0),
0022: pos + 1);
0023: }
0024:
0025: private final int jjStopAtPos(int pos, int kind) {
0026: jjmatchedKind = kind;
0027: jjmatchedPos = pos;
0028: return pos + 1;
0029: }
0030:
0031: private final int jjStartNfaWithStates_0(int pos, int kind,
0032: int state) {
0033: jjmatchedKind = kind;
0034: jjmatchedPos = pos;
0035: try {
0036: curChar = input_stream.readChar();
0037: } catch (java.io.IOException e) {
0038: return pos + 1;
0039: }
0040: return jjMoveNfa_0(state, pos + 1);
0041: }
0042:
0043: private final int jjMoveStringLiteralDfa0_0() {
0044: switch (curChar) {
0045: case 39:
0046: return jjStopAtPos(0, 3);
0047: case 123:
0048: return jjStopAtPos(0, 2);
0049: default:
0050: return jjMoveNfa_0(0, 0);
0051: }
0052: }
0053:
0054: private final void jjCheckNAdd(int state) {
0055: if (jjrounds[state] != jjround) {
0056: jjstateSet[jjnewStateCnt++] = state;
0057: jjrounds[state] = jjround;
0058: }
0059: }
0060:
0061: private final void jjAddStates(int start, int end) {
0062: do {
0063: jjstateSet[jjnewStateCnt++] = jjnextStates[start];
0064: } while (start++ != end);
0065: }
0066:
0067: private final void jjCheckNAddTwoStates(int state1, int state2) {
0068: jjCheckNAdd(state1);
0069: jjCheckNAdd(state2);
0070: }
0071:
0072: private final void jjCheckNAddStates(int start, int end) {
0073: do {
0074: jjCheckNAdd(jjnextStates[start]);
0075: } while (start++ != end);
0076: }
0077:
0078: private final void jjCheckNAddStates(int start) {
0079: jjCheckNAdd(jjnextStates[start]);
0080: jjCheckNAdd(jjnextStates[start + 1]);
0081: }
0082:
0083: static final long[] jjbitVec0 = { 0xfffffffffffffffeL,
0084: 0xffffffffffffffffL, 0xffffffffffffffffL,
0085: 0xffffffffffffffffL };
0086: static final long[] jjbitVec2 = { 0x0L, 0x0L, 0xffffffffffffffffL,
0087: 0xffffffffffffffffL };
0088:
0089: private final int jjMoveNfa_0(int startState, int curPos) {
0090: int[] nextStates;
0091: int startsAt = 0;
0092: jjnewStateCnt = 1;
0093: int i = 1;
0094: jjstateSet[0] = startState;
0095: int j, kind = 0x7fffffff;
0096: for (;;) {
0097: if (++jjround == 0x7fffffff)
0098: ReInitRounds();
0099: if (curChar < 64) {
0100: long l = 1L << curChar;
0101: MatchLoop: do {
0102: switch (jjstateSet[--i]) {
0103: case 0:
0104: if ((0xffffff7fffffffffL & l) == 0L)
0105: break;
0106: kind = 1;
0107: jjstateSet[jjnewStateCnt++] = 0;
0108: break;
0109: default:
0110: break;
0111: }
0112: } while (i != startsAt);
0113: } else if (curChar < 128) {
0114: long l = 1L << (curChar & 077);
0115: MatchLoop: do {
0116: switch (jjstateSet[--i]) {
0117: case 0:
0118: if ((0xd7ffffffffffffffL & l) == 0L)
0119: break;
0120: kind = 1;
0121: jjstateSet[jjnewStateCnt++] = 0;
0122: break;
0123: default:
0124: break;
0125: }
0126: } while (i != startsAt);
0127: } else {
0128: int hiByte = (int) (curChar >> 8);
0129: int i1 = hiByte >> 6;
0130: long l1 = 1L << (hiByte & 077);
0131: int i2 = (curChar & 0xff) >> 6;
0132: long l2 = 1L << (curChar & 077);
0133: MatchLoop: do {
0134: switch (jjstateSet[--i]) {
0135: case 0:
0136: if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
0137: break;
0138: if (kind > 1)
0139: kind = 1;
0140: jjstateSet[jjnewStateCnt++] = 0;
0141: break;
0142: default:
0143: break;
0144: }
0145: } while (i != startsAt);
0146: }
0147: if (kind != 0x7fffffff) {
0148: jjmatchedKind = kind;
0149: jjmatchedPos = curPos;
0150: kind = 0x7fffffff;
0151: }
0152: ++curPos;
0153: if ((i = jjnewStateCnt) == (startsAt = 1 - (jjnewStateCnt = startsAt)))
0154: return curPos;
0155: try {
0156: curChar = input_stream.readChar();
0157: } catch (java.io.IOException e) {
0158: return curPos;
0159: }
0160: }
0161: }
0162:
0163: private final int jjStopStringLiteralDfa_3(int pos, long active0) {
0164: switch (pos) {
0165: case 0:
0166: if ((active0 & 0x2000000L) != 0L) {
0167: jjmatchedKind = 31;
0168: return 4;
0169: }
0170: return -1;
0171: default:
0172: return -1;
0173: }
0174: }
0175:
0176: private final int jjStartNfa_3(int pos, long active0) {
0177: return jjMoveNfa_3(jjStopStringLiteralDfa_3(pos, active0),
0178: pos + 1);
0179: }
0180:
0181: private final int jjStartNfaWithStates_3(int pos, int kind,
0182: int state) {
0183: jjmatchedKind = kind;
0184: jjmatchedPos = pos;
0185: try {
0186: curChar = input_stream.readChar();
0187: } catch (java.io.IOException e) {
0188: return pos + 1;
0189: }
0190: return jjMoveNfa_3(state, pos + 1);
0191: }
0192:
0193: private final int jjMoveStringLiteralDfa0_3() {
0194: switch (curChar) {
0195: case 40:
0196: return jjStopAtPos(0, 26);
0197: case 41:
0198: return jjStopAtPos(0, 24);
0199: case 44:
0200: return jjStopAtPos(0, 27);
0201: case 73:
0202: return jjMoveStringLiteralDfa1_3(0x2000000L);
0203: case 105:
0204: return jjMoveStringLiteralDfa1_3(0x2000000L);
0205: default:
0206: return jjMoveNfa_3(0, 0);
0207: }
0208: }
0209:
0210: private final int jjMoveStringLiteralDfa1_3(long active0) {
0211: try {
0212: curChar = input_stream.readChar();
0213: } catch (java.io.IOException e) {
0214: jjStopStringLiteralDfa_3(0, active0);
0215: return 1;
0216: }
0217: switch (curChar) {
0218: case 78:
0219: if ((active0 & 0x2000000L) != 0L)
0220: return jjStartNfaWithStates_3(1, 25, 4);
0221: break;
0222: case 110:
0223: if ((active0 & 0x2000000L) != 0L)
0224: return jjStartNfaWithStates_3(1, 25, 4);
0225: break;
0226: default:
0227: break;
0228: }
0229: return jjStartNfa_3(0, active0);
0230: }
0231:
0232: static final long[] jjbitVec3 = { 0x1ff00000fffffffeL,
0233: 0xffffffffffffc000L, 0xffffffffL, 0x600000000000000L };
0234: static final long[] jjbitVec4 = { 0x0L, 0x0L, 0x0L,
0235: 0xff7fffffff7fffffL };
0236: static final long[] jjbitVec5 = { 0x0L, 0xffffffffffffffffL,
0237: 0xffffffffffffffffL, 0xffffffffffffffffL };
0238: static final long[] jjbitVec6 = { 0xffffffffffffffffL,
0239: 0xffffffffffffffffL, 0xffffL, 0x0L };
0240: static final long[] jjbitVec7 = { 0xffffffffffffffffL,
0241: 0xffffffffffffffffL, 0x0L, 0x0L };
0242: static final long[] jjbitVec8 = { 0x3fffffffffffL, 0x0L, 0x0L, 0x0L };
0243:
0244: private final int jjMoveNfa_3(int startState, int curPos) {
0245: int[] nextStates;
0246: int startsAt = 0;
0247: jjnewStateCnt = 5;
0248: int i = 1;
0249: jjstateSet[0] = startState;
0250: int j, kind = 0x7fffffff;
0251: for (;;) {
0252: if (++jjround == 0x7fffffff)
0253: ReInitRounds();
0254: if (curChar < 64) {
0255: long l = 1L << curChar;
0256: MatchLoop: do {
0257: switch (jjstateSet[--i]) {
0258: case 0:
0259: if ((0x100002600L & l) != 0L) {
0260: if (kind > 30)
0261: kind = 30;
0262: } else if (curChar == 36) {
0263: if (kind > 31)
0264: kind = 31;
0265: jjCheckNAdd(4);
0266: }
0267: break;
0268: case 2:
0269: if ((0x100002600L & l) != 0L)
0270: kind = 30;
0271: break;
0272: case 3:
0273: if (curChar != 36)
0274: break;
0275: if (kind > 31)
0276: kind = 31;
0277: jjCheckNAdd(4);
0278: break;
0279: case 4:
0280: if ((0x3ff401000000000L & l) == 0L)
0281: break;
0282: if (kind > 31)
0283: kind = 31;
0284: jjCheckNAdd(4);
0285: break;
0286: default:
0287: break;
0288: }
0289: } while (i != startsAt);
0290: } else if (curChar < 128) {
0291: long l = 1L << (curChar & 077);
0292: MatchLoop: do {
0293: switch (jjstateSet[--i]) {
0294: case 0:
0295: if ((0x7fffffe87fffffeL & l) != 0L) {
0296: if (kind > 31)
0297: kind = 31;
0298: jjCheckNAdd(4);
0299: } else if (curChar == 125) {
0300: if (kind > 29)
0301: kind = 29;
0302: } else if (curChar == 123) {
0303: if (kind > 28)
0304: kind = 28;
0305: }
0306: break;
0307: case 1:
0308: if (curChar == 125)
0309: kind = 29;
0310: break;
0311: case 3:
0312: case 4:
0313: if ((0x7fffffe87fffffeL & l) == 0L)
0314: break;
0315: if (kind > 31)
0316: kind = 31;
0317: jjCheckNAdd(4);
0318: break;
0319: default:
0320: break;
0321: }
0322: } while (i != startsAt);
0323: } else {
0324: int hiByte = (int) (curChar >> 8);
0325: int i1 = hiByte >> 6;
0326: long l1 = 1L << (hiByte & 077);
0327: int i2 = (curChar & 0xff) >> 6;
0328: long l2 = 1L << (curChar & 077);
0329: MatchLoop: do {
0330: switch (jjstateSet[--i]) {
0331: case 0:
0332: case 4:
0333: if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
0334: break;
0335: if (kind > 31)
0336: kind = 31;
0337: jjCheckNAdd(4);
0338: break;
0339: default:
0340: break;
0341: }
0342: } while (i != startsAt);
0343: }
0344: if (kind != 0x7fffffff) {
0345: jjmatchedKind = kind;
0346: jjmatchedPos = curPos;
0347: kind = 0x7fffffff;
0348: }
0349: ++curPos;
0350: if ((i = jjnewStateCnt) == (startsAt = 5 - (jjnewStateCnt = startsAt)))
0351: return curPos;
0352: try {
0353: curChar = input_stream.readChar();
0354: } catch (java.io.IOException e) {
0355: return curPos;
0356: }
0357: }
0358: }
0359:
0360: private final int jjMoveStringLiteralDfa0_1() {
0361: return jjMoveNfa_1(14, 0);
0362: }
0363:
0364: private final int jjMoveNfa_1(int startState, int curPos) {
0365: int[] nextStates;
0366: int startsAt = 0;
0367: jjnewStateCnt = 14;
0368: int i = 1;
0369: jjstateSet[0] = startState;
0370: int j, kind = 0x7fffffff;
0371: for (;;) {
0372: if (++jjround == 0x7fffffff)
0373: ReInitRounds();
0374: if (curChar < 64) {
0375: long l = 1L << curChar;
0376: MatchLoop: do {
0377: switch (jjstateSet[--i]) {
0378: case 14:
0379: if ((0xffffff7fffffdbffL & l) != 0L)
0380: jjCheckNAddStates(0, 5);
0381: else if (curChar == 39) {
0382: if (kind > 4)
0383: kind = 4;
0384: }
0385: if ((0xff000000000000L & l) != 0L)
0386: jjCheckNAddStates(6, 11);
0387: if ((0xf000000000000L & l) != 0L)
0388: jjstateSet[jjnewStateCnt++] = 9;
0389: break;
0390: case 0:
0391: if ((0xffffff7fffffdbffL & l) != 0L)
0392: jjCheckNAddStates(0, 5);
0393: break;
0394: case 2:
0395: if ((0x3ff000000000000L & l) != 0L)
0396: jjstateSet[jjnewStateCnt++] = 3;
0397: break;
0398: case 3:
0399: if ((0x3ff000000000000L & l) != 0L)
0400: jjstateSet[jjnewStateCnt++] = 4;
0401: break;
0402: case 4:
0403: case 7:
0404: if ((0x3ff000000000000L & l) != 0L)
0405: jjCheckNAdd(5);
0406: break;
0407: case 5:
0408: if ((0x3ff000000000000L & l) != 0L)
0409: jjCheckNAddStates(0, 5);
0410: break;
0411: case 8:
0412: if ((0xf000000000000L & l) != 0L)
0413: jjstateSet[jjnewStateCnt++] = 9;
0414: break;
0415: case 9:
0416: if ((0xff000000000000L & l) != 0L)
0417: jjstateSet[jjnewStateCnt++] = 10;
0418: break;
0419: case 10:
0420: if ((0xff000000000000L & l) != 0L)
0421: jjCheckNAddStates(0, 5);
0422: break;
0423: case 11:
0424: if ((0xff000000000000L & l) != 0L)
0425: jjCheckNAddStates(6, 11);
0426: break;
0427: case 12:
0428: if (curChar == 39)
0429: kind = 4;
0430: break;
0431: case 13:
0432: if ((0xff000000000000L & l) != 0L)
0433: jjCheckNAddStates(12, 18);
0434: break;
0435: default:
0436: break;
0437: }
0438: } while (i != startsAt);
0439: } else if (curChar < 128) {
0440: long l = 1L << (curChar & 077);
0441: MatchLoop: do {
0442: switch (jjstateSet[--i]) {
0443: case 14:
0444: jjCheckNAddStates(0, 5);
0445: if ((0x100000001000000L & l) != 0L)
0446: jjstateSet[jjnewStateCnt++] = 7;
0447: else if ((0x20000000200000L & l) != 0L)
0448: jjstateSet[jjnewStateCnt++] = 2;
0449: break;
0450: case 0:
0451: jjCheckNAddStates(0, 5);
0452: break;
0453: case 1:
0454: if ((0x20000000200000L & l) != 0L)
0455: jjstateSet[jjnewStateCnt++] = 2;
0456: break;
0457: case 2:
0458: if ((0x7e0000007eL & l) != 0L)
0459: jjstateSet[jjnewStateCnt++] = 3;
0460: break;
0461: case 3:
0462: if ((0x7e0000007eL & l) != 0L)
0463: jjstateSet[jjnewStateCnt++] = 4;
0464: break;
0465: case 4:
0466: case 7:
0467: if ((0x7e0000007eL & l) != 0L)
0468: jjCheckNAdd(5);
0469: break;
0470: case 5:
0471: if ((0x7e0000007eL & l) != 0L)
0472: jjCheckNAddStates(0, 5);
0473: break;
0474: case 6:
0475: if ((0x100000001000000L & l) != 0L)
0476: jjstateSet[jjnewStateCnt++] = 7;
0477: break;
0478: default:
0479: break;
0480: }
0481: } while (i != startsAt);
0482: } else {
0483: int hiByte = (int) (curChar >> 8);
0484: int i1 = hiByte >> 6;
0485: long l1 = 1L << (hiByte & 077);
0486: int i2 = (curChar & 0xff) >> 6;
0487: long l2 = 1L << (curChar & 077);
0488: MatchLoop: do {
0489: switch (jjstateSet[--i]) {
0490: case 14:
0491: case 0:
0492: if (jjCanMove_0(hiByte, i1, i2, l1, l2))
0493: jjCheckNAddStates(0, 5);
0494: break;
0495: default:
0496: break;
0497: }
0498: } while (i != startsAt);
0499: }
0500: if (kind != 0x7fffffff) {
0501: jjmatchedKind = kind;
0502: jjmatchedPos = curPos;
0503: kind = 0x7fffffff;
0504: }
0505: ++curPos;
0506: if ((i = jjnewStateCnt) == (startsAt = 14 - (jjnewStateCnt = startsAt)))
0507: return curPos;
0508: try {
0509: curChar = input_stream.readChar();
0510: } catch (java.io.IOException e) {
0511: return curPos;
0512: }
0513: }
0514: }
0515:
0516: private final int jjMoveStringLiteralDfa0_4() {
0517: return jjMoveNfa_4(0, 0);
0518: }
0519:
0520: private final int jjMoveNfa_4(int startState, int curPos) {
0521: int[] nextStates;
0522: int startsAt = 0;
0523: jjnewStateCnt = 3;
0524: int i = 1;
0525: jjstateSet[0] = startState;
0526: int j, kind = 0x7fffffff;
0527: for (;;) {
0528: if (++jjround == 0x7fffffff)
0529: ReInitRounds();
0530: if (curChar < 64) {
0531: long l = 1L << curChar;
0532: MatchLoop: do {
0533: switch (jjstateSet[--i]) {
0534: case 0:
0535: case 1:
0536: kind = 33;
0537: jjCheckNAdd(1);
0538: break;
0539: default:
0540: break;
0541: }
0542: } while (i != startsAt);
0543: } else if (curChar < 128) {
0544: long l = 1L << (curChar & 077);
0545: MatchLoop: do {
0546: switch (jjstateSet[--i]) {
0547: case 0:
0548: if ((0xd7ffffffffffffffL & l) != 0L) {
0549: if (kind > 33)
0550: kind = 33;
0551: jjCheckNAdd(1);
0552: } else if (curChar == 123) {
0553: if (kind > 34)
0554: kind = 34;
0555: } else if (curChar == 125) {
0556: if (kind > 32)
0557: kind = 32;
0558: }
0559: break;
0560: case 1:
0561: if ((0xd7ffffffffffffffL & l) == 0L)
0562: break;
0563: kind = 33;
0564: jjCheckNAdd(1);
0565: break;
0566: case 2:
0567: if (curChar == 123)
0568: kind = 34;
0569: break;
0570: default:
0571: break;
0572: }
0573: } while (i != startsAt);
0574: } else {
0575: int hiByte = (int) (curChar >> 8);
0576: int i1 = hiByte >> 6;
0577: long l1 = 1L << (hiByte & 077);
0578: int i2 = (curChar & 0xff) >> 6;
0579: long l2 = 1L << (curChar & 077);
0580: MatchLoop: do {
0581: switch (jjstateSet[--i]) {
0582: case 0:
0583: case 1:
0584: if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
0585: break;
0586: if (kind > 33)
0587: kind = 33;
0588: jjCheckNAdd(1);
0589: break;
0590: default:
0591: break;
0592: }
0593: } while (i != startsAt);
0594: }
0595: if (kind != 0x7fffffff) {
0596: jjmatchedKind = kind;
0597: jjmatchedPos = curPos;
0598: kind = 0x7fffffff;
0599: }
0600: ++curPos;
0601: if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt)))
0602: return curPos;
0603: try {
0604: curChar = input_stream.readChar();
0605: } catch (java.io.IOException e) {
0606: return curPos;
0607: }
0608: }
0609: }
0610:
0611: private final int jjStopStringLiteralDfa_2(int pos, long active0) {
0612: switch (pos) {
0613: default:
0614: return -1;
0615: }
0616: }
0617:
0618: private final int jjStartNfa_2(int pos, long active0) {
0619: return jjMoveNfa_2(jjStopStringLiteralDfa_2(pos, active0),
0620: pos + 1);
0621: }
0622:
0623: private final int jjStartNfaWithStates_2(int pos, int kind,
0624: int state) {
0625: jjmatchedKind = kind;
0626: jjmatchedPos = pos;
0627: try {
0628: curChar = input_stream.readChar();
0629: } catch (java.io.IOException e) {
0630: return pos + 1;
0631: }
0632: return jjMoveNfa_2(state, pos + 1);
0633: }
0634:
0635: private final int jjMoveStringLiteralDfa0_2() {
0636: switch (curChar) {
0637: case 124:
0638: return jjStopAtPos(0, 8);
0639: case 125:
0640: return jjStopAtPos(0, 7);
0641: default:
0642: return jjMoveNfa_2(4, 0);
0643: }
0644: }
0645:
0646: private final int jjMoveNfa_2(int startState, int curPos) {
0647: int[] nextStates;
0648: int startsAt = 0;
0649: jjnewStateCnt = 54;
0650: int i = 1;
0651: jjstateSet[0] = startState;
0652: int j, kind = 0x7fffffff;
0653: for (;;) {
0654: if (++jjround == 0x7fffffff)
0655: ReInitRounds();
0656: if (curChar < 64) {
0657: long l = 1L << curChar;
0658: MatchLoop: do {
0659: switch (jjstateSet[--i]) {
0660: case 4:
0661: if ((0x100002600L & l) != 0L) {
0662: if (kind > 20)
0663: kind = 20;
0664: } else if (curChar == 36) {
0665: if (kind > 21)
0666: kind = 21;
0667: jjCheckNAdd(31);
0668: } else if (curChar == 63)
0669: jjCheckNAddTwoStates(6, 7);
0670: break;
0671: case 1:
0672: if ((0x100002600L & l) == 0L)
0673: break;
0674: if (kind > 12)
0675: kind = 12;
0676: jjstateSet[jjnewStateCnt++] = 1;
0677: break;
0678: case 5:
0679: if (curChar == 63)
0680: jjCheckNAddTwoStates(6, 7);
0681: break;
0682: case 6:
0683: if ((0x100002600L & l) != 0L)
0684: jjCheckNAddTwoStates(6, 7);
0685: break;
0686: case 7:
0687: if (curChar != 61)
0688: break;
0689: kind = 13;
0690: jjCheckNAdd(8);
0691: break;
0692: case 8:
0693: if ((0x100002600L & l) == 0L)
0694: break;
0695: if (kind > 13)
0696: kind = 13;
0697: jjCheckNAdd(8);
0698: break;
0699: case 10:
0700: if ((0x100002600L & l) == 0L)
0701: break;
0702: if (kind > 14)
0703: kind = 14;
0704: jjstateSet[jjnewStateCnt++] = 10;
0705: break;
0706: case 12:
0707: if ((0x100002600L & l) == 0L)
0708: break;
0709: if (kind > 15)
0710: kind = 15;
0711: jjstateSet[jjnewStateCnt++] = 12;
0712: break;
0713: case 14:
0714: if ((0x100002600L & l) == 0L)
0715: break;
0716: if (kind > 16)
0717: kind = 16;
0718: jjstateSet[jjnewStateCnt++] = 14;
0719: break;
0720: case 17:
0721: if ((0x100002600L & l) == 0L)
0722: break;
0723: if (kind > 17)
0724: kind = 17;
0725: jjstateSet[jjnewStateCnt++] = 17;
0726: break;
0727: case 20:
0728: if ((0x100002600L & l) == 0L)
0729: break;
0730: if (kind > 18)
0731: kind = 18;
0732: jjstateSet[jjnewStateCnt++] = 20;
0733: break;
0734: case 27:
0735: if ((0x100002600L & l) == 0L)
0736: break;
0737: if (kind > 19)
0738: kind = 19;
0739: jjstateSet[jjnewStateCnt++] = 27;
0740: break;
0741: case 29:
0742: if ((0x100002600L & l) != 0L && kind > 20)
0743: kind = 20;
0744: break;
0745: case 30:
0746: if (curChar != 36)
0747: break;
0748: if (kind > 21)
0749: kind = 21;
0750: jjCheckNAdd(31);
0751: break;
0752: case 31:
0753: if ((0x3ff401000000000L & l) == 0L)
0754: break;
0755: if (kind > 21)
0756: kind = 21;
0757: jjCheckNAdd(31);
0758: break;
0759: case 33:
0760: if (curChar == 58)
0761: jjCheckNAdd(34);
0762: break;
0763: case 34:
0764: if ((0x100002600L & l) == 0L)
0765: break;
0766: if (kind > 9)
0767: kind = 9;
0768: jjCheckNAdd(34);
0769: break;
0770: case 37:
0771: if (curChar == 58)
0772: jjCheckNAddTwoStates(38, 44);
0773: break;
0774: case 38:
0775: if ((0x100002600L & l) != 0L)
0776: jjCheckNAddTwoStates(38, 44);
0777: break;
0778: case 40:
0779: if ((0x100002600L & l) == 0L)
0780: break;
0781: if (kind > 10)
0782: kind = 10;
0783: jjstateSet[jjnewStateCnt++] = 40;
0784: break;
0785: case 47:
0786: if (curChar == 58)
0787: jjCheckNAddTwoStates(48, 51);
0788: break;
0789: case 48:
0790: if ((0x100002600L & l) != 0L)
0791: jjCheckNAddTwoStates(48, 51);
0792: break;
0793: case 50:
0794: if ((0x100002600L & l) == 0L)
0795: break;
0796: if (kind > 11)
0797: kind = 11;
0798: jjstateSet[jjnewStateCnt++] = 50;
0799: break;
0800: default:
0801: break;
0802: }
0803: } while (i != startsAt);
0804: } else if (curChar < 128) {
0805: long l = 1L << (curChar & 077);
0806: MatchLoop: do {
0807: switch (jjstateSet[--i]) {
0808: case 4:
0809: if ((0x7fffffe87fffffeL & l) != 0L) {
0810: if (kind > 21)
0811: kind = 21;
0812: jjCheckNAdd(31);
0813: }
0814: if ((0x8000000080000L & l) != 0L)
0815: jjAddStates(19, 21);
0816: else if ((0x800000008000L & l) != 0L)
0817: jjstateSet[jjnewStateCnt++] = 26;
0818: else if ((0x2000000020L & l) != 0L)
0819: jjstateSet[jjnewStateCnt++] = 24;
0820: else if ((0x4000000040L & l) != 0L)
0821: jjstateSet[jjnewStateCnt++] = 16;
0822: else if ((0x10000000100000L & l) != 0L)
0823: jjstateSet[jjnewStateCnt++] = 13;
0824: else if ((0x1000000010L & l) != 0L)
0825: jjstateSet[jjnewStateCnt++] = 10;
0826: else if ((0x800000008L & l) != 0L)
0827: jjstateSet[jjnewStateCnt++] = 3;
0828: if ((0x10000000100000L & l) != 0L)
0829: jjstateSet[jjnewStateCnt++] = 12;
0830: break;
0831: case 0:
0832: if ((0x100000001000L & l) != 0L)
0833: jjstateSet[jjnewStateCnt++] = 1;
0834: break;
0835: case 2:
0836: if ((0x100000001000L & l) != 0L)
0837: jjstateSet[jjnewStateCnt++] = 0;
0838: break;
0839: case 3:
0840: if ((0x200000002L & l) != 0L)
0841: jjstateSet[jjnewStateCnt++] = 2;
0842: break;
0843: case 9:
0844: if ((0x1000000010L & l) != 0L)
0845: jjstateSet[jjnewStateCnt++] = 10;
0846: break;
0847: case 11:
0848: if ((0x10000000100000L & l) != 0L)
0849: jjstateSet[jjnewStateCnt++] = 12;
0850: break;
0851: case 13:
0852: if ((0x8000000080000L & l) != 0L)
0853: jjstateSet[jjnewStateCnt++] = 14;
0854: break;
0855: case 15:
0856: if ((0x10000000100000L & l) != 0L)
0857: jjstateSet[jjnewStateCnt++] = 13;
0858: break;
0859: case 16:
0860: if ((0x400000004000L & l) != 0L)
0861: jjstateSet[jjnewStateCnt++] = 17;
0862: break;
0863: case 18:
0864: if ((0x4000000040L & l) != 0L)
0865: jjstateSet[jjnewStateCnt++] = 16;
0866: break;
0867: case 19:
0868: if ((0x2000000020L & l) != 0L)
0869: jjstateSet[jjnewStateCnt++] = 20;
0870: break;
0871: case 21:
0872: if ((0x1000000010000L & l) != 0L)
0873: jjstateSet[jjnewStateCnt++] = 19;
0874: break;
0875: case 22:
0876: if ((0x200000002L & l) != 0L)
0877: jjstateSet[jjnewStateCnt++] = 21;
0878: break;
0879: case 23:
0880: if ((0x800000008L & l) != 0L)
0881: jjstateSet[jjnewStateCnt++] = 22;
0882: break;
0883: case 24:
0884: if ((0x8000000080000L & l) != 0L)
0885: jjstateSet[jjnewStateCnt++] = 23;
0886: break;
0887: case 25:
0888: if ((0x2000000020L & l) != 0L)
0889: jjstateSet[jjnewStateCnt++] = 24;
0890: break;
0891: case 26:
0892: if ((0x40000000400L & l) != 0L)
0893: jjstateSet[jjnewStateCnt++] = 27;
0894: break;
0895: case 28:
0896: if ((0x800000008000L & l) != 0L)
0897: jjstateSet[jjnewStateCnt++] = 26;
0898: break;
0899: case 30:
0900: case 31:
0901: if ((0x7fffffe87fffffeL & l) == 0L)
0902: break;
0903: if (kind > 21)
0904: kind = 21;
0905: jjCheckNAdd(31);
0906: break;
0907: case 32:
0908: if ((0x8000000080000L & l) != 0L)
0909: jjAddStates(19, 21);
0910: break;
0911: case 35:
0912: if ((0x100000001000L & l) != 0L)
0913: jjstateSet[jjnewStateCnt++] = 33;
0914: break;
0915: case 36:
0916: if ((0x2000000020000L & l) != 0L)
0917: jjstateSet[jjnewStateCnt++] = 35;
0918: break;
0919: case 39:
0920: if ((0x10000000100000L & l) != 0L)
0921: jjstateSet[jjnewStateCnt++] = 40;
0922: break;
0923: case 41:
0924: if ((0x8000000080000L & l) != 0L)
0925: jjstateSet[jjnewStateCnt++] = 39;
0926: break;
0927: case 42:
0928: if ((0x400000004L & l) != 0L)
0929: jjstateSet[jjnewStateCnt++] = 41;
0930: break;
0931: case 43:
0932: if ((0x20000000200000L & l) != 0L)
0933: jjstateSet[jjnewStateCnt++] = 42;
0934: break;
0935: case 44:
0936: if ((0x8000000080000L & l) != 0L)
0937: jjstateSet[jjnewStateCnt++] = 43;
0938: break;
0939: case 45:
0940: if ((0x100000001000L & l) != 0L)
0941: jjstateSet[jjnewStateCnt++] = 37;
0942: break;
0943: case 46:
0944: if ((0x2000000020000L & l) != 0L)
0945: jjstateSet[jjnewStateCnt++] = 45;
0946: break;
0947: case 49:
0948: if ((0x400000004000L & l) != 0L)
0949: jjstateSet[jjnewStateCnt++] = 50;
0950: break;
0951: case 51:
0952: if ((0x4000000040L & l) != 0L)
0953: jjstateSet[jjnewStateCnt++] = 49;
0954: break;
0955: case 52:
0956: if ((0x100000001000L & l) != 0L)
0957: jjstateSet[jjnewStateCnt++] = 47;
0958: break;
0959: case 53:
0960: if ((0x2000000020000L & l) != 0L)
0961: jjstateSet[jjnewStateCnt++] = 52;
0962: break;
0963: default:
0964: break;
0965: }
0966: } while (i != startsAt);
0967: } else {
0968: int hiByte = (int) (curChar >> 8);
0969: int i1 = hiByte >> 6;
0970: long l1 = 1L << (hiByte & 077);
0971: int i2 = (curChar & 0xff) >> 6;
0972: long l2 = 1L << (curChar & 077);
0973: MatchLoop: do {
0974: switch (jjstateSet[--i]) {
0975: case 4:
0976: case 31:
0977: if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
0978: break;
0979: if (kind > 21)
0980: kind = 21;
0981: jjCheckNAdd(31);
0982: break;
0983: default:
0984: break;
0985: }
0986: } while (i != startsAt);
0987: }
0988: if (kind != 0x7fffffff) {
0989: jjmatchedKind = kind;
0990: jjmatchedPos = curPos;
0991: kind = 0x7fffffff;
0992: }
0993: ++curPos;
0994: if ((i = jjnewStateCnt) == (startsAt = 54 - (jjnewStateCnt = startsAt)))
0995: return curPos;
0996: try {
0997: curChar = input_stream.readChar();
0998: } catch (java.io.IOException e) {
0999: return curPos;
1000: }
1001: }
1002: }
1003:
1004: private final int jjMoveStringLiteralDfa0_5() {
1005: return jjMoveNfa_5(0, 0);
1006: }
1007:
1008: private final int jjMoveNfa_5(int startState, int curPos) {
1009: int[] nextStates;
1010: int startsAt = 0;
1011: jjnewStateCnt = 19;
1012: int i = 1;
1013: jjstateSet[0] = startState;
1014: int j, kind = 0x7fffffff;
1015: for (;;) {
1016: if (++jjround == 0x7fffffff)
1017: ReInitRounds();
1018: if (curChar < 64) {
1019: long l = 1L << curChar;
1020: MatchLoop: do {
1021: switch (jjstateSet[--i]) {
1022: case 0:
1023: if (curChar == 39)
1024: jjCheckNAddStates(22, 27);
1025: else if (curChar == 36) {
1026: if (kind > 35)
1027: kind = 35;
1028: jjCheckNAdd(1);
1029: }
1030: break;
1031: case 1:
1032: if ((0x3ff401000000000L & l) == 0L)
1033: break;
1034: if (kind > 35)
1035: kind = 35;
1036: jjCheckNAdd(1);
1037: break;
1038: case 3:
1039: if (curChar == 39)
1040: jjCheckNAddStates(22, 27);
1041: break;
1042: case 4:
1043: if ((0xffffff7fffffdbffL & l) != 0L)
1044: jjCheckNAddStates(22, 27);
1045: break;
1046: case 6:
1047: if ((0x3ff000000000000L & l) != 0L)
1048: jjstateSet[jjnewStateCnt++] = 7;
1049: break;
1050: case 7:
1051: if ((0x3ff000000000000L & l) != 0L)
1052: jjstateSet[jjnewStateCnt++] = 8;
1053: break;
1054: case 8:
1055: case 11:
1056: if ((0x3ff000000000000L & l) != 0L)
1057: jjCheckNAdd(9);
1058: break;
1059: case 9:
1060: if ((0x3ff000000000000L & l) != 0L)
1061: jjCheckNAddStates(22, 27);
1062: break;
1063: case 12:
1064: if ((0xf000000000000L & l) != 0L)
1065: jjstateSet[jjnewStateCnt++] = 13;
1066: break;
1067: case 13:
1068: if ((0xff000000000000L & l) != 0L)
1069: jjstateSet[jjnewStateCnt++] = 14;
1070: break;
1071: case 14:
1072: if ((0xff000000000000L & l) != 0L)
1073: jjCheckNAddStates(22, 27);
1074: break;
1075: case 15:
1076: if ((0xff000000000000L & l) != 0L)
1077: jjCheckNAddStates(28, 33);
1078: break;
1079: case 16:
1080: if (curChar == 39 && kind > 37)
1081: kind = 37;
1082: break;
1083: case 17:
1084: if ((0xff000000000000L & l) != 0L)
1085: jjCheckNAddStates(34, 40);
1086: break;
1087: default:
1088: break;
1089: }
1090: } while (i != startsAt);
1091: } else if (curChar < 128) {
1092: long l = 1L << (curChar & 077);
1093: MatchLoop: do {
1094: switch (jjstateSet[--i]) {
1095: case 0:
1096: if ((0x7fffffe87fffffeL & l) != 0L) {
1097: if (kind > 35)
1098: kind = 35;
1099: jjCheckNAdd(1);
1100: } else if (curChar == 125) {
1101: if (kind > 38)
1102: kind = 38;
1103: } else if (curChar == 124) {
1104: if (kind > 36)
1105: kind = 36;
1106: }
1107: break;
1108: case 1:
1109: if ((0x7fffffe87fffffeL & l) == 0L)
1110: break;
1111: if (kind > 35)
1112: kind = 35;
1113: jjCheckNAdd(1);
1114: break;
1115: case 2:
1116: if (curChar == 124 && kind > 36)
1117: kind = 36;
1118: break;
1119: case 4:
1120: jjCheckNAddStates(22, 27);
1121: break;
1122: case 5:
1123: if ((0x20000000200000L & l) != 0L)
1124: jjstateSet[jjnewStateCnt++] = 6;
1125: break;
1126: case 6:
1127: if ((0x7e0000007eL & l) != 0L)
1128: jjstateSet[jjnewStateCnt++] = 7;
1129: break;
1130: case 7:
1131: if ((0x7e0000007eL & l) != 0L)
1132: jjstateSet[jjnewStateCnt++] = 8;
1133: break;
1134: case 8:
1135: case 11:
1136: if ((0x7e0000007eL & l) != 0L)
1137: jjCheckNAdd(9);
1138: break;
1139: case 9:
1140: if ((0x7e0000007eL & l) != 0L)
1141: jjCheckNAddStates(22, 27);
1142: break;
1143: case 10:
1144: if ((0x100000001000000L & l) != 0L)
1145: jjstateSet[jjnewStateCnt++] = 11;
1146: break;
1147: case 18:
1148: if (curChar == 125 && kind > 38)
1149: kind = 38;
1150: break;
1151: default:
1152: break;
1153: }
1154: } while (i != startsAt);
1155: } else {
1156: int hiByte = (int) (curChar >> 8);
1157: int i1 = hiByte >> 6;
1158: long l1 = 1L << (hiByte & 077);
1159: int i2 = (curChar & 0xff) >> 6;
1160: long l2 = 1L << (curChar & 077);
1161: MatchLoop: do {
1162: switch (jjstateSet[--i]) {
1163: case 0:
1164: case 1:
1165: if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
1166: break;
1167: if (kind > 35)
1168: kind = 35;
1169: jjCheckNAdd(1);
1170: break;
1171: case 4:
1172: if (jjCanMove_0(hiByte, i1, i2, l1, l2))
1173: jjAddStates(22, 27);
1174: break;
1175: default:
1176: break;
1177: }
1178: } while (i != startsAt);
1179: }
1180: if (kind != 0x7fffffff) {
1181: jjmatchedKind = kind;
1182: jjmatchedPos = curPos;
1183: kind = 0x7fffffff;
1184: }
1185: ++curPos;
1186: if ((i = jjnewStateCnt) == (startsAt = 19 - (jjnewStateCnt = startsAt)))
1187: return curPos;
1188: try {
1189: curChar = input_stream.readChar();
1190: } catch (java.io.IOException e) {
1191: return curPos;
1192: }
1193: }
1194: }
1195:
1196: static final int[] jjnextStates = { 0, 1, 6, 8, 11, 12, 0, 1, 6, 8,
1197: 12, 13, 0, 1, 6, 8, 11, 12, 13, 36, 46, 53, 4, 5, 10, 12,
1198: 15, 16, 4, 5, 10, 12, 16, 17, 4, 5, 10, 12, 15, 16, 17, };
1199:
1200: private static final boolean jjCanMove_0(int hiByte, int i1,
1201: int i2, long l1, long l2) {
1202: switch (hiByte) {
1203: case 0:
1204: return ((jjbitVec2[i2] & l2) != 0L);
1205: default:
1206: if ((jjbitVec0[i1] & l1) != 0L)
1207: return true;
1208: return false;
1209: }
1210: }
1211:
1212: private static final boolean jjCanMove_1(int hiByte, int i1,
1213: int i2, long l1, long l2) {
1214: switch (hiByte) {
1215: case 0:
1216: return ((jjbitVec4[i2] & l2) != 0L);
1217: case 48:
1218: return ((jjbitVec5[i2] & l2) != 0L);
1219: case 49:
1220: return ((jjbitVec6[i2] & l2) != 0L);
1221: case 51:
1222: return ((jjbitVec7[i2] & l2) != 0L);
1223: case 61:
1224: return ((jjbitVec8[i2] & l2) != 0L);
1225: default:
1226: if ((jjbitVec3[i1] & l1) != 0L)
1227: return true;
1228: return false;
1229: }
1230: }
1231:
1232: public static final String[] jjstrLiteralImages = { "", null,
1233: "\173", "\47", null, null, null, "\175", "\174", null,
1234: null, null, null, null, null, null, null, null, null, null,
1235: null, null, null, null, "\51", null, "\50", "\54", null,
1236: null, null, null, null, null, null, null, null, null, null, };
1237: public static final String[] lexStateNames = { "DEFAULT",
1238: "IN_LITERAL", "IN_EXPRESSION", "IN_SQLFN", "IN_JDBC",
1239: "IN_PARAM", };
1240: public static final int[] jjnewLexState = { -1, -1, 2, 1, 0, -1,
1241: -1, -1, -1, -1, -1, 3, 4, 4, 4, 4, 4, 4, 4, 4, -1, -1, -1,
1242: -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, -1, -1, -1,
1243: -1, };
1244: protected SimpleCharStream input_stream;
1245: private final int[] jjrounds = new int[54];
1246: private final int[] jjstateSet = new int[108];
1247: StringBuffer image;
1248: int jjimageLen;
1249: int lengthOfMatch;
1250: protected char curChar;
1251:
1252: public SqlGrammarTokenManager(SimpleCharStream stream) {
1253: if (SimpleCharStream.staticFlag)
1254: throw new Error(
1255: "ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
1256: input_stream = stream;
1257: }
1258:
1259: public SqlGrammarTokenManager(SimpleCharStream stream, int lexState) {
1260: this (stream);
1261: SwitchTo(lexState);
1262: }
1263:
1264: public void ReInit(SimpleCharStream stream) {
1265: jjmatchedPos = jjnewStateCnt = 0;
1266: curLexState = defaultLexState;
1267: input_stream = stream;
1268: ReInitRounds();
1269: }
1270:
1271: private final void ReInitRounds() {
1272: int i;
1273: jjround = 0x80000001;
1274: for (i = 54; i-- > 0;)
1275: jjrounds[i] = 0x80000000;
1276: }
1277:
1278: public void ReInit(SimpleCharStream stream, int lexState) {
1279: ReInit(stream);
1280: SwitchTo(lexState);
1281: }
1282:
1283: public void SwitchTo(int lexState) {
1284: if (lexState >= 6 || lexState < 0)
1285: throw new TokenMgrError(
1286: "Error: Ignoring invalid lexical state : "
1287: + lexState + ". State unchanged.",
1288: TokenMgrError.INVALID_LEXICAL_STATE);
1289: else
1290: curLexState = lexState;
1291: }
1292:
1293: protected Token jjFillToken() {
1294: Token t = Token.newToken(jjmatchedKind);
1295: t.kind = jjmatchedKind;
1296: String im = jjstrLiteralImages[jjmatchedKind];
1297: t.image = (im == null) ? input_stream.GetImage() : im;
1298: t.beginLine = input_stream.getBeginLine();
1299: t.beginColumn = input_stream.getBeginColumn();
1300: t.endLine = input_stream.getEndLine();
1301: t.endColumn = input_stream.getEndColumn();
1302: return t;
1303: }
1304:
1305: int curLexState = 0;
1306: int defaultLexState = 0;
1307: int jjnewStateCnt;
1308: int jjround;
1309: int jjmatchedPos;
1310: int jjmatchedKind;
1311:
1312: public Token getNextToken() {
1313: int kind;
1314: Token specialToken = null;
1315: Token matchedToken;
1316: int curPos = 0;
1317:
1318: EOFLoop: for (;;) {
1319: try {
1320: curChar = input_stream.BeginToken();
1321: } catch (java.io.IOException e) {
1322: jjmatchedKind = 0;
1323: matchedToken = jjFillToken();
1324: return matchedToken;
1325: }
1326: image = null;
1327: jjimageLen = 0;
1328:
1329: switch (curLexState) {
1330: case 0:
1331: jjmatchedKind = 0x7fffffff;
1332: jjmatchedPos = 0;
1333: curPos = jjMoveStringLiteralDfa0_0();
1334: break;
1335: case 1:
1336: jjmatchedKind = 0x7fffffff;
1337: jjmatchedPos = 0;
1338: curPos = jjMoveStringLiteralDfa0_1();
1339: break;
1340: case 2:
1341: jjmatchedKind = 0x7fffffff;
1342: jjmatchedPos = 0;
1343: curPos = jjMoveStringLiteralDfa0_2();
1344: break;
1345: case 3:
1346: jjmatchedKind = 0x7fffffff;
1347: jjmatchedPos = 0;
1348: curPos = jjMoveStringLiteralDfa0_3();
1349: break;
1350: case 4:
1351: jjmatchedKind = 0x7fffffff;
1352: jjmatchedPos = 0;
1353: curPos = jjMoveStringLiteralDfa0_4();
1354: break;
1355: case 5:
1356: jjmatchedKind = 0x7fffffff;
1357: jjmatchedPos = 0;
1358: curPos = jjMoveStringLiteralDfa0_5();
1359: break;
1360: }
1361: if (jjmatchedKind != 0x7fffffff) {
1362: if (jjmatchedPos + 1 < curPos)
1363: input_stream.backup(curPos - jjmatchedPos - 1);
1364: matchedToken = jjFillToken();
1365: TokenLexicalActions(matchedToken);
1366: if (jjnewLexState[jjmatchedKind] != -1)
1367: curLexState = jjnewLexState[jjmatchedKind];
1368: return matchedToken;
1369: }
1370: int error_line = input_stream.getEndLine();
1371: int error_column = input_stream.getEndColumn();
1372: String error_after = null;
1373: boolean EOFSeen = false;
1374: try {
1375: input_stream.readChar();
1376: input_stream.backup(1);
1377: } catch (java.io.IOException e1) {
1378: EOFSeen = true;
1379: error_after = curPos <= 1 ? "" : input_stream
1380: .GetImage();
1381: if (curChar == '\n' || curChar == '\r') {
1382: error_line++;
1383: error_column = 0;
1384: } else
1385: error_column++;
1386: }
1387: if (!EOFSeen) {
1388: input_stream.backup(1);
1389: error_after = curPos <= 1 ? "" : input_stream
1390: .GetImage();
1391: }
1392: throw new TokenMgrError(EOFSeen, curLexState, error_line,
1393: error_column, error_after, curChar,
1394: TokenMgrError.LEXICAL_ERROR);
1395: }
1396: }
1397:
1398: void TokenLexicalActions(Token matchedToken) {
1399: switch (jjmatchedKind) {
1400: case 7:
1401: if (image == null)
1402: image = new StringBuffer(jjstrLiteralImages[7]);
1403: else
1404: image.append(jjstrLiteralImages[7]);
1405: SwitchTo(DEFAULT);
1406: break;
1407: case 32:
1408: if (image == null)
1409: image = new StringBuffer(new String(input_stream
1410: .GetSuffix(jjimageLen
1411: + (lengthOfMatch = jjmatchedPos + 1))));
1412: else
1413: image.append(new String(input_stream
1414: .GetSuffix(jjimageLen
1415: + (lengthOfMatch = jjmatchedPos + 1))));
1416: SwitchTo(DEFAULT);
1417: break;
1418: case 38:
1419: if (image == null)
1420: image = new StringBuffer(new String(input_stream
1421: .GetSuffix(jjimageLen
1422: + (lengthOfMatch = jjmatchedPos + 1))));
1423: else
1424: image.append(new String(input_stream
1425: .GetSuffix(jjimageLen
1426: + (lengthOfMatch = jjmatchedPos + 1))));
1427: SwitchTo(IN_JDBC);
1428: break;
1429: default:
1430: break;
1431: }
1432: }
1433: }
|