20 namespace Lucene.Net.QueryParsers
26 private void InitBlock()
28 System.IO.StreamWriter temp_writer;
29 temp_writer =
new System.IO.StreamWriter(System.Console.OpenStandardOutput(), System.Console.Out.Encoding);
30 temp_writer.AutoFlush =
true;
31 debugStream = temp_writer;
37 public virtual void SetDebugStream(System.IO.StreamWriter ds)
41 private int JjStopStringLiteralDfa_3(
int pos,
long active0)
51 private int JjStartNfa_3(
int pos,
long active0)
53 return JjMoveNfa_3(JjStopStringLiteralDfa_3(pos, active0), pos + 1);
55 private int JjStopAtPos(
int pos,
int kind)
61 private int JjMoveStringLiteralDfa0_3()
67 return JjStopAtPos(0, 13);
70 return JjStopAtPos(0, 14);
73 return JjStartNfaWithStates_3(0, 16, 36);
76 return JjStopAtPos(0, 11);
79 return JjStopAtPos(0, 12);
82 return JjStopAtPos(0, 15);
85 return JjStopAtPos(0, 23);
88 return JjStopAtPos(0, 17);
91 return JjStopAtPos(0, 24);
94 return JjMoveNfa_3(0, 0);
98 private int JjStartNfaWithStates_3(
int pos,
int kind,
int state)
100 jjmatchedKind = kind;
104 curChar = input_stream.ReadChar();
106 catch (System.IO.IOException)
110 return JjMoveNfa_3(state, pos + 1);
112 internal static readonly ulong[] jjbitVec0 =
new ulong[]{0x1L, 0x0L, 0x0L, 0x0L};
113 internal static readonly ulong[] jjbitVec1 =
new ulong[]{0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL};
114 internal static readonly ulong[] jjbitVec3 =
new ulong[]{0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL};
115 internal static readonly ulong[] jjbitVec4 =
new ulong[]{0xfffefffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL};
116 private int JjMoveNfa_3(
int startState,
int curPos)
121 jjstateSet[0] = startState;
122 int kind = 0x7fffffff;
125 if (++jjround == 0x7fffffff)
129 ulong l = (ulong) (1L << (
int) curChar);
132 switch (jjstateSet[--i])
137 if ((0xfbfffcf8ffffd9ffL & l) == (ulong) 0L)
141 JjCheckNAddTwoStates(25, 26);
145 if ((0xfbffd4f8ffffd9ffL & l) != (ulong) 0L)
149 JjCheckNAddTwoStates(25, 26);
151 else if ((0x100002600L & l) != 0L)
156 else if (curChar == 34)
157 JjCheckNAddStates(0, 2);
158 else if (curChar == 33)
163 if ((0x7bffd0f8ffffd9ffL & l) != 0L)
167 JjCheckNAddStates(3, 7);
169 else if (curChar == 42)
175 jjstateSet[jjnewStateCnt++] = 4;
179 if (curChar == 38 && kind > 8)
185 jjstateSet[jjnewStateCnt++] = 4;
189 if (curChar == 33 && kind > 10)
195 JjCheckNAddStates(0, 2);
199 if ((0xfffffffbffffffffL & l) != (ulong) 0L)
200 JjCheckNAddStates(0, 2);
204 JjCheckNAddStates(0, 2);
208 if (curChar == 34 && kind > 18)
213 if ((0x3ff000000000000L & l) == 0L)
226 if ((0x3ff000000000000L & l) == 0L)
234 if (curChar == 42 && kind > 21)
239 if ((0xfbffd4f8ffffd9ffL & l) == (ulong) 0L)
243 JjCheckNAddTwoStates(25, 26);
249 JjCheckNAddTwoStates(25, 26);
253 if ((0x7bffd0f8ffffd9ffL & l) == 0L)
257 JjCheckNAddStates(3, 7);
261 if ((0x7bfff8f8ffffd9ffL & l) == 0L)
265 JjCheckNAddTwoStates(29, 30);
271 JjCheckNAddTwoStates(29, 30);
275 if ((0x7bfff8f8ffffd9ffL & l) != 0L)
276 JjCheckNAddStates(10, 12);
280 JjCheckNAddStates(10, 12);
287 while (i != startsAt);
289 else if (curChar < 128)
291 ulong l = (ulong) (1L << (curChar & 63));
294 switch (jjstateSet[--i])
298 if ((0x97ffffff87ffffffL & l) != (ulong) 0L)
302 JjCheckNAddTwoStates(25, 26);
304 else if (curChar == 92)
305 JjCheckNAddTwoStates(27, 27);
309 if ((0x97ffffff87ffffffL & l) != (ulong) 0L)
313 JjCheckNAddStates(3, 7);
315 else if (curChar == 92)
316 JjCheckNAddStates(13, 15);
317 else if (curChar == 126)
321 jjstateSet[jjnewStateCnt++] = 20;
323 if ((0x97ffffff87ffffffL & l) != (ulong) 0L)
327 JjCheckNAddTwoStates(25, 26);
330 jjstateSet[jjnewStateCnt++] = 11;
331 else if (curChar == 124)
332 jjstateSet[jjnewStateCnt++] = 8;
333 else if (curChar == 79)
334 jjstateSet[jjnewStateCnt++] = 6;
335 else if (curChar == 65)
336 jjstateSet[jjnewStateCnt++] = 2;
340 if (curChar == 68 && kind > 8)
346 jjstateSet[jjnewStateCnt++] = 1;
351 jjstateSet[jjnewStateCnt++] = 2;
355 if (curChar == 82 && kind > 9)
361 jjstateSet[jjnewStateCnt++] = 6;
365 if (curChar == 124 && kind > 9)
371 jjstateSet[jjnewStateCnt++] = 8;
375 if (curChar == 84 && kind > 10)
381 jjstateSet[jjnewStateCnt++] = 10;
386 jjstateSet[jjnewStateCnt++] = 11;
390 if ((0xffffffffefffffffL & l) != (ulong) 0L)
391 JjCheckNAddStates(0, 2);
396 jjstateSet[jjnewStateCnt++] = 17;
400 JjCheckNAddStates(0, 2);
408 jjstateSet[jjnewStateCnt++] = 20;
412 if ((0x97ffffff87ffffffL & l) == (ulong) 0L)
416 JjCheckNAddTwoStates(25, 26);
420 if ((0x97ffffff87ffffffL & l) == (ulong) 0L)
424 JjCheckNAddTwoStates(25, 26);
429 JjCheckNAddTwoStates(27, 27);
435 JjCheckNAddTwoStates(25, 26);
439 if ((0x97ffffff87ffffffL & l) == (ulong) 0L)
443 JjCheckNAddStates(3, 7);
447 if ((0x97ffffff87ffffffL & l) == (ulong) 0L)
451 JjCheckNAddTwoStates(29, 30);
456 JjCheckNAddTwoStates(31, 31);
462 JjCheckNAddTwoStates(29, 30);
466 if ((0x97ffffff87ffffffL & l) != (ulong) 0L)
467 JjCheckNAddStates(10, 12);
472 JjCheckNAddTwoStates(34, 34);
476 JjCheckNAddStates(10, 12);
481 JjCheckNAddStates(13, 15);
488 while (i != startsAt);
492 int hiByte = (int) (curChar >> 8);
493 int i1 = hiByte >> 6;
494 ulong l1 = (ulong) (1L << (hiByte & 63));
495 int i2 = (curChar & 0xff) >> 6;
496 ulong l2 = (ulong) (1L << (curChar & 63));
499 switch (jjstateSet[--i])
504 if (!JjCanMove_2(hiByte, i1, i2, l1, l2))
508 JjCheckNAddTwoStates(25, 26);
512 if (JjCanMove_0(hiByte, i1, i2, l1, l2))
517 if (JjCanMove_2(hiByte, i1, i2, l1, l2))
521 JjCheckNAddTwoStates(25, 26);
523 if (JjCanMove_2(hiByte, i1, i2, l1, l2))
527 JjCheckNAddStates(3, 7);
533 if (JjCanMove_1(hiByte, i1, i2, l1, l2))
534 JjCheckNAddStates(0, 2);
538 if (!JjCanMove_2(hiByte, i1, i2, l1, l2))
542 JjCheckNAddTwoStates(25, 26);
546 if (!JjCanMove_1(hiByte, i1, i2, l1, l2))
550 JjCheckNAddTwoStates(25, 26);
554 if (!JjCanMove_2(hiByte, i1, i2, l1, l2))
558 JjCheckNAddStates(3, 7);
562 if (!JjCanMove_2(hiByte, i1, i2, l1, l2))
566 JjCheckNAddTwoStates(29, 30);
570 if (!JjCanMove_1(hiByte, i1, i2, l1, l2))
574 JjCheckNAddTwoStates(29, 30);
578 if (JjCanMove_2(hiByte, i1, i2, l1, l2))
579 JjCheckNAddStates(10, 12);
583 if (JjCanMove_1(hiByte, i1, i2, l1, l2))
584 JjCheckNAddStates(10, 12);
591 while (i != startsAt);
593 if (kind != 0x7fffffff)
595 jjmatchedKind = kind;
596 jjmatchedPos = curPos;
600 if ((i = jjnewStateCnt) == (startsAt = 36 - (jjnewStateCnt = startsAt)))
604 curChar = input_stream.ReadChar();
606 catch (System.IO.IOException)
612 private int JjStopStringLiteralDfa_1(
int pos,
long active0)
618 if ((active0 & 0x40000000L) != 0L)
630 private int JjStartNfa_1(
int pos,
long active0)
632 return JjMoveNfa_1(JjStopStringLiteralDfa_1(pos, active0), pos + 1);
634 private int JjMoveStringLiteralDfa0_1()
640 return JjMoveStringLiteralDfa1_1(0x40000000L);
643 return JjStopAtPos(0, 31);
646 return JjMoveNfa_1(0, 0);
650 private int JjMoveStringLiteralDfa1_1(
long active0)
654 curChar = input_stream.ReadChar();
656 catch (System.IO.IOException)
658 JjStopStringLiteralDfa_1(0, active0);
665 if ((active0 & 0x40000000L) != 0L)
666 return JjStartNfaWithStates_1(1, 30, 6);
673 return JjStartNfa_1(0, active0);
675 private int JjStartNfaWithStates_1(
int pos,
int kind,
int state)
677 jjmatchedKind = kind;
681 curChar = input_stream.ReadChar();
683 catch (System.IO.IOException)
687 return JjMoveNfa_1(state, pos + 1);
689 private int JjMoveNfa_1(
int startState,
int curPos)
694 jjstateSet[0] = startState;
695 int kind = 0x7fffffff;
698 if (++jjround == 0x7fffffff)
702 ulong l = (ulong) (1L << (
int) curChar);
705 switch (jjstateSet[--i])
709 if ((0xfffffffeffffffffL & l) != (ulong) 0L)
715 if ((0x100002600L & l) != 0L)
720 else if (curChar == 34)
721 JjCheckNAddTwoStates(2, 4);
726 JjCheckNAddTwoStates(2, 4);
730 if ((0xfffffffbffffffffL & l) != (ulong) 0L)
731 JjCheckNAddStates(16, 18);
736 JjCheckNAddStates(16, 18);
740 if (curChar == 34 && kind > 32)
745 if ((0xfffffffeffffffffL & l) == (ulong) 0L)
756 while (i != startsAt);
758 else if (curChar < 128)
760 ulong l = (ulong) (1L << (curChar & 63));
763 switch (jjstateSet[--i])
768 if ((0xdfffffffffffffffL & l) == (ulong) 0L)
781 jjstateSet[jjnewStateCnt++] = 3;
788 while (i != startsAt);
792 int hiByte = (int) (curChar >> 8);
793 int i1 = hiByte >> 6;
794 ulong l1 = (ulong) (1L << (hiByte & 63));
795 int i2 = (curChar & 0xff) >> 6;
796 ulong l2 = (ulong) (1L << (curChar & 63));
799 switch (jjstateSet[--i])
803 if (JjCanMove_0(hiByte, i1, i2, l1, l2))
808 if (JjCanMove_1(hiByte, i1, i2, l1, l2))
817 if (JjCanMove_1(hiByte, i1, i2, l1, l2))
822 if (!JjCanMove_1(hiByte, i1, i2, l1, l2))
833 while (i != startsAt);
835 if (kind != 0x7fffffff)
837 jjmatchedKind = kind;
838 jjmatchedPos = curPos;
842 if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt)))
846 curChar = input_stream.ReadChar();
848 catch (System.IO.IOException)
854 private int JjMoveStringLiteralDfa0_0()
856 return JjMoveNfa_0(0, 0);
858 private int JjMoveNfa_0(
int startState,
int curPos)
863 jjstateSet[0] = startState;
864 int kind = 0x7fffffff;
867 if (++jjround == 0x7fffffff)
871 ulong l = (ulong) (1L << (
int) curChar);
874 switch (jjstateSet[--i])
878 if ((0x3ff000000000000L & l) == 0L)
891 if ((0x3ff000000000000L & l) == 0L)
902 while (i != startsAt);
904 else if (curChar < 128)
906 ulong l = (ulong) (1L << (curChar & 63));
909 switch (jjstateSet[--i])
916 while (i != startsAt);
920 int hiByte = (int) (curChar >> 8);
921 int i1 = hiByte >> 6;
922 long l1 = 1L << (hiByte & 63);
923 int i2 = (curChar & 0xff) >> 6;
924 long l2 = 1L << (curChar & 63);
927 switch (jjstateSet[--i])
934 while (i != startsAt);
936 if (kind != 0x7fffffff)
938 jjmatchedKind = kind;
939 jjmatchedPos = curPos;
943 if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt)))
947 curChar = input_stream.ReadChar();
949 catch (System.IO.IOException)
955 private int JjStopStringLiteralDfa_2(
int pos,
long active0)
961 if ((active0 & 0x4000000L) != 0L)
973 private int JjStartNfa_2(
int pos,
long active0)
975 return JjMoveNfa_2(JjStopStringLiteralDfa_2(pos, active0), pos + 1);
977 private int JjMoveStringLiteralDfa0_2()
983 return JjMoveStringLiteralDfa1_2(0x4000000L);
986 return JjStopAtPos(0, 27);
989 return JjMoveNfa_2(0, 0);
993 private int JjMoveStringLiteralDfa1_2(
long active0)
997 curChar = input_stream.ReadChar();
999 catch (System.IO.IOException)
1001 JjStopStringLiteralDfa_2(0, active0);
1008 if ((active0 & 0x4000000L) != 0L)
1009 return JjStartNfaWithStates_2(1, 26, 6);
1016 return JjStartNfa_2(0, active0);
1018 private int JjStartNfaWithStates_2(
int pos,
int kind,
int state)
1020 jjmatchedKind = kind;
1024 curChar = input_stream.ReadChar();
1026 catch (System.IO.IOException)
1030 return JjMoveNfa_2(state, pos + 1);
1032 private int JjMoveNfa_2(
int startState,
int curPos)
1037 jjstateSet[0] = startState;
1038 int kind = 0x7fffffff;
1041 if (++jjround == 0x7fffffff)
1045 ulong l = (ulong) (1L << (
int) curChar);
1048 switch (jjstateSet[--i])
1052 if ((0xfffffffeffffffffL & l) != (ulong) 0L)
1058 if ((0x100002600L & l) != 0L)
1063 else if (curChar == 34)
1064 JjCheckNAddTwoStates(2, 4);
1069 JjCheckNAddTwoStates(2, 4);
1073 if ((0xfffffffbffffffffL & l) != (ulong) 0L)
1074 JjCheckNAddStates(16, 18);
1079 JjCheckNAddStates(16, 18);
1083 if (curChar == 34 && kind > 28)
1088 if ((0xfffffffeffffffffL & l) == (ulong) 0L)
1099 while (i != startsAt);
1101 else if (curChar < 128)
1103 ulong l = (ulong) (1L << (curChar & 63));
1106 switch (jjstateSet[--i])
1111 if ((0xffffffffdfffffffL & l) == (ulong) 0L)
1119 JjAddStates(16, 18);
1124 jjstateSet[jjnewStateCnt++] = 3;
1131 while (i != startsAt);
1135 int hiByte = (int) (curChar >> 8);
1136 int i1 = hiByte >> 6;
1137 ulong l1 = (ulong) (1L << (hiByte & 63));
1138 int i2 = (curChar & 0xff) >> 6;
1139 ulong l2 = (ulong) (1L << (curChar & 63));
1142 switch (jjstateSet[--i])
1146 if (JjCanMove_0(hiByte, i1, i2, l1, l2))
1151 if (JjCanMove_1(hiByte, i1, i2, l1, l2))
1160 if (JjCanMove_1(hiByte, i1, i2, l1, l2))
1161 JjAddStates(16, 18);
1165 if (!JjCanMove_1(hiByte, i1, i2, l1, l2))
1176 while (i != startsAt);
1178 if (kind != 0x7fffffff)
1180 jjmatchedKind = kind;
1181 jjmatchedPos = curPos;
1185 if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt)))
1189 curChar = input_stream.ReadChar();
1191 catch (System.IO.IOException)
1197 internal static readonly
int[] jjnextStates =
new int[]{15, 16, 18, 29, 32, 23, 33, 30, 20, 21, 32, 23, 33, 31, 34, 27, 2, 4, 5, 0, 1};
1198 private static bool JjCanMove_0(
int hiByte,
int i1,
int i2, ulong l1, ulong l2)
1204 return ((jjbitVec0[i2] & l2) != (ulong) 0L);
1211 private static bool JjCanMove_1(
int hiByte,
int i1,
int i2, ulong l1, ulong l2)
1217 return ((jjbitVec3[i2] & l2) != (ulong) 0L);
1220 if ((jjbitVec1[i1] & l1) != (ulong) 0L)
1226 private static bool JjCanMove_2(
int hiByte,
int i1,
int i2, ulong l1, ulong l2)
1232 return ((jjbitVec3[i2] & l2) != (ulong) 0L);
1235 return ((jjbitVec1[i2] & l2) != (ulong) 0L);
1238 if ((jjbitVec4[i1] & l1) != (ulong) 0L)
1246 public static readonly System.String[] jjstrLiteralImages =
new System.String[]{
"", null, null, null, null, null, null, null, null, null, null,
"\x002B",
"\x002D",
"\x0028",
"\x0029",
"\x003A",
"\x002A",
"\x005E", null, null, null, null, null,
"\x005B",
"\x007B", null,
"\x0054\x004F",
"\x005D", null, null,
"\x0054\x004F",
"\x007D", null, null};
1249 public static readonly System.String[] lexStateNames =
new System.String[]{
"Boost",
"RangeEx",
"RangeIn",
"DEFAULT"};
1252 public static readonly
int[] jjnewLexState =
new int[]{- 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 0, - 1, - 1, - 1, - 1, - 1, 2, 1, 3, - 1, 3, - 1, - 1, - 1, 3, - 1, - 1};
1253 internal static readonly ulong[] jjtoToken =
new ulong[]{0x3ffffff01L};
1254 internal static readonly
long[] jjtoSkip =
new long[]{0x80L};
1255 protected internal ICharStream input_stream;
1256 private uint[] jjrounds =
new uint[36];
1257 private int[] jjstateSet =
new int[72];
1258 protected internal char curChar;
1263 input_stream = stream;
1275 jjmatchedPos = jjnewStateCnt = 0;
1276 curLexState = defaultLexState;
1277 input_stream = stream;
1280 private void ReInitRounds()
1283 jjround = 0x80000001;
1284 for (i = 36; i-- > 0; )
1285 jjrounds[i] = 0x80000000;
1296 public virtual void SwitchTo(
int lexState)
1298 if (lexState >= 4 || lexState < 0)
1299 throw new TokenMgrError(
"Error: Ignoring invalid lexical state : " + lexState +
". State unchanged.",
TokenMgrError.INVALID_LEXICAL_STATE);
1301 curLexState = lexState;
1304 protected internal virtual Token JjFillToken()
1307 System.String curTokenImage;
1312 System.String im = jjstrLiteralImages[jjmatchedKind];
1313 curTokenImage = (im == null)?input_stream.Image:im;
1314 beginLine = input_stream.BeginLine;
1315 beginColumn = input_stream.BeginColumn;
1316 endLine = input_stream.EndLine;
1317 endColumn = input_stream.EndColumn;
1328 internal int curLexState = 3;
1329 internal int defaultLexState = 3;
1330 internal int jjnewStateCnt;
1331 internal uint jjround;
1332 internal int jjmatchedPos;
1333 internal int jjmatchedKind;
1336 [System.Diagnostics.CodeAnalysis.SuppressMessage(
"Microsoft.Design",
"CA1024:UsePropertiesWhereAppropriate")]
1346 curChar = input_stream.BeginToken();
1348 catch (System.IO.IOException)
1351 matchedToken = JjFillToken();
1352 return matchedToken;
1355 switch (curLexState)
1359 jjmatchedKind = 0x7fffffff;
1361 curPos = JjMoveStringLiteralDfa0_0();
1365 jjmatchedKind = 0x7fffffff;
1367 curPos = JjMoveStringLiteralDfa0_1();
1371 jjmatchedKind = 0x7fffffff;
1373 curPos = JjMoveStringLiteralDfa0_2();
1377 jjmatchedKind = 0x7fffffff;
1379 curPos = JjMoveStringLiteralDfa0_3();
1382 if (jjmatchedKind != 0x7fffffff)
1384 if (jjmatchedPos + 1 < curPos)
1385 input_stream.Backup(curPos - jjmatchedPos - 1);
1386 if ((jjtoToken[jjmatchedKind >> 6] & ((ulong) 1L << (jjmatchedKind & 63))) != (ulong) 0L)
1388 matchedToken = JjFillToken();
1389 if (jjnewLexState[jjmatchedKind] != - 1)
1390 curLexState = jjnewLexState[jjmatchedKind];
1391 return matchedToken;
1395 if (jjnewLexState[jjmatchedKind] != - 1)
1396 curLexState = jjnewLexState[jjmatchedKind];
1400 int error_line = input_stream.EndLine;
1401 int error_column = input_stream.EndColumn;
1402 System.String error_after = null;
1403 bool EOFSeen =
false;
1406 input_stream.ReadChar(); input_stream.Backup(1);
1408 catch (System.IO.IOException)
1411 error_after = curPos <= 1?
"":input_stream.Image;
1412 if (curChar ==
'\n' || curChar ==
'\r')
1422 input_stream.Backup(1);
1423 error_after = curPos <= 1?
"":input_stream.Image;
1431 private void JjCheckNAdd(
int state)
1433 if (jjrounds[state] != jjround)
1435 jjstateSet[jjnewStateCnt++] = state;
1436 jjrounds[state] = jjround;
1439 private void JjAddStates(
int start,
int end)
1443 jjstateSet[jjnewStateCnt++] = jjnextStates[start];
1445 while (start++ != end);
1447 private void JjCheckNAddTwoStates(
int state1,
int state2)
1449 JjCheckNAdd(state1);
1450 JjCheckNAdd(state2);
1453 private void JjCheckNAddStates(
int start,
int end)
1457 JjCheckNAdd(jjnextStates[start]);
1459 while (start++ != end);