0001: /* Generated By:JavaCC: Do not edit this line. QueryParserTokenManager.java */
0002: package org.apache.lucene.queryParser;
0003:
0004: import java.util.Vector;
0005: import java.io.*;
0006: import java.text.*;
0007: import java.util.*;
0008: import org.apache.lucene.index.Term;
0009: import org.apache.lucene.analysis.*;
0010: import org.apache.lucene.document.*;
0011: import org.apache.lucene.search.*;
0012: import org.apache.lucene.util.Parameter;
0013:
0014: public class QueryParserTokenManager implements QueryParserConstants {
0015: public java.io.PrintStream debugStream = System.out;
0016:
0017: public void setDebugStream(java.io.PrintStream ds) {
0018: debugStream = ds;
0019: }
0020:
0021: private final int jjStopStringLiteralDfa_3(int pos, long active0) {
0022: switch (pos) {
0023: default:
0024: return -1;
0025: }
0026: }
0027:
0028: private final int jjStartNfa_3(int pos, long active0) {
0029: return jjMoveNfa_3(jjStopStringLiteralDfa_3(pos, active0),
0030: pos + 1);
0031: }
0032:
0033: private final int jjStopAtPos(int pos, int kind) {
0034: jjmatchedKind = kind;
0035: jjmatchedPos = pos;
0036: return pos + 1;
0037: }
0038:
0039: private final int jjStartNfaWithStates_3(int pos, int kind,
0040: int state) {
0041: jjmatchedKind = kind;
0042: jjmatchedPos = pos;
0043: try {
0044: curChar = input_stream.readChar();
0045: } catch (java.io.IOException e) {
0046: return pos + 1;
0047: }
0048: return jjMoveNfa_3(state, pos + 1);
0049: }
0050:
0051: private final int jjMoveStringLiteralDfa0_3() {
0052: switch (curChar) {
0053: case 40:
0054: return jjStopAtPos(0, 12);
0055: case 41:
0056: return jjStopAtPos(0, 13);
0057: case 42:
0058: return jjStartNfaWithStates_3(0, 15, 36);
0059: case 43:
0060: return jjStopAtPos(0, 10);
0061: case 45:
0062: return jjStopAtPos(0, 11);
0063: case 58:
0064: return jjStopAtPos(0, 14);
0065: case 91:
0066: return jjStopAtPos(0, 22);
0067: case 94:
0068: return jjStopAtPos(0, 16);
0069: case 123:
0070: return jjStopAtPos(0, 23);
0071: default:
0072: return jjMoveNfa_3(0, 0);
0073: }
0074: }
0075:
0076: private final void jjCheckNAdd(int state) {
0077: if (jjrounds[state] != jjround) {
0078: jjstateSet[jjnewStateCnt++] = state;
0079: jjrounds[state] = jjround;
0080: }
0081: }
0082:
0083: private final void jjAddStates(int start, int end) {
0084: do {
0085: jjstateSet[jjnewStateCnt++] = jjnextStates[start];
0086: } while (start++ != end);
0087: }
0088:
0089: private final void jjCheckNAddTwoStates(int state1, int state2) {
0090: jjCheckNAdd(state1);
0091: jjCheckNAdd(state2);
0092: }
0093:
0094: private final void jjCheckNAddStates(int start, int end) {
0095: do {
0096: jjCheckNAdd(jjnextStates[start]);
0097: } while (start++ != end);
0098: }
0099:
0100: private final void jjCheckNAddStates(int start) {
0101: jjCheckNAdd(jjnextStates[start]);
0102: jjCheckNAdd(jjnextStates[start + 1]);
0103: }
0104:
0105: static final long[] jjbitVec0 = { 0xfffffffffffffffeL,
0106: 0xffffffffffffffffL, 0xffffffffffffffffL,
0107: 0xffffffffffffffffL };
0108: static final long[] jjbitVec2 = { 0x0L, 0x0L, 0xffffffffffffffffL,
0109: 0xffffffffffffffffL };
0110:
0111: private final int jjMoveNfa_3(int startState, int curPos) {
0112: int[] nextStates;
0113: int startsAt = 0;
0114: jjnewStateCnt = 36;
0115: int i = 1;
0116: jjstateSet[0] = startState;
0117: int j, kind = 0x7fffffff;
0118: for (;;) {
0119: if (++jjround == 0x7fffffff)
0120: ReInitRounds();
0121: if (curChar < 64) {
0122: long l = 1L << curChar;
0123: MatchLoop: do {
0124: switch (jjstateSet[--i]) {
0125: case 36:
0126: case 25:
0127: if ((0xfbfffcf8ffffd9ffL & l) == 0L)
0128: break;
0129: if (kind > 21)
0130: kind = 21;
0131: jjCheckNAddTwoStates(25, 26);
0132: break;
0133: case 0:
0134: if ((0xfbffd4f8ffffd9ffL & l) != 0L) {
0135: if (kind > 21)
0136: kind = 21;
0137: jjCheckNAddTwoStates(25, 26);
0138: } else if ((0x100002600L & l) != 0L) {
0139: if (kind > 6)
0140: kind = 6;
0141: } else if (curChar == 34)
0142: jjCheckNAddStates(0, 2);
0143: else if (curChar == 33) {
0144: if (kind > 9)
0145: kind = 9;
0146: }
0147: if ((0x7bffd0f8ffffd9ffL & l) != 0L) {
0148: if (kind > 18)
0149: kind = 18;
0150: jjCheckNAddStates(3, 7);
0151: } else if (curChar == 42) {
0152: if (kind > 20)
0153: kind = 20;
0154: }
0155: if (curChar == 38)
0156: jjstateSet[jjnewStateCnt++] = 4;
0157: break;
0158: case 4:
0159: if (curChar == 38 && kind > 7)
0160: kind = 7;
0161: break;
0162: case 5:
0163: if (curChar == 38)
0164: jjstateSet[jjnewStateCnt++] = 4;
0165: break;
0166: case 13:
0167: if (curChar == 33 && kind > 9)
0168: kind = 9;
0169: break;
0170: case 14:
0171: case 16:
0172: if (curChar == 34)
0173: jjCheckNAddStates(0, 2);
0174: break;
0175: case 15:
0176: if ((0xfffffffbffffffffL & l) != 0L)
0177: jjCheckNAddStates(0, 2);
0178: break;
0179: case 18:
0180: if (curChar == 34 && kind > 17)
0181: kind = 17;
0182: break;
0183: case 20:
0184: if ((0x3ff000000000000L & l) == 0L)
0185: break;
0186: if (kind > 19)
0187: kind = 19;
0188: jjAddStates(8, 9);
0189: break;
0190: case 21:
0191: if (curChar == 46)
0192: jjCheckNAdd(22);
0193: break;
0194: case 22:
0195: if ((0x3ff000000000000L & l) == 0L)
0196: break;
0197: if (kind > 19)
0198: kind = 19;
0199: jjCheckNAdd(22);
0200: break;
0201: case 23:
0202: if (curChar == 42 && kind > 20)
0203: kind = 20;
0204: break;
0205: case 24:
0206: if ((0xfbffd4f8ffffd9ffL & l) == 0L)
0207: break;
0208: if (kind > 21)
0209: kind = 21;
0210: jjCheckNAddTwoStates(25, 26);
0211: break;
0212: case 27:
0213: if (kind > 21)
0214: kind = 21;
0215: jjCheckNAddTwoStates(25, 26);
0216: break;
0217: case 28:
0218: if ((0x7bffd0f8ffffd9ffL & l) == 0L)
0219: break;
0220: if (kind > 18)
0221: kind = 18;
0222: jjCheckNAddStates(3, 7);
0223: break;
0224: case 29:
0225: if ((0x7bfff8f8ffffd9ffL & l) == 0L)
0226: break;
0227: if (kind > 18)
0228: kind = 18;
0229: jjCheckNAddTwoStates(29, 30);
0230: break;
0231: case 31:
0232: if (kind > 18)
0233: kind = 18;
0234: jjCheckNAddTwoStates(29, 30);
0235: break;
0236: case 32:
0237: if ((0x7bfff8f8ffffd9ffL & l) != 0L)
0238: jjCheckNAddStates(10, 12);
0239: break;
0240: case 34:
0241: jjCheckNAddStates(10, 12);
0242: break;
0243: default:
0244: break;
0245: }
0246: } while (i != startsAt);
0247: } else if (curChar < 128) {
0248: long l = 1L << (curChar & 077);
0249: MatchLoop: do {
0250: switch (jjstateSet[--i]) {
0251: case 36:
0252: if ((0x97ffffff87ffffffL & l) != 0L) {
0253: if (kind > 21)
0254: kind = 21;
0255: jjCheckNAddTwoStates(25, 26);
0256: } else if (curChar == 92)
0257: jjCheckNAddTwoStates(27, 27);
0258: break;
0259: case 0:
0260: if ((0x97ffffff87ffffffL & l) != 0L) {
0261: if (kind > 18)
0262: kind = 18;
0263: jjCheckNAddStates(3, 7);
0264: } else if (curChar == 92)
0265: jjCheckNAddStates(13, 15);
0266: else if (curChar == 126) {
0267: if (kind > 19)
0268: kind = 19;
0269: jjstateSet[jjnewStateCnt++] = 20;
0270: }
0271: if ((0x97ffffff87ffffffL & l) != 0L) {
0272: if (kind > 21)
0273: kind = 21;
0274: jjCheckNAddTwoStates(25, 26);
0275: }
0276: if (curChar == 78)
0277: jjstateSet[jjnewStateCnt++] = 11;
0278: else if (curChar == 124)
0279: jjstateSet[jjnewStateCnt++] = 8;
0280: else if (curChar == 79)
0281: jjstateSet[jjnewStateCnt++] = 6;
0282: else if (curChar == 65)
0283: jjstateSet[jjnewStateCnt++] = 2;
0284: break;
0285: case 1:
0286: if (curChar == 68 && kind > 7)
0287: kind = 7;
0288: break;
0289: case 2:
0290: if (curChar == 78)
0291: jjstateSet[jjnewStateCnt++] = 1;
0292: break;
0293: case 3:
0294: if (curChar == 65)
0295: jjstateSet[jjnewStateCnt++] = 2;
0296: break;
0297: case 6:
0298: if (curChar == 82 && kind > 8)
0299: kind = 8;
0300: break;
0301: case 7:
0302: if (curChar == 79)
0303: jjstateSet[jjnewStateCnt++] = 6;
0304: break;
0305: case 8:
0306: if (curChar == 124 && kind > 8)
0307: kind = 8;
0308: break;
0309: case 9:
0310: if (curChar == 124)
0311: jjstateSet[jjnewStateCnt++] = 8;
0312: break;
0313: case 10:
0314: if (curChar == 84 && kind > 9)
0315: kind = 9;
0316: break;
0317: case 11:
0318: if (curChar == 79)
0319: jjstateSet[jjnewStateCnt++] = 10;
0320: break;
0321: case 12:
0322: if (curChar == 78)
0323: jjstateSet[jjnewStateCnt++] = 11;
0324: break;
0325: case 15:
0326: jjAddStates(0, 2);
0327: break;
0328: case 17:
0329: if (curChar == 92)
0330: jjstateSet[jjnewStateCnt++] = 16;
0331: break;
0332: case 19:
0333: if (curChar != 126)
0334: break;
0335: if (kind > 19)
0336: kind = 19;
0337: jjstateSet[jjnewStateCnt++] = 20;
0338: break;
0339: case 24:
0340: if ((0x97ffffff87ffffffL & l) == 0L)
0341: break;
0342: if (kind > 21)
0343: kind = 21;
0344: jjCheckNAddTwoStates(25, 26);
0345: break;
0346: case 25:
0347: if ((0x97ffffff87ffffffL & l) == 0L)
0348: break;
0349: if (kind > 21)
0350: kind = 21;
0351: jjCheckNAddTwoStates(25, 26);
0352: break;
0353: case 26:
0354: if (curChar == 92)
0355: jjCheckNAddTwoStates(27, 27);
0356: break;
0357: case 27:
0358: if (kind > 21)
0359: kind = 21;
0360: jjCheckNAddTwoStates(25, 26);
0361: break;
0362: case 28:
0363: if ((0x97ffffff87ffffffL & l) == 0L)
0364: break;
0365: if (kind > 18)
0366: kind = 18;
0367: jjCheckNAddStates(3, 7);
0368: break;
0369: case 29:
0370: if ((0x97ffffff87ffffffL & l) == 0L)
0371: break;
0372: if (kind > 18)
0373: kind = 18;
0374: jjCheckNAddTwoStates(29, 30);
0375: break;
0376: case 30:
0377: if (curChar == 92)
0378: jjCheckNAddTwoStates(31, 31);
0379: break;
0380: case 31:
0381: if (kind > 18)
0382: kind = 18;
0383: jjCheckNAddTwoStates(29, 30);
0384: break;
0385: case 32:
0386: if ((0x97ffffff87ffffffL & l) != 0L)
0387: jjCheckNAddStates(10, 12);
0388: break;
0389: case 33:
0390: if (curChar == 92)
0391: jjCheckNAddTwoStates(34, 34);
0392: break;
0393: case 34:
0394: jjCheckNAddStates(10, 12);
0395: break;
0396: case 35:
0397: if (curChar == 92)
0398: jjCheckNAddStates(13, 15);
0399: break;
0400: default:
0401: break;
0402: }
0403: } while (i != startsAt);
0404: } else {
0405: int hiByte = (int) (curChar >> 8);
0406: int i1 = hiByte >> 6;
0407: long l1 = 1L << (hiByte & 077);
0408: int i2 = (curChar & 0xff) >> 6;
0409: long l2 = 1L << (curChar & 077);
0410: MatchLoop: do {
0411: switch (jjstateSet[--i]) {
0412: case 36:
0413: case 25:
0414: case 27:
0415: if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
0416: break;
0417: if (kind > 21)
0418: kind = 21;
0419: jjCheckNAddTwoStates(25, 26);
0420: break;
0421: case 0:
0422: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) {
0423: if (kind > 21)
0424: kind = 21;
0425: jjCheckNAddTwoStates(25, 26);
0426: }
0427: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) {
0428: if (kind > 18)
0429: kind = 18;
0430: jjCheckNAddStates(3, 7);
0431: }
0432: break;
0433: case 15:
0434: if (jjCanMove_0(hiByte, i1, i2, l1, l2))
0435: jjAddStates(0, 2);
0436: break;
0437: case 24:
0438: if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
0439: break;
0440: if (kind > 21)
0441: kind = 21;
0442: jjCheckNAddTwoStates(25, 26);
0443: break;
0444: case 28:
0445: if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
0446: break;
0447: if (kind > 18)
0448: kind = 18;
0449: jjCheckNAddStates(3, 7);
0450: break;
0451: case 29:
0452: case 31:
0453: if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
0454: break;
0455: if (kind > 18)
0456: kind = 18;
0457: jjCheckNAddTwoStates(29, 30);
0458: break;
0459: case 32:
0460: case 34:
0461: if (jjCanMove_0(hiByte, i1, i2, l1, l2))
0462: jjCheckNAddStates(10, 12);
0463: break;
0464: default:
0465: break;
0466: }
0467: } while (i != startsAt);
0468: }
0469: if (kind != 0x7fffffff) {
0470: jjmatchedKind = kind;
0471: jjmatchedPos = curPos;
0472: kind = 0x7fffffff;
0473: }
0474: ++curPos;
0475: if ((i = jjnewStateCnt) == (startsAt = 36 - (jjnewStateCnt = startsAt)))
0476: return curPos;
0477: try {
0478: curChar = input_stream.readChar();
0479: } catch (java.io.IOException e) {
0480: return curPos;
0481: }
0482: }
0483: }
0484:
0485: private final int jjStopStringLiteralDfa_1(int pos, long active0) {
0486: switch (pos) {
0487: case 0:
0488: if ((active0 & 0x20000000L) != 0L) {
0489: jjmatchedKind = 32;
0490: return 6;
0491: }
0492: return -1;
0493: default:
0494: return -1;
0495: }
0496: }
0497:
0498: private final int jjStartNfa_1(int pos, long active0) {
0499: return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0),
0500: pos + 1);
0501: }
0502:
0503: private final int jjStartNfaWithStates_1(int pos, int kind,
0504: int state) {
0505: jjmatchedKind = kind;
0506: jjmatchedPos = pos;
0507: try {
0508: curChar = input_stream.readChar();
0509: } catch (java.io.IOException e) {
0510: return pos + 1;
0511: }
0512: return jjMoveNfa_1(state, pos + 1);
0513: }
0514:
0515: private final int jjMoveStringLiteralDfa0_1() {
0516: switch (curChar) {
0517: case 84:
0518: return jjMoveStringLiteralDfa1_1(0x20000000L);
0519: case 125:
0520: return jjStopAtPos(0, 30);
0521: default:
0522: return jjMoveNfa_1(0, 0);
0523: }
0524: }
0525:
0526: private final int jjMoveStringLiteralDfa1_1(long active0) {
0527: try {
0528: curChar = input_stream.readChar();
0529: } catch (java.io.IOException e) {
0530: jjStopStringLiteralDfa_1(0, active0);
0531: return 1;
0532: }
0533: switch (curChar) {
0534: case 79:
0535: if ((active0 & 0x20000000L) != 0L)
0536: return jjStartNfaWithStates_1(1, 29, 6);
0537: break;
0538: default:
0539: break;
0540: }
0541: return jjStartNfa_1(0, active0);
0542: }
0543:
0544: private final int jjMoveNfa_1(int startState, int curPos) {
0545: int[] nextStates;
0546: int startsAt = 0;
0547: jjnewStateCnt = 7;
0548: int i = 1;
0549: jjstateSet[0] = startState;
0550: int j, kind = 0x7fffffff;
0551: for (;;) {
0552: if (++jjround == 0x7fffffff)
0553: ReInitRounds();
0554: if (curChar < 64) {
0555: long l = 1L << curChar;
0556: MatchLoop: do {
0557: switch (jjstateSet[--i]) {
0558: case 0:
0559: if ((0xfffffffeffffffffL & l) != 0L) {
0560: if (kind > 32)
0561: kind = 32;
0562: jjCheckNAdd(6);
0563: }
0564: if ((0x100002600L & l) != 0L) {
0565: if (kind > 6)
0566: kind = 6;
0567: } else if (curChar == 34)
0568: jjCheckNAddTwoStates(2, 4);
0569: break;
0570: case 1:
0571: if (curChar == 34)
0572: jjCheckNAddTwoStates(2, 4);
0573: break;
0574: case 2:
0575: if ((0xfffffffbffffffffL & l) != 0L)
0576: jjCheckNAddStates(16, 18);
0577: break;
0578: case 3:
0579: if (curChar == 34)
0580: jjCheckNAddStates(16, 18);
0581: break;
0582: case 5:
0583: if (curChar == 34 && kind > 31)
0584: kind = 31;
0585: break;
0586: case 6:
0587: if ((0xfffffffeffffffffL & l) == 0L)
0588: break;
0589: if (kind > 32)
0590: kind = 32;
0591: jjCheckNAdd(6);
0592: break;
0593: default:
0594: break;
0595: }
0596: } while (i != startsAt);
0597: } else if (curChar < 128) {
0598: long l = 1L << (curChar & 077);
0599: MatchLoop: do {
0600: switch (jjstateSet[--i]) {
0601: case 0:
0602: case 6:
0603: if ((0xdfffffffffffffffL & l) == 0L)
0604: break;
0605: if (kind > 32)
0606: kind = 32;
0607: jjCheckNAdd(6);
0608: break;
0609: case 2:
0610: jjAddStates(16, 18);
0611: break;
0612: case 4:
0613: if (curChar == 92)
0614: jjstateSet[jjnewStateCnt++] = 3;
0615: break;
0616: default:
0617: break;
0618: }
0619: } while (i != startsAt);
0620: } else {
0621: int hiByte = (int) (curChar >> 8);
0622: int i1 = hiByte >> 6;
0623: long l1 = 1L << (hiByte & 077);
0624: int i2 = (curChar & 0xff) >> 6;
0625: long l2 = 1L << (curChar & 077);
0626: MatchLoop: do {
0627: switch (jjstateSet[--i]) {
0628: case 0:
0629: case 6:
0630: if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
0631: break;
0632: if (kind > 32)
0633: kind = 32;
0634: jjCheckNAdd(6);
0635: break;
0636: case 2:
0637: if (jjCanMove_0(hiByte, i1, i2, l1, l2))
0638: jjAddStates(16, 18);
0639: break;
0640: default:
0641: break;
0642: }
0643: } while (i != startsAt);
0644: }
0645: if (kind != 0x7fffffff) {
0646: jjmatchedKind = kind;
0647: jjmatchedPos = curPos;
0648: kind = 0x7fffffff;
0649: }
0650: ++curPos;
0651: if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt)))
0652: return curPos;
0653: try {
0654: curChar = input_stream.readChar();
0655: } catch (java.io.IOException e) {
0656: return curPos;
0657: }
0658: }
0659: }
0660:
0661: private final int jjMoveStringLiteralDfa0_0() {
0662: return jjMoveNfa_0(0, 0);
0663: }
0664:
0665: private final int jjMoveNfa_0(int startState, int curPos) {
0666: int[] nextStates;
0667: int startsAt = 0;
0668: jjnewStateCnt = 3;
0669: int i = 1;
0670: jjstateSet[0] = startState;
0671: int j, kind = 0x7fffffff;
0672: for (;;) {
0673: if (++jjround == 0x7fffffff)
0674: ReInitRounds();
0675: if (curChar < 64) {
0676: long l = 1L << curChar;
0677: MatchLoop: do {
0678: switch (jjstateSet[--i]) {
0679: case 0:
0680: if ((0x3ff000000000000L & l) == 0L)
0681: break;
0682: if (kind > 24)
0683: kind = 24;
0684: jjAddStates(19, 20);
0685: break;
0686: case 1:
0687: if (curChar == 46)
0688: jjCheckNAdd(2);
0689: break;
0690: case 2:
0691: if ((0x3ff000000000000L & l) == 0L)
0692: break;
0693: if (kind > 24)
0694: kind = 24;
0695: jjCheckNAdd(2);
0696: break;
0697: default:
0698: break;
0699: }
0700: } while (i != startsAt);
0701: } else if (curChar < 128) {
0702: long l = 1L << (curChar & 077);
0703: MatchLoop: do {
0704: switch (jjstateSet[--i]) {
0705: default:
0706: break;
0707: }
0708: } while (i != startsAt);
0709: } else {
0710: int hiByte = (int) (curChar >> 8);
0711: int i1 = hiByte >> 6;
0712: long l1 = 1L << (hiByte & 077);
0713: int i2 = (curChar & 0xff) >> 6;
0714: long l2 = 1L << (curChar & 077);
0715: MatchLoop: do {
0716: switch (jjstateSet[--i]) {
0717: default:
0718: break;
0719: }
0720: } while (i != startsAt);
0721: }
0722: if (kind != 0x7fffffff) {
0723: jjmatchedKind = kind;
0724: jjmatchedPos = curPos;
0725: kind = 0x7fffffff;
0726: }
0727: ++curPos;
0728: if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt)))
0729: return curPos;
0730: try {
0731: curChar = input_stream.readChar();
0732: } catch (java.io.IOException e) {
0733: return curPos;
0734: }
0735: }
0736: }
0737:
0738: private final int jjStopStringLiteralDfa_2(int pos, long active0) {
0739: switch (pos) {
0740: case 0:
0741: if ((active0 & 0x2000000L) != 0L) {
0742: jjmatchedKind = 28;
0743: return 6;
0744: }
0745: return -1;
0746: default:
0747: return -1;
0748: }
0749: }
0750:
0751: private final int jjStartNfa_2(int pos, long active0) {
0752: return jjMoveNfa_2(jjStopStringLiteralDfa_2(pos, active0),
0753: pos + 1);
0754: }
0755:
0756: private final int jjStartNfaWithStates_2(int pos, int kind,
0757: int state) {
0758: jjmatchedKind = kind;
0759: jjmatchedPos = pos;
0760: try {
0761: curChar = input_stream.readChar();
0762: } catch (java.io.IOException e) {
0763: return pos + 1;
0764: }
0765: return jjMoveNfa_2(state, pos + 1);
0766: }
0767:
0768: private final int jjMoveStringLiteralDfa0_2() {
0769: switch (curChar) {
0770: case 84:
0771: return jjMoveStringLiteralDfa1_2(0x2000000L);
0772: case 93:
0773: return jjStopAtPos(0, 26);
0774: default:
0775: return jjMoveNfa_2(0, 0);
0776: }
0777: }
0778:
0779: private final int jjMoveStringLiteralDfa1_2(long active0) {
0780: try {
0781: curChar = input_stream.readChar();
0782: } catch (java.io.IOException e) {
0783: jjStopStringLiteralDfa_2(0, active0);
0784: return 1;
0785: }
0786: switch (curChar) {
0787: case 79:
0788: if ((active0 & 0x2000000L) != 0L)
0789: return jjStartNfaWithStates_2(1, 25, 6);
0790: break;
0791: default:
0792: break;
0793: }
0794: return jjStartNfa_2(0, active0);
0795: }
0796:
0797: private final int jjMoveNfa_2(int startState, int curPos) {
0798: int[] nextStates;
0799: int startsAt = 0;
0800: jjnewStateCnt = 7;
0801: int i = 1;
0802: jjstateSet[0] = startState;
0803: int j, kind = 0x7fffffff;
0804: for (;;) {
0805: if (++jjround == 0x7fffffff)
0806: ReInitRounds();
0807: if (curChar < 64) {
0808: long l = 1L << curChar;
0809: MatchLoop: do {
0810: switch (jjstateSet[--i]) {
0811: case 0:
0812: if ((0xfffffffeffffffffL & l) != 0L) {
0813: if (kind > 28)
0814: kind = 28;
0815: jjCheckNAdd(6);
0816: }
0817: if ((0x100002600L & l) != 0L) {
0818: if (kind > 6)
0819: kind = 6;
0820: } else if (curChar == 34)
0821: jjCheckNAddTwoStates(2, 4);
0822: break;
0823: case 1:
0824: if (curChar == 34)
0825: jjCheckNAddTwoStates(2, 4);
0826: break;
0827: case 2:
0828: if ((0xfffffffbffffffffL & l) != 0L)
0829: jjCheckNAddStates(16, 18);
0830: break;
0831: case 3:
0832: if (curChar == 34)
0833: jjCheckNAddStates(16, 18);
0834: break;
0835: case 5:
0836: if (curChar == 34 && kind > 27)
0837: kind = 27;
0838: break;
0839: case 6:
0840: if ((0xfffffffeffffffffL & l) == 0L)
0841: break;
0842: if (kind > 28)
0843: kind = 28;
0844: jjCheckNAdd(6);
0845: break;
0846: default:
0847: break;
0848: }
0849: } while (i != startsAt);
0850: } else if (curChar < 128) {
0851: long l = 1L << (curChar & 077);
0852: MatchLoop: do {
0853: switch (jjstateSet[--i]) {
0854: case 0:
0855: case 6:
0856: if ((0xffffffffdfffffffL & l) == 0L)
0857: break;
0858: if (kind > 28)
0859: kind = 28;
0860: jjCheckNAdd(6);
0861: break;
0862: case 2:
0863: jjAddStates(16, 18);
0864: break;
0865: case 4:
0866: if (curChar == 92)
0867: jjstateSet[jjnewStateCnt++] = 3;
0868: break;
0869: default:
0870: break;
0871: }
0872: } while (i != startsAt);
0873: } else {
0874: int hiByte = (int) (curChar >> 8);
0875: int i1 = hiByte >> 6;
0876: long l1 = 1L << (hiByte & 077);
0877: int i2 = (curChar & 0xff) >> 6;
0878: long l2 = 1L << (curChar & 077);
0879: MatchLoop: do {
0880: switch (jjstateSet[--i]) {
0881: case 0:
0882: case 6:
0883: if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
0884: break;
0885: if (kind > 28)
0886: kind = 28;
0887: jjCheckNAdd(6);
0888: break;
0889: case 2:
0890: if (jjCanMove_0(hiByte, i1, i2, l1, l2))
0891: jjAddStates(16, 18);
0892: break;
0893: default:
0894: break;
0895: }
0896: } while (i != startsAt);
0897: }
0898: if (kind != 0x7fffffff) {
0899: jjmatchedKind = kind;
0900: jjmatchedPos = curPos;
0901: kind = 0x7fffffff;
0902: }
0903: ++curPos;
0904: if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt)))
0905: return curPos;
0906: try {
0907: curChar = input_stream.readChar();
0908: } catch (java.io.IOException e) {
0909: return curPos;
0910: }
0911: }
0912: }
0913:
0914: static final int[] jjnextStates = { 15, 17, 18, 29, 32, 23, 33, 30,
0915: 20, 21, 32, 23, 33, 31, 34, 27, 2, 4, 5, 0, 1, };
0916:
0917: private static final boolean jjCanMove_0(int hiByte, int i1,
0918: int i2, long l1, long l2) {
0919: switch (hiByte) {
0920: case 0:
0921: return ((jjbitVec2[i2] & l2) != 0L);
0922: default:
0923: if ((jjbitVec0[i1] & l1) != 0L)
0924: return true;
0925: return false;
0926: }
0927: }
0928:
0929: public static final String[] jjstrLiteralImages = { "", null, null,
0930: null, null, null, null, null, null, null, "\53", "\55",
0931: "\50", "\51", "\72", "\52", "\136", null, null, null, null,
0932: null, "\133", "\173", null, "\124\117", "\135", null, null,
0933: "\124\117", "\175", null, null, };
0934: public static final String[] lexStateNames = { "Boost", "RangeEx",
0935: "RangeIn", "DEFAULT", };
0936: public static final int[] jjnewLexState = { -1, -1, -1, -1, -1, -1,
0937: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1,
0938: -1, 2, 1, 3, -1, 3, -1, -1, -1, 3, -1, -1, };
0939: static final long[] jjtoToken = { 0x1ffffff81L, };
0940: static final long[] jjtoSkip = { 0x40L, };
0941: protected CharStream input_stream;
0942: private final int[] jjrounds = new int[36];
0943: private final int[] jjstateSet = new int[72];
0944: protected char curChar;
0945:
0946: public QueryParserTokenManager(CharStream stream) {
0947: input_stream = stream;
0948: }
0949:
0950: public QueryParserTokenManager(CharStream stream, int lexState) {
0951: this (stream);
0952: SwitchTo(lexState);
0953: }
0954:
0955: public void ReInit(CharStream stream) {
0956: jjmatchedPos = jjnewStateCnt = 0;
0957: curLexState = defaultLexState;
0958: input_stream = stream;
0959: ReInitRounds();
0960: }
0961:
0962: private final void ReInitRounds() {
0963: int i;
0964: jjround = 0x80000001;
0965: for (i = 36; i-- > 0;)
0966: jjrounds[i] = 0x80000000;
0967: }
0968:
0969: public void ReInit(CharStream stream, int lexState) {
0970: ReInit(stream);
0971: SwitchTo(lexState);
0972: }
0973:
0974: public void SwitchTo(int lexState) {
0975: if (lexState >= 4 || lexState < 0)
0976: throw new TokenMgrError(
0977: "Error: Ignoring invalid lexical state : "
0978: + lexState + ". State unchanged.",
0979: TokenMgrError.INVALID_LEXICAL_STATE);
0980: else
0981: curLexState = lexState;
0982: }
0983:
0984: protected Token jjFillToken() {
0985: Token t = Token.newToken(jjmatchedKind);
0986: t.kind = jjmatchedKind;
0987: String im = jjstrLiteralImages[jjmatchedKind];
0988: t.image = (im == null) ? input_stream.GetImage() : im;
0989: t.beginLine = input_stream.getBeginLine();
0990: t.beginColumn = input_stream.getBeginColumn();
0991: t.endLine = input_stream.getEndLine();
0992: t.endColumn = input_stream.getEndColumn();
0993: return t;
0994: }
0995:
0996: int curLexState = 3;
0997: int defaultLexState = 3;
0998: int jjnewStateCnt;
0999: int jjround;
1000: int jjmatchedPos;
1001: int jjmatchedKind;
1002:
1003: public Token getNextToken() {
1004: int kind;
1005: Token specialToken = null;
1006: Token matchedToken;
1007: int curPos = 0;
1008:
1009: EOFLoop: for (;;) {
1010: try {
1011: curChar = input_stream.BeginToken();
1012: } catch (java.io.IOException e) {
1013: jjmatchedKind = 0;
1014: matchedToken = jjFillToken();
1015: return matchedToken;
1016: }
1017:
1018: switch (curLexState) {
1019: case 0:
1020: jjmatchedKind = 0x7fffffff;
1021: jjmatchedPos = 0;
1022: curPos = jjMoveStringLiteralDfa0_0();
1023: break;
1024: case 1:
1025: jjmatchedKind = 0x7fffffff;
1026: jjmatchedPos = 0;
1027: curPos = jjMoveStringLiteralDfa0_1();
1028: break;
1029: case 2:
1030: jjmatchedKind = 0x7fffffff;
1031: jjmatchedPos = 0;
1032: curPos = jjMoveStringLiteralDfa0_2();
1033: break;
1034: case 3:
1035: jjmatchedKind = 0x7fffffff;
1036: jjmatchedPos = 0;
1037: curPos = jjMoveStringLiteralDfa0_3();
1038: break;
1039: }
1040: if (jjmatchedKind != 0x7fffffff) {
1041: if (jjmatchedPos + 1 < curPos)
1042: input_stream.backup(curPos - jjmatchedPos - 1);
1043: if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) {
1044: matchedToken = jjFillToken();
1045: if (jjnewLexState[jjmatchedKind] != -1)
1046: curLexState = jjnewLexState[jjmatchedKind];
1047: return matchedToken;
1048: } else {
1049: if (jjnewLexState[jjmatchedKind] != -1)
1050: curLexState = jjnewLexState[jjmatchedKind];
1051: continue EOFLoop;
1052: }
1053: }
1054: int error_line = input_stream.getEndLine();
1055: int error_column = input_stream.getEndColumn();
1056: String error_after = null;
1057: boolean EOFSeen = false;
1058: try {
1059: input_stream.readChar();
1060: input_stream.backup(1);
1061: } catch (java.io.IOException e1) {
1062: EOFSeen = true;
1063: error_after = curPos <= 1 ? "" : input_stream
1064: .GetImage();
1065: if (curChar == '\n' || curChar == '\r') {
1066: error_line++;
1067: error_column = 0;
1068: } else
1069: error_column++;
1070: }
1071: if (!EOFSeen) {
1072: input_stream.backup(1);
1073: error_after = curPos <= 1 ? "" : input_stream
1074: .GetImage();
1075: }
1076: throw new TokenMgrError(EOFSeen, curLexState, error_line,
1077: error_column, error_after, curChar,
1078: TokenMgrError.LEXICAL_ERROR);
1079: }
1080: }
1081:
1082: }
|