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