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