pylucene 3.5.0-3
[pylucene.git] / lucene-java-3.5.0 / lucene / src / java / org / apache / lucene / queryParser / QueryParserTokenManager.java
1 /* Generated By:JavaCC: Do not edit this line. QueryParserTokenManager.java */
2 package org.apache.lucene.queryParser;
3 import java.io.IOException;
4 import java.io.StringReader;
5 import java.text.Collator;
6 import java.text.DateFormat;
7 import java.util.ArrayList;
8 import java.util.Calendar;
9 import java.util.Date;
10 import java.util.HashMap;
11 import java.util.List;
12 import java.util.Locale;
13 import java.util.Map;
14 import org.apache.lucene.analysis.Analyzer;
15 import org.apache.lucene.analysis.CachingTokenFilter;
16 import org.apache.lucene.analysis.TokenStream;
17 import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
18 import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
19 import org.apache.lucene.document.DateField;
20 import org.apache.lucene.document.DateTools;
21 import org.apache.lucene.index.Term;
22 import org.apache.lucene.search.BooleanClause;
23 import org.apache.lucene.search.BooleanQuery;
24 import org.apache.lucene.search.FuzzyQuery;
25 import org.apache.lucene.search.MultiTermQuery;
26 import org.apache.lucene.search.MatchAllDocsQuery;
27 import org.apache.lucene.search.MultiPhraseQuery;
28 import org.apache.lucene.search.PhraseQuery;
29 import org.apache.lucene.search.PrefixQuery;
30 import org.apache.lucene.search.Query;
31 import org.apache.lucene.search.TermRangeQuery;
32 import org.apache.lucene.search.TermQuery;
33 import org.apache.lucene.search.WildcardQuery;
34 import org.apache.lucene.util.Version;
35 import org.apache.lucene.util.VirtualMethod;
36
37 /** Token Manager. */
38 public class QueryParserTokenManager implements QueryParserConstants
39 {
40
41   /** Debug output. */
42   public  java.io.PrintStream debugStream = System.out;
43   /** Set debug output. */
44   public  void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
45 private final int jjStopStringLiteralDfa_3(int pos, long active0)
46 {
47    switch (pos)
48    {
49       default :
50          return -1;
51    }
52 }
53 private final int jjStartNfa_3(int pos, long active0)
54 {
55    return jjMoveNfa_3(jjStopStringLiteralDfa_3(pos, active0), pos + 1);
56 }
57 private int jjStopAtPos(int pos, int kind)
58 {
59    jjmatchedKind = kind;
60    jjmatchedPos = pos;
61    return pos + 1;
62 }
63 private int jjMoveStringLiteralDfa0_3()
64 {
65    switch(curChar)
66    {
67       case 40:
68          return jjStopAtPos(0, 13);
69       case 41:
70          return jjStopAtPos(0, 14);
71       case 42:
72          return jjStartNfaWithStates_3(0, 16, 36);
73       case 43:
74          return jjStopAtPos(0, 11);
75       case 45:
76          return jjStopAtPos(0, 12);
77       case 58:
78          return jjStopAtPos(0, 15);
79       case 91:
80          return jjStopAtPos(0, 23);
81       case 94:
82          return jjStopAtPos(0, 17);
83       case 123:
84          return jjStopAtPos(0, 24);
85       default :
86          return jjMoveNfa_3(0, 0);
87    }
88 }
89 private int jjStartNfaWithStates_3(int pos, int kind, int state)
90 {
91    jjmatchedKind = kind;
92    jjmatchedPos = pos;
93    try { curChar = input_stream.readChar(); }
94    catch(java.io.IOException e) { return pos + 1; }
95    return jjMoveNfa_3(state, pos + 1);
96 }
97 static final long[] jjbitVec0 = {
98    0x1L, 0x0L, 0x0L, 0x0L
99 };
100 static final long[] jjbitVec1 = {
101    0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
102 };
103 static final long[] jjbitVec3 = {
104    0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
105 };
106 static final long[] jjbitVec4 = {
107    0xfffefffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
108 };
109 private int jjMoveNfa_3(int startState, int curPos)
110 {
111    int startsAt = 0;
112    jjnewStateCnt = 36;
113    int i = 1;
114    jjstateSet[0] = startState;
115    int kind = 0x7fffffff;
116    for (;;)
117    {
118       if (++jjround == 0x7fffffff)
119          ReInitRounds();
120       if (curChar < 64)
121       {
122          long l = 1L << curChar;
123          do
124          {
125             switch(jjstateSet[--i])
126             {
127                case 36:
128                case 25:
129                   if ((0xfbfffcf8ffffd9ffL & l) == 0L)
130                      break;
131                   if (kind > 22)
132                      kind = 22;
133                   jjCheckNAddTwoStates(25, 26);
134                   break;
135                case 0:
136                   if ((0xfbffd4f8ffffd9ffL & l) != 0L)
137                   {
138                      if (kind > 22)
139                         kind = 22;
140                      jjCheckNAddTwoStates(25, 26);
141                   }
142                   else if ((0x100002600L & l) != 0L)
143                   {
144                      if (kind > 7)
145                         kind = 7;
146                   }
147                   else if (curChar == 34)
148                      jjCheckNAddStates(0, 2);
149                   else if (curChar == 33)
150                   {
151                      if (kind > 10)
152                         kind = 10;
153                   }
154                   if ((0x7bffd0f8ffffd9ffL & l) != 0L)
155                   {
156                      if (kind > 19)
157                         kind = 19;
158                      jjCheckNAddStates(3, 7);
159                   }
160                   else if (curChar == 42)
161                   {
162                      if (kind > 21)
163                         kind = 21;
164                   }
165                   if (curChar == 38)
166                      jjstateSet[jjnewStateCnt++] = 4;
167                   break;
168                case 4:
169                   if (curChar == 38 && kind > 8)
170                      kind = 8;
171                   break;
172                case 5:
173                   if (curChar == 38)
174                      jjstateSet[jjnewStateCnt++] = 4;
175                   break;
176                case 13:
177                   if (curChar == 33 && kind > 10)
178                      kind = 10;
179                   break;
180                case 14:
181                   if (curChar == 34)
182                      jjCheckNAddStates(0, 2);
183                   break;
184                case 15:
185                   if ((0xfffffffbffffffffL & l) != 0L)
186                      jjCheckNAddStates(0, 2);
187                   break;
188                case 17:
189                   jjCheckNAddStates(0, 2);
190                   break;
191                case 18:
192                   if (curChar == 34 && kind > 18)
193                      kind = 18;
194                   break;
195                case 20:
196                   if ((0x3ff000000000000L & l) == 0L)
197                      break;
198                   if (kind > 20)
199                      kind = 20;
200                   jjAddStates(8, 9);
201                   break;
202                case 21:
203                   if (curChar == 46)
204                      jjCheckNAdd(22);
205                   break;
206                case 22:
207                   if ((0x3ff000000000000L & l) == 0L)
208                      break;
209                   if (kind > 20)
210                      kind = 20;
211                   jjCheckNAdd(22);
212                   break;
213                case 23:
214                   if (curChar == 42 && kind > 21)
215                      kind = 21;
216                   break;
217                case 24:
218                   if ((0xfbffd4f8ffffd9ffL & l) == 0L)
219                      break;
220                   if (kind > 22)
221                      kind = 22;
222                   jjCheckNAddTwoStates(25, 26);
223                   break;
224                case 27:
225                   if (kind > 22)
226                      kind = 22;
227                   jjCheckNAddTwoStates(25, 26);
228                   break;
229                case 28:
230                   if ((0x7bffd0f8ffffd9ffL & l) == 0L)
231                      break;
232                   if (kind > 19)
233                      kind = 19;
234                   jjCheckNAddStates(3, 7);
235                   break;
236                case 29:
237                   if ((0x7bfff8f8ffffd9ffL & l) == 0L)
238                      break;
239                   if (kind > 19)
240                      kind = 19;
241                   jjCheckNAddTwoStates(29, 30);
242                   break;
243                case 31:
244                   if (kind > 19)
245                      kind = 19;
246                   jjCheckNAddTwoStates(29, 30);
247                   break;
248                case 32:
249                   if ((0x7bfff8f8ffffd9ffL & l) != 0L)
250                      jjCheckNAddStates(10, 12);
251                   break;
252                case 34:
253                   jjCheckNAddStates(10, 12);
254                   break;
255                default : break;
256             }
257          } while(i != startsAt);
258       }
259       else if (curChar < 128)
260       {
261          long l = 1L << (curChar & 077);
262          do
263          {
264             switch(jjstateSet[--i])
265             {
266                case 36:
267                   if ((0x97ffffff87ffffffL & l) != 0L)
268                   {
269                      if (kind > 22)
270                         kind = 22;
271                      jjCheckNAddTwoStates(25, 26);
272                   }
273                   else if (curChar == 92)
274                      jjCheckNAddTwoStates(27, 27);
275                   break;
276                case 0:
277                   if ((0x97ffffff87ffffffL & l) != 0L)
278                   {
279                      if (kind > 19)
280                         kind = 19;
281                      jjCheckNAddStates(3, 7);
282                   }
283                   else if (curChar == 92)
284                      jjCheckNAddStates(13, 15);
285                   else if (curChar == 126)
286                   {
287                      if (kind > 20)
288                         kind = 20;
289                      jjstateSet[jjnewStateCnt++] = 20;
290                   }
291                   if ((0x97ffffff87ffffffL & l) != 0L)
292                   {
293                      if (kind > 22)
294                         kind = 22;
295                      jjCheckNAddTwoStates(25, 26);
296                   }
297                   if (curChar == 78)
298                      jjstateSet[jjnewStateCnt++] = 11;
299                   else if (curChar == 124)
300                      jjstateSet[jjnewStateCnt++] = 8;
301                   else if (curChar == 79)
302                      jjstateSet[jjnewStateCnt++] = 6;
303                   else if (curChar == 65)
304                      jjstateSet[jjnewStateCnt++] = 2;
305                   break;
306                case 1:
307                   if (curChar == 68 && kind > 8)
308                      kind = 8;
309                   break;
310                case 2:
311                   if (curChar == 78)
312                      jjstateSet[jjnewStateCnt++] = 1;
313                   break;
314                case 3:
315                   if (curChar == 65)
316                      jjstateSet[jjnewStateCnt++] = 2;
317                   break;
318                case 6:
319                   if (curChar == 82 && kind > 9)
320                      kind = 9;
321                   break;
322                case 7:
323                   if (curChar == 79)
324                      jjstateSet[jjnewStateCnt++] = 6;
325                   break;
326                case 8:
327                   if (curChar == 124 && kind > 9)
328                      kind = 9;
329                   break;
330                case 9:
331                   if (curChar == 124)
332                      jjstateSet[jjnewStateCnt++] = 8;
333                   break;
334                case 10:
335                   if (curChar == 84 && kind > 10)
336                      kind = 10;
337                   break;
338                case 11:
339                   if (curChar == 79)
340                      jjstateSet[jjnewStateCnt++] = 10;
341                   break;
342                case 12:
343                   if (curChar == 78)
344                      jjstateSet[jjnewStateCnt++] = 11;
345                   break;
346                case 15:
347                   if ((0xffffffffefffffffL & l) != 0L)
348                      jjCheckNAddStates(0, 2);
349                   break;
350                case 16:
351                   if (curChar == 92)
352                      jjstateSet[jjnewStateCnt++] = 17;
353                   break;
354                case 17:
355                   jjCheckNAddStates(0, 2);
356                   break;
357                case 19:
358                   if (curChar != 126)
359                      break;
360                   if (kind > 20)
361                      kind = 20;
362                   jjstateSet[jjnewStateCnt++] = 20;
363                   break;
364                case 24:
365                   if ((0x97ffffff87ffffffL & l) == 0L)
366                      break;
367                   if (kind > 22)
368                      kind = 22;
369                   jjCheckNAddTwoStates(25, 26);
370                   break;
371                case 25:
372                   if ((0x97ffffff87ffffffL & l) == 0L)
373                      break;
374                   if (kind > 22)
375                      kind = 22;
376                   jjCheckNAddTwoStates(25, 26);
377                   break;
378                case 26:
379                   if (curChar == 92)
380                      jjCheckNAddTwoStates(27, 27);
381                   break;
382                case 27:
383                   if (kind > 22)
384                      kind = 22;
385                   jjCheckNAddTwoStates(25, 26);
386                   break;
387                case 28:
388                   if ((0x97ffffff87ffffffL & l) == 0L)
389                      break;
390                   if (kind > 19)
391                      kind = 19;
392                   jjCheckNAddStates(3, 7);
393                   break;
394                case 29:
395                   if ((0x97ffffff87ffffffL & l) == 0L)
396                      break;
397                   if (kind > 19)
398                      kind = 19;
399                   jjCheckNAddTwoStates(29, 30);
400                   break;
401                case 30:
402                   if (curChar == 92)
403                      jjCheckNAddTwoStates(31, 31);
404                   break;
405                case 31:
406                   if (kind > 19)
407                      kind = 19;
408                   jjCheckNAddTwoStates(29, 30);
409                   break;
410                case 32:
411                   if ((0x97ffffff87ffffffL & l) != 0L)
412                      jjCheckNAddStates(10, 12);
413                   break;
414                case 33:
415                   if (curChar == 92)
416                      jjCheckNAddTwoStates(34, 34);
417                   break;
418                case 34:
419                   jjCheckNAddStates(10, 12);
420                   break;
421                case 35:
422                   if (curChar == 92)
423                      jjCheckNAddStates(13, 15);
424                   break;
425                default : break;
426             }
427          } while(i != startsAt);
428       }
429       else
430       {
431          int hiByte = (int)(curChar >> 8);
432          int i1 = hiByte >> 6;
433          long l1 = 1L << (hiByte & 077);
434          int i2 = (curChar & 0xff) >> 6;
435          long l2 = 1L << (curChar & 077);
436          do
437          {
438             switch(jjstateSet[--i])
439             {
440                case 36:
441                case 25:
442                   if (!jjCanMove_2(hiByte, i1, i2, l1, l2))
443                      break;
444                   if (kind > 22)
445                      kind = 22;
446                   jjCheckNAddTwoStates(25, 26);
447                   break;
448                case 0:
449                   if (jjCanMove_0(hiByte, i1, i2, l1, l2))
450                   {
451                      if (kind > 7)
452                         kind = 7;
453                   }
454                   if (jjCanMove_2(hiByte, i1, i2, l1, l2))
455                   {
456                      if (kind > 22)
457                         kind = 22;
458                      jjCheckNAddTwoStates(25, 26);
459                   }
460                   if (jjCanMove_2(hiByte, i1, i2, l1, l2))
461                   {
462                      if (kind > 19)
463                         kind = 19;
464                      jjCheckNAddStates(3, 7);
465                   }
466                   break;
467                case 15:
468                case 17:
469                   if (jjCanMove_1(hiByte, i1, i2, l1, l2))
470                      jjCheckNAddStates(0, 2);
471                   break;
472                case 24:
473                   if (!jjCanMove_2(hiByte, i1, i2, l1, l2))
474                      break;
475                   if (kind > 22)
476                      kind = 22;
477                   jjCheckNAddTwoStates(25, 26);
478                   break;
479                case 27:
480                   if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
481                      break;
482                   if (kind > 22)
483                      kind = 22;
484                   jjCheckNAddTwoStates(25, 26);
485                   break;
486                case 28:
487                   if (!jjCanMove_2(hiByte, i1, i2, l1, l2))
488                      break;
489                   if (kind > 19)
490                      kind = 19;
491                   jjCheckNAddStates(3, 7);
492                   break;
493                case 29:
494                   if (!jjCanMove_2(hiByte, i1, i2, l1, l2))
495                      break;
496                   if (kind > 19)
497                      kind = 19;
498                   jjCheckNAddTwoStates(29, 30);
499                   break;
500                case 31:
501                   if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
502                      break;
503                   if (kind > 19)
504                      kind = 19;
505                   jjCheckNAddTwoStates(29, 30);
506                   break;
507                case 32:
508                   if (jjCanMove_2(hiByte, i1, i2, l1, l2))
509                      jjCheckNAddStates(10, 12);
510                   break;
511                case 34:
512                   if (jjCanMove_1(hiByte, i1, i2, l1, l2))
513                      jjCheckNAddStates(10, 12);
514                   break;
515                default : break;
516             }
517          } while(i != startsAt);
518       }
519       if (kind != 0x7fffffff)
520       {
521          jjmatchedKind = kind;
522          jjmatchedPos = curPos;
523          kind = 0x7fffffff;
524       }
525       ++curPos;
526       if ((i = jjnewStateCnt) == (startsAt = 36 - (jjnewStateCnt = startsAt)))
527          return curPos;
528       try { curChar = input_stream.readChar(); }
529       catch(java.io.IOException e) { return curPos; }
530    }
531 }
532 private final int jjStopStringLiteralDfa_1(int pos, long active0)
533 {
534    switch (pos)
535    {
536       case 0:
537          if ((active0 & 0x40000000L) != 0L)
538          {
539             jjmatchedKind = 33;
540             return 6;
541          }
542          return -1;
543       default :
544          return -1;
545    }
546 }
547 private final int jjStartNfa_1(int pos, long active0)
548 {
549    return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0), pos + 1);
550 }
551 private int jjMoveStringLiteralDfa0_1()
552 {
553    switch(curChar)
554    {
555       case 84:
556          return jjMoveStringLiteralDfa1_1(0x40000000L);
557       case 125:
558          return jjStopAtPos(0, 31);
559       default :
560          return jjMoveNfa_1(0, 0);
561    }
562 }
563 private int jjMoveStringLiteralDfa1_1(long active0)
564 {
565    try { curChar = input_stream.readChar(); }
566    catch(java.io.IOException e) {
567       jjStopStringLiteralDfa_1(0, active0);
568       return 1;
569    }
570    switch(curChar)
571    {
572       case 79:
573          if ((active0 & 0x40000000L) != 0L)
574             return jjStartNfaWithStates_1(1, 30, 6);
575          break;
576       default :
577          break;
578    }
579    return jjStartNfa_1(0, active0);
580 }
581 private int jjStartNfaWithStates_1(int pos, int kind, int state)
582 {
583    jjmatchedKind = kind;
584    jjmatchedPos = pos;
585    try { curChar = input_stream.readChar(); }
586    catch(java.io.IOException e) { return pos + 1; }
587    return jjMoveNfa_1(state, pos + 1);
588 }
589 private int jjMoveNfa_1(int startState, int curPos)
590 {
591    int startsAt = 0;
592    jjnewStateCnt = 7;
593    int i = 1;
594    jjstateSet[0] = startState;
595    int kind = 0x7fffffff;
596    for (;;)
597    {
598       if (++jjround == 0x7fffffff)
599          ReInitRounds();
600       if (curChar < 64)
601       {
602          long l = 1L << curChar;
603          do
604          {
605             switch(jjstateSet[--i])
606             {
607                case 0:
608                   if ((0xfffffffeffffffffL & l) != 0L)
609                   {
610                      if (kind > 33)
611                         kind = 33;
612                      jjCheckNAdd(6);
613                   }
614                   if ((0x100002600L & l) != 0L)
615                   {
616                      if (kind > 7)
617                         kind = 7;
618                   }
619                   else if (curChar == 34)
620                      jjCheckNAddTwoStates(2, 4);
621                   break;
622                case 1:
623                   if (curChar == 34)
624                      jjCheckNAddTwoStates(2, 4);
625                   break;
626                case 2:
627                   if ((0xfffffffbffffffffL & l) != 0L)
628                      jjCheckNAddStates(16, 18);
629                   break;
630                case 3:
631                   if (curChar == 34)
632                      jjCheckNAddStates(16, 18);
633                   break;
634                case 5:
635                   if (curChar == 34 && kind > 32)
636                      kind = 32;
637                   break;
638                case 6:
639                   if ((0xfffffffeffffffffL & l) == 0L)
640                      break;
641                   if (kind > 33)
642                      kind = 33;
643                   jjCheckNAdd(6);
644                   break;
645                default : break;
646             }
647          } while(i != startsAt);
648       }
649       else if (curChar < 128)
650       {
651          long l = 1L << (curChar & 077);
652          do
653          {
654             switch(jjstateSet[--i])
655             {
656                case 0:
657                case 6:
658                   if ((0xdfffffffffffffffL & l) == 0L)
659                      break;
660                   if (kind > 33)
661                      kind = 33;
662                   jjCheckNAdd(6);
663                   break;
664                case 2:
665                   jjAddStates(16, 18);
666                   break;
667                case 4:
668                   if (curChar == 92)
669                      jjstateSet[jjnewStateCnt++] = 3;
670                   break;
671                default : break;
672             }
673          } while(i != startsAt);
674       }
675       else
676       {
677          int hiByte = (int)(curChar >> 8);
678          int i1 = hiByte >> 6;
679          long l1 = 1L << (hiByte & 077);
680          int i2 = (curChar & 0xff) >> 6;
681          long l2 = 1L << (curChar & 077);
682          do
683          {
684             switch(jjstateSet[--i])
685             {
686                case 0:
687                   if (jjCanMove_0(hiByte, i1, i2, l1, l2))
688                   {
689                      if (kind > 7)
690                         kind = 7;
691                   }
692                   if (jjCanMove_1(hiByte, i1, i2, l1, l2))
693                   {
694                      if (kind > 33)
695                         kind = 33;
696                      jjCheckNAdd(6);
697                   }
698                   break;
699                case 2:
700                   if (jjCanMove_1(hiByte, i1, i2, l1, l2))
701                      jjAddStates(16, 18);
702                   break;
703                case 6:
704                   if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
705                      break;
706                   if (kind > 33)
707                      kind = 33;
708                   jjCheckNAdd(6);
709                   break;
710                default : break;
711             }
712          } while(i != startsAt);
713       }
714       if (kind != 0x7fffffff)
715       {
716          jjmatchedKind = kind;
717          jjmatchedPos = curPos;
718          kind = 0x7fffffff;
719       }
720       ++curPos;
721       if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt)))
722          return curPos;
723       try { curChar = input_stream.readChar(); }
724       catch(java.io.IOException e) { return curPos; }
725    }
726 }
727 private int jjMoveStringLiteralDfa0_0()
728 {
729    return jjMoveNfa_0(0, 0);
730 }
731 private int jjMoveNfa_0(int startState, int curPos)
732 {
733    int startsAt = 0;
734    jjnewStateCnt = 3;
735    int i = 1;
736    jjstateSet[0] = startState;
737    int kind = 0x7fffffff;
738    for (;;)
739    {
740       if (++jjround == 0x7fffffff)
741          ReInitRounds();
742       if (curChar < 64)
743       {
744          long l = 1L << curChar;
745          do
746          {
747             switch(jjstateSet[--i])
748             {
749                case 0:
750                   if ((0x3ff000000000000L & l) == 0L)
751                      break;
752                   if (kind > 25)
753                      kind = 25;
754                   jjAddStates(19, 20);
755                   break;
756                case 1:
757                   if (curChar == 46)
758                      jjCheckNAdd(2);
759                   break;
760                case 2:
761                   if ((0x3ff000000000000L & l) == 0L)
762                      break;
763                   if (kind > 25)
764                      kind = 25;
765                   jjCheckNAdd(2);
766                   break;
767                default : break;
768             }
769          } while(i != startsAt);
770       }
771       else if (curChar < 128)
772       {
773          long l = 1L << (curChar & 077);
774          do
775          {
776             switch(jjstateSet[--i])
777             {
778                default : break;
779             }
780          } while(i != startsAt);
781       }
782       else
783       {
784          int hiByte = (int)(curChar >> 8);
785          int i1 = hiByte >> 6;
786          long l1 = 1L << (hiByte & 077);
787          int i2 = (curChar & 0xff) >> 6;
788          long l2 = 1L << (curChar & 077);
789          do
790          {
791             switch(jjstateSet[--i])
792             {
793                default : break;
794             }
795          } while(i != startsAt);
796       }
797       if (kind != 0x7fffffff)
798       {
799          jjmatchedKind = kind;
800          jjmatchedPos = curPos;
801          kind = 0x7fffffff;
802       }
803       ++curPos;
804       if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt)))
805          return curPos;
806       try { curChar = input_stream.readChar(); }
807       catch(java.io.IOException e) { return curPos; }
808    }
809 }
810 private final int jjStopStringLiteralDfa_2(int pos, long active0)
811 {
812    switch (pos)
813    {
814       case 0:
815          if ((active0 & 0x4000000L) != 0L)
816          {
817             jjmatchedKind = 29;
818             return 6;
819          }
820          return -1;
821       default :
822          return -1;
823    }
824 }
825 private final int jjStartNfa_2(int pos, long active0)
826 {
827    return jjMoveNfa_2(jjStopStringLiteralDfa_2(pos, active0), pos + 1);
828 }
829 private int jjMoveStringLiteralDfa0_2()
830 {
831    switch(curChar)
832    {
833       case 84:
834          return jjMoveStringLiteralDfa1_2(0x4000000L);
835       case 93:
836          return jjStopAtPos(0, 27);
837       default :
838          return jjMoveNfa_2(0, 0);
839    }
840 }
841 private int jjMoveStringLiteralDfa1_2(long active0)
842 {
843    try { curChar = input_stream.readChar(); }
844    catch(java.io.IOException e) {
845       jjStopStringLiteralDfa_2(0, active0);
846       return 1;
847    }
848    switch(curChar)
849    {
850       case 79:
851          if ((active0 & 0x4000000L) != 0L)
852             return jjStartNfaWithStates_2(1, 26, 6);
853          break;
854       default :
855          break;
856    }
857    return jjStartNfa_2(0, active0);
858 }
859 private int jjStartNfaWithStates_2(int pos, int kind, int state)
860 {
861    jjmatchedKind = kind;
862    jjmatchedPos = pos;
863    try { curChar = input_stream.readChar(); }
864    catch(java.io.IOException e) { return pos + 1; }
865    return jjMoveNfa_2(state, pos + 1);
866 }
867 private int jjMoveNfa_2(int startState, int curPos)
868 {
869    int startsAt = 0;
870    jjnewStateCnt = 7;
871    int i = 1;
872    jjstateSet[0] = startState;
873    int kind = 0x7fffffff;
874    for (;;)
875    {
876       if (++jjround == 0x7fffffff)
877          ReInitRounds();
878       if (curChar < 64)
879       {
880          long l = 1L << curChar;
881          do
882          {
883             switch(jjstateSet[--i])
884             {
885                case 0:
886                   if ((0xfffffffeffffffffL & l) != 0L)
887                   {
888                      if (kind > 29)
889                         kind = 29;
890                      jjCheckNAdd(6);
891                   }
892                   if ((0x100002600L & l) != 0L)
893                   {
894                      if (kind > 7)
895                         kind = 7;
896                   }
897                   else if (curChar == 34)
898                      jjCheckNAddTwoStates(2, 4);
899                   break;
900                case 1:
901                   if (curChar == 34)
902                      jjCheckNAddTwoStates(2, 4);
903                   break;
904                case 2:
905                   if ((0xfffffffbffffffffL & l) != 0L)
906                      jjCheckNAddStates(16, 18);
907                   break;
908                case 3:
909                   if (curChar == 34)
910                      jjCheckNAddStates(16, 18);
911                   break;
912                case 5:
913                   if (curChar == 34 && kind > 28)
914                      kind = 28;
915                   break;
916                case 6:
917                   if ((0xfffffffeffffffffL & l) == 0L)
918                      break;
919                   if (kind > 29)
920                      kind = 29;
921                   jjCheckNAdd(6);
922                   break;
923                default : break;
924             }
925          } while(i != startsAt);
926       }
927       else if (curChar < 128)
928       {
929          long l = 1L << (curChar & 077);
930          do
931          {
932             switch(jjstateSet[--i])
933             {
934                case 0:
935                case 6:
936                   if ((0xffffffffdfffffffL & l) == 0L)
937                      break;
938                   if (kind > 29)
939                      kind = 29;
940                   jjCheckNAdd(6);
941                   break;
942                case 2:
943                   jjAddStates(16, 18);
944                   break;
945                case 4:
946                   if (curChar == 92)
947                      jjstateSet[jjnewStateCnt++] = 3;
948                   break;
949                default : break;
950             }
951          } while(i != startsAt);
952       }
953       else
954       {
955          int hiByte = (int)(curChar >> 8);
956          int i1 = hiByte >> 6;
957          long l1 = 1L << (hiByte & 077);
958          int i2 = (curChar & 0xff) >> 6;
959          long l2 = 1L << (curChar & 077);
960          do
961          {
962             switch(jjstateSet[--i])
963             {
964                case 0:
965                   if (jjCanMove_0(hiByte, i1, i2, l1, l2))
966                   {
967                      if (kind > 7)
968                         kind = 7;
969                   }
970                   if (jjCanMove_1(hiByte, i1, i2, l1, l2))
971                   {
972                      if (kind > 29)
973                         kind = 29;
974                      jjCheckNAdd(6);
975                   }
976                   break;
977                case 2:
978                   if (jjCanMove_1(hiByte, i1, i2, l1, l2))
979                      jjAddStates(16, 18);
980                   break;
981                case 6:
982                   if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
983                      break;
984                   if (kind > 29)
985                      kind = 29;
986                   jjCheckNAdd(6);
987                   break;
988                default : break;
989             }
990          } while(i != startsAt);
991       }
992       if (kind != 0x7fffffff)
993       {
994          jjmatchedKind = kind;
995          jjmatchedPos = curPos;
996          kind = 0x7fffffff;
997       }
998       ++curPos;
999       if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt)))
1000          return curPos;
1001       try { curChar = input_stream.readChar(); }
1002       catch(java.io.IOException e) { return curPos; }
1003    }
1004 }
1005 static final int[] jjnextStates = {
1006    15, 16, 18, 29, 32, 23, 33, 30, 20, 21, 32, 23, 33, 31, 34, 27, 
1007    2, 4, 5, 0, 1, 
1008 };
1009 private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2)
1010 {
1011    switch(hiByte)
1012    {
1013       case 48:
1014          return ((jjbitVec0[i2] & l2) != 0L);
1015       default :
1016          return false;
1017    }
1018 }
1019 private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2)
1020 {
1021    switch(hiByte)
1022    {
1023       case 0:
1024          return ((jjbitVec3[i2] & l2) != 0L);
1025       default :
1026          if ((jjbitVec1[i1] & l1) != 0L)
1027             return true;
1028          return false;
1029    }
1030 }
1031 private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2)
1032 {
1033    switch(hiByte)
1034    {
1035       case 0:
1036          return ((jjbitVec3[i2] & l2) != 0L);
1037       case 48:
1038          return ((jjbitVec1[i2] & l2) != 0L);
1039       default :
1040          if ((jjbitVec4[i1] & l1) != 0L)
1041             return true;
1042          return false;
1043    }
1044 }
1045
1046 /** Token literal values. */
1047 public static final String[] jjstrLiteralImages = {
1048 "", null, null, null, null, null, null, null, null, null, null, "\53", "\55", 
1049 "\50", "\51", "\72", "\52", "\136", null, null, null, null, null, "\133", "\173", 
1050 null, "\124\117", "\135", null, null, "\124\117", "\175", null, null, };
1051
1052 /** Lexer state names. */
1053 public static final String[] lexStateNames = {
1054    "Boost",
1055    "RangeEx",
1056    "RangeIn",
1057    "DEFAULT",
1058 };
1059
1060 /** Lex State array. */
1061 public static final int[] jjnewLexState = {
1062    -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, 
1063    3, -1, 3, -1, -1, -1, 3, -1, -1, 
1064 };
1065 static final long[] jjtoToken = {
1066    0x3ffffff01L, 
1067 };
1068 static final long[] jjtoSkip = {
1069    0x80L, 
1070 };
1071 protected CharStream input_stream;
1072 private final int[] jjrounds = new int[36];
1073 private final int[] jjstateSet = new int[72];
1074 protected char curChar;
1075 /** Constructor. */
1076 public QueryParserTokenManager(CharStream stream){
1077    input_stream = stream;
1078 }
1079
1080 /** Constructor. */
1081 public QueryParserTokenManager(CharStream stream, int lexState){
1082    this(stream);
1083    SwitchTo(lexState);
1084 }
1085
1086 /** Reinitialise parser. */
1087 public void ReInit(CharStream stream)
1088 {
1089    jjmatchedPos = jjnewStateCnt = 0;
1090    curLexState = defaultLexState;
1091    input_stream = stream;
1092    ReInitRounds();
1093 }
1094 private void ReInitRounds()
1095 {
1096    int i;
1097    jjround = 0x80000001;
1098    for (i = 36; i-- > 0;)
1099       jjrounds[i] = 0x80000000;
1100 }
1101
1102 /** Reinitialise parser. */
1103 public void ReInit(CharStream stream, int lexState)
1104 {
1105    ReInit(stream);
1106    SwitchTo(lexState);
1107 }
1108
1109 /** Switch to specified lex state. */
1110 public void SwitchTo(int lexState)
1111 {
1112    if (lexState >= 4 || lexState < 0)
1113       throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
1114    else
1115       curLexState = lexState;
1116 }
1117
1118 protected Token jjFillToken()
1119 {
1120    final Token t;
1121    final String curTokenImage;
1122    final int beginLine;
1123    final int endLine;
1124    final int beginColumn;
1125    final int endColumn;
1126    String im = jjstrLiteralImages[jjmatchedKind];
1127    curTokenImage = (im == null) ? input_stream.GetImage() : im;
1128    beginLine = input_stream.getBeginLine();
1129    beginColumn = input_stream.getBeginColumn();
1130    endLine = input_stream.getEndLine();
1131    endColumn = input_stream.getEndColumn();
1132    t = Token.newToken(jjmatchedKind, curTokenImage);
1133
1134    t.beginLine = beginLine;
1135    t.endLine = endLine;
1136    t.beginColumn = beginColumn;
1137    t.endColumn = endColumn;
1138
1139    return t;
1140 }
1141
1142 int curLexState = 3;
1143 int defaultLexState = 3;
1144 int jjnewStateCnt;
1145 int jjround;
1146 int jjmatchedPos;
1147 int jjmatchedKind;
1148
1149 /** Get the next Token. */
1150 public Token getNextToken() 
1151 {
1152   Token matchedToken;
1153   int curPos = 0;
1154
1155   EOFLoop :
1156   for (;;)
1157   {
1158    try
1159    {
1160       curChar = input_stream.BeginToken();
1161    }
1162    catch(java.io.IOException e)
1163    {
1164       jjmatchedKind = 0;
1165       matchedToken = jjFillToken();
1166       return matchedToken;
1167    }
1168
1169    switch(curLexState)
1170    {
1171      case 0:
1172        jjmatchedKind = 0x7fffffff;
1173        jjmatchedPos = 0;
1174        curPos = jjMoveStringLiteralDfa0_0();
1175        break;
1176      case 1:
1177        jjmatchedKind = 0x7fffffff;
1178        jjmatchedPos = 0;
1179        curPos = jjMoveStringLiteralDfa0_1();
1180        break;
1181      case 2:
1182        jjmatchedKind = 0x7fffffff;
1183        jjmatchedPos = 0;
1184        curPos = jjMoveStringLiteralDfa0_2();
1185        break;
1186      case 3:
1187        jjmatchedKind = 0x7fffffff;
1188        jjmatchedPos = 0;
1189        curPos = jjMoveStringLiteralDfa0_3();
1190        break;
1191    }
1192      if (jjmatchedKind != 0x7fffffff)
1193      {
1194         if (jjmatchedPos + 1 < curPos)
1195            input_stream.backup(curPos - jjmatchedPos - 1);
1196         if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
1197         {
1198            matchedToken = jjFillToken();
1199        if (jjnewLexState[jjmatchedKind] != -1)
1200          curLexState = jjnewLexState[jjmatchedKind];
1201            return matchedToken;
1202         }
1203         else
1204         {
1205          if (jjnewLexState[jjmatchedKind] != -1)
1206            curLexState = jjnewLexState[jjmatchedKind];
1207            continue EOFLoop;
1208         }
1209      }
1210      int error_line = input_stream.getEndLine();
1211      int error_column = input_stream.getEndColumn();
1212      String error_after = null;
1213      boolean EOFSeen = false;
1214      try { input_stream.readChar(); input_stream.backup(1); }
1215      catch (java.io.IOException e1) {
1216         EOFSeen = true;
1217         error_after = curPos <= 1 ? "" : input_stream.GetImage();
1218         if (curChar == '\n' || curChar == '\r') {
1219            error_line++;
1220            error_column = 0;
1221         }
1222         else
1223            error_column++;
1224      }
1225      if (!EOFSeen) {
1226         input_stream.backup(1);
1227         error_after = curPos <= 1 ? "" : input_stream.GetImage();
1228      }
1229      throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
1230   }
1231 }
1232
1233 private void jjCheckNAdd(int state)
1234 {
1235    if (jjrounds[state] != jjround)
1236    {
1237       jjstateSet[jjnewStateCnt++] = state;
1238       jjrounds[state] = jjround;
1239    }
1240 }
1241 private void jjAddStates(int start, int end)
1242 {
1243    do {
1244       jjstateSet[jjnewStateCnt++] = jjnextStates[start];
1245    } while (start++ != end);
1246 }
1247 private void jjCheckNAddTwoStates(int state1, int state2)
1248 {
1249    jjCheckNAdd(state1);
1250    jjCheckNAdd(state2);
1251 }
1252
1253 private void jjCheckNAddStates(int start, int end)
1254 {
1255    do {
1256       jjCheckNAdd(jjnextStates[start]);
1257    } while (start++ != end);
1258 }
1259
1260 }