1 2 package org.objectweb.speedo.query.parser; 3 4 5 public class SpeedoQLTokenManager implements SpeedoQLConstants { 6 public java.io.PrintStream debugStream = System.out; 7 8 public void setDebugStream(java.io.PrintStream ds) { 9 debugStream = ds; 10 } 11 12 private final int jjStopStringLiteralDfa_0(int pos, long active0) { 13 switch (pos) { 14 case 0: 15 if ((active0 & 0x200000000L) != 0L) 16 return 4; 17 if ((active0 & 0xffe0L) != 0L) { 18 jjmatchedKind = 42; 19 return 28; 20 } 21 return -1; 22 case 1: 23 if ((active0 & 0xffe0L) != 0L) { 24 jjmatchedKind = 42; 25 jjmatchedPos = 1; 26 return 28; 27 } 28 return -1; 29 case 2: 30 if ((active0 & 0x800L) != 0L) 31 return 28; 32 if ((active0 & 0xf7e0L) != 0L) { 33 jjmatchedKind = 42; 34 jjmatchedPos = 2; 35 return 28; 36 } 37 return -1; 38 case 3: 39 if ((active0 & 0x84e0L) != 0L) { 40 jjmatchedKind = 42; 41 jjmatchedPos = 3; 42 return 28; 43 } 44 if ((active0 & 0x7300L) != 0L) 45 return 28; 46 return -1; 47 case 4: 48 if ((active0 & 0x8440L) != 0L) 49 return 28; 50 if ((active0 & 0xa0L) != 0L) { 51 jjmatchedKind = 42; 52 jjmatchedPos = 4; 53 return 28; 54 } 55 return -1; 56 case 5: 57 if ((active0 & 0x80L) != 0L) 58 return 28; 59 if ((active0 & 0x20L) != 0L) { 60 jjmatchedKind = 42; 61 jjmatchedPos = 5; 62 return 28; 63 } 64 return -1; 65 default : 66 return -1; 67 } 68 } 69 70 private final int jjStartNfa_0(int pos, long active0) { 71 return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); 72 } 73 74 private final int jjStopAtPos(int pos, int kind) { 75 jjmatchedKind = kind; 76 jjmatchedPos = pos; 77 return pos + 1; 78 } 79 80 private final int jjStartNfaWithStates_0(int pos, int kind, int state) { 81 jjmatchedKind = kind; 82 jjmatchedPos = pos; 83 try { 84 curChar = input_stream.readChar(); 85 } catch (java.io.IOException e) { 86 return pos + 1; 87 } 88 return jjMoveNfa_0(state, pos + 1); 89 } 90 91 private final int jjMoveStringLiteralDfa0_0() { 92 switch (curChar) { 93 case 33: 94 jjmatchedKind = 32; 95 return jjMoveStringLiteralDfa1_0(0x2000000L); 96 case 38: 97 jjmatchedKind = 30; 98 return jjMoveStringLiteralDfa1_0(0x8000000L); 99 case 40: 100 return jjStopAtPos(0, 45); 101 case 41: 102 return jjStopAtPos(0, 46); 103 case 42: 104 return jjStopAtPos(0, 22); 105 case 43: 106 return jjStopAtPos(0, 20); 107 case 45: 108 return jjStopAtPos(0, 21); 109 case 46: 110 return jjStartNfaWithStates_0(0, 33, 4); 111 case 47: 112 return jjStopAtPos(0, 23); 113 case 60: 114 jjmatchedKind = 16; 115 return jjMoveStringLiteralDfa1_0(0x40000L); 116 case 61: 117 return jjMoveStringLiteralDfa1_0(0x1000000L); 118 case 62: 119 jjmatchedKind = 17; 120 return jjMoveStringLiteralDfa1_0(0x80000L); 121 case 94: 122 return jjStopAtPos(0, 29); 123 case 98: 124 return jjMoveStringLiteralDfa1_0(0x1020L); 125 case 99: 126 return jjMoveStringLiteralDfa1_0(0x2000L); 127 case 100: 128 return jjMoveStringLiteralDfa1_0(0x80L); 129 case 102: 130 return jjMoveStringLiteralDfa1_0(0x440L); 131 case 105: 132 return jjMoveStringLiteralDfa1_0(0x800L); 133 case 108: 134 return jjMoveStringLiteralDfa1_0(0x4000L); 135 case 110: 136 return jjMoveStringLiteralDfa1_0(0x100L); 137 case 115: 138 return jjMoveStringLiteralDfa1_0(0x8000L); 139 case 116: 140 return jjMoveStringLiteralDfa1_0(0x200L); 141 case 124: 142 jjmatchedKind = 28; 143 return jjMoveStringLiteralDfa1_0(0x4000000L); 144 case 126: 145 return jjStopAtPos(0, 31); 146 default : 147 return jjMoveNfa_0(0, 0); 148 } 149 } 150 151 private final int jjMoveStringLiteralDfa1_0(long active0) { 152 try { 153 curChar = input_stream.readChar(); 154 } catch (java.io.IOException e) { 155 jjStopStringLiteralDfa_0(0, active0); 156 return 1; 157 } 158 switch (curChar) { 159 case 38: 160 if ((active0 & 0x8000000L) != 0L) 161 return jjStopAtPos(1, 27); 162 break; 163 case 61: 164 if ((active0 & 0x40000L) != 0L) 165 return jjStopAtPos(1, 18); 166 else if ((active0 & 0x80000L) != 0L) 167 return jjStopAtPos(1, 19); 168 else if ((active0 & 0x1000000L) != 0L) 169 return jjStopAtPos(1, 24); 170 else if ((active0 & 0x2000000L) != 0L) 171 return jjStopAtPos(1, 25); 172 break; 173 case 97: 174 return jjMoveStringLiteralDfa2_0(active0, 0x400L); 175 case 104: 176 return jjMoveStringLiteralDfa2_0(active0, 0xa000L); 177 case 108: 178 return jjMoveStringLiteralDfa2_0(active0, 0x40L); 179 case 110: 180 return jjMoveStringLiteralDfa2_0(active0, 0x800L); 181 case 111: 182 return jjMoveStringLiteralDfa2_0(active0, 0x40a0L); 183 case 114: 184 return jjMoveStringLiteralDfa2_0(active0, 0x200L); 185 case 117: 186 return jjMoveStringLiteralDfa2_0(active0, 0x100L); 187 case 121: 188 return jjMoveStringLiteralDfa2_0(active0, 0x1000L); 189 case 124: 190 if ((active0 & 0x4000000L) != 0L) 191 return jjStopAtPos(1, 26); 192 break; 193 default : 194 break; 195 } 196 return jjStartNfa_0(0, active0); 197 } 198 199 private final int jjMoveStringLiteralDfa2_0(long old0, long active0) { 200 if (((active0 &= old0)) == 0L) 201 return jjStartNfa_0(0, old0); 202 try { 203 curChar = input_stream.readChar(); 204 } catch (java.io.IOException e) { 205 jjStopStringLiteralDfa_0(1, active0); 206 return 2; 207 } 208 switch (curChar) { 209 case 97: 210 return jjMoveStringLiteralDfa3_0(active0, 0x2000L); 211 case 108: 212 return jjMoveStringLiteralDfa3_0(active0, 0x500L); 213 case 110: 214 return jjMoveStringLiteralDfa3_0(active0, 0x4000L); 215 case 111: 216 return jjMoveStringLiteralDfa3_0(active0, 0x8060L); 217 case 116: 218 if ((active0 & 0x800L) != 0L) 219 return jjStartNfaWithStates_0(2, 11, 28); 220 return jjMoveStringLiteralDfa3_0(active0, 0x1000L); 221 case 117: 222 return jjMoveStringLiteralDfa3_0(active0, 0x280L); 223 default : 224 break; 225 } 226 return jjStartNfa_0(1, active0); 227 } 228 229 private final int jjMoveStringLiteralDfa3_0(long old0, long active0) { 230 if (((active0 &= old0)) == 0L) 231 return jjStartNfa_0(1, old0); 232 try { 233 curChar = input_stream.readChar(); 234 } catch (java.io.IOException e) { 235 jjStopStringLiteralDfa_0(2, active0); 236 return 3; 237 } 238 switch (curChar) { 239 case 97: 240 return jjMoveStringLiteralDfa4_0(active0, 0x40L); 241 case 98: 242 return jjMoveStringLiteralDfa4_0(active0, 0x80L); 243 case 101: 244 if ((active0 & 0x200L) != 0L) 245 return jjStartNfaWithStates_0(3, 9, 28); 246 else if ((active0 & 0x1000L) != 0L) 247 return jjStartNfaWithStates_0(3, 12, 28); 248 break; 249 case 103: 250 if ((active0 & 0x4000L) != 0L) 251 return jjStartNfaWithStates_0(3, 14, 28); 252 break; 253 case 108: 254 if ((active0 & 0x100L) != 0L) 255 return jjStartNfaWithStates_0(3, 8, 28); 256 return jjMoveStringLiteralDfa4_0(active0, 0x20L); 257 case 114: 258 if ((active0 & 0x2000L) != 0L) 259 return jjStartNfaWithStates_0(3, 13, 28); 260 return jjMoveStringLiteralDfa4_0(active0, 0x8000L); 261 case 115: 262 return jjMoveStringLiteralDfa4_0(active0, 0x400L); 263 default : 264 break; 265 } 266 return jjStartNfa_0(2, active0); 267 } 268 269 private final int jjMoveStringLiteralDfa4_0(long old0, long active0) { 270 if (((active0 &= old0)) == 0L) 271 return jjStartNfa_0(2, old0); 272 try { 273 curChar = input_stream.readChar(); 274 } catch (java.io.IOException e) { 275 jjStopStringLiteralDfa_0(3, active0); 276 return 4; 277 } 278 switch (curChar) { 279 case 101: 280 if ((active0 & 0x400L) != 0L) 281 return jjStartNfaWithStates_0(4, 10, 28); 282 return jjMoveStringLiteralDfa5_0(active0, 0x20L); 283 case 108: 284 return jjMoveStringLiteralDfa5_0(active0, 0x80L); 285 case 116: 286 if ((active0 & 0x40L) != 0L) 287 return jjStartNfaWithStates_0(4, 6, 28); 288 else if ((active0 & 0x8000L) != 0L) 289 return jjStartNfaWithStates_0(4, 15, 28); 290 break; 291 default : 292 break; 293 } 294 return jjStartNfa_0(3, active0); 295 } 296 297 private final int jjMoveStringLiteralDfa5_0(long old0, long active0) { 298 if (((active0 &= old0)) == 0L) 299 return jjStartNfa_0(3, old0); 300 try { 301 curChar = input_stream.readChar(); 302 } catch (java.io.IOException e) { 303 jjStopStringLiteralDfa_0(4, active0); 304 return 5; 305 } 306 switch (curChar) { 307 case 97: 308 return jjMoveStringLiteralDfa6_0(active0, 0x20L); 309 case 101: 310 if ((active0 & 0x80L) != 0L) 311 return jjStartNfaWithStates_0(5, 7, 28); 312 break; 313 default : 314 break; 315 } 316 return jjStartNfa_0(4, active0); 317 } 318 319 private final int jjMoveStringLiteralDfa6_0(long old0, long active0) { 320 if (((active0 &= old0)) == 0L) 321 return jjStartNfa_0(4, old0); 322 try { 323 curChar = input_stream.readChar(); 324 } catch (java.io.IOException e) { 325 jjStopStringLiteralDfa_0(5, active0); 326 return 6; 327 } 328 switch (curChar) { 329 case 110: 330 if ((active0 & 0x20L) != 0L) 331 return jjStartNfaWithStates_0(6, 5, 28); 332 break; 333 default : 334 break; 335 } 336 return jjStartNfa_0(5, active0); 337 } 338 339 private final void jjCheckNAdd(int state) { 340 if (jjrounds[state] != jjround) { 341 jjstateSet[jjnewStateCnt++] = state; 342 jjrounds[state] = jjround; 343 } 344 } 345 346 private final void jjAddStates(int start, int end) { 347 do { 348 jjstateSet[jjnewStateCnt++] = jjnextStates[start]; 349 } while (start++ != end); 350 } 351 352 private final void jjCheckNAddTwoStates(int state1, int state2) { 353 jjCheckNAdd(state1); 354 jjCheckNAdd(state2); 355 } 356 357 private final void jjCheckNAddStates(int start, int end) { 358 do { 359 jjCheckNAdd(jjnextStates[start]); 360 } while (start++ != end); 361 } 362 363 private final void jjCheckNAddStates(int start) { 364 jjCheckNAdd(jjnextStates[start]); 365 jjCheckNAdd(jjnextStates[start + 1]); 366 } 367 368 static final long[] jjbitVec0 = { 369 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL 370 }; 371 372 private final int jjMoveNfa_0(int startState, int curPos) { 373 int[] nextStates; 374 int startsAt = 0; 375 jjnewStateCnt = 48; 376 int i = 1; 377 jjstateSet[0] = startState; 378 int j, kind = 0x7fffffff; 379 for (; ;) { 380 if (++jjround == 0x7fffffff) 381 ReInitRounds(); 382 if (curChar < 64) { 383 long l = 1L << curChar; 384 MatchLoop: do { 385 switch (jjstateSet[--i]) { 386 case 0: 387 if ((0x3ff000000000000L & l) != 0L) 388 jjCheckNAddStates(0, 6); 389 else if (curChar == 36) { 390 if (kind > 42) 391 kind = 42; 392 jjCheckNAdd(28); 393 } else if (curChar == 34) 394 jjCheckNAddStates(7, 9); 395 else if (curChar == 39) 396 jjAddStates(10, 11); 397 else if (curChar == 46) 398 jjCheckNAdd(4); 399 if ((0x3fe000000000000L & l) != 0L) { 400 if (kind > 34) 401 kind = 34; 402 jjCheckNAddTwoStates(1, 2); 403 } else if (curChar == 48) { 404 if (kind > 34) 405 kind = 34; 406 jjCheckNAddStates(12, 14); 407 } 408 break; 409 case 1: 410 if ((0x3ff000000000000L & l) == 0L) 411 break; 412 if (kind > 34) 413 kind = 34; 414 jjCheckNAddTwoStates(1, 2); 415 break; 416 case 3: 417 if (curChar == 46) 418 jjCheckNAdd(4); 419 break; 420 case 4: 421 if ((0x3ff000000000000L & l) == 0L) 422 break; 423 if (kind > 38) 424 kind = 38; 425 jjCheckNAddStates(15, 17); 426 break; 427 case 6: 428 if ((0x280000000000L & l) != 0L) 429 jjCheckNAdd(7); 430 break; 431 case 7: 432 if ((0x3ff000000000000L & l) == 0L) 433 break; 434 if (kind > 38) 435 kind = 38; 436 jjCheckNAddTwoStates(7, 8); 437 break; 438 case 9: 439 if (curChar == 39) 440 jjAddStates(10, 11); 441 break; 442 case 10: 443 if ((0xffffff7fffffdbffL & l) != 0L) 444 jjCheckNAdd(11); 445 break; 446 case 11: 447 if (curChar == 39 && kind > 40) 448 kind = 40; 449 break; 450 case 13: 451 if ((0x8400000000L & l) != 0L) 452 jjCheckNAdd(11); 453 break; 454 case 14: 455 if ((0xff000000000000L & l) != 0L) 456 jjCheckNAddTwoStates(15, 11); 457 break; 458 case 15: 459 if ((0xff000000000000L & l) != 0L) 460 jjCheckNAdd(11); 461 break; 462 case 16: 463 if ((0xf000000000000L & l) != 0L) 464 jjstateSet[jjnewStateCnt++] = 17; 465 break; 466 case 17: 467 if ((0xff000000000000L & l) != 0L) 468 jjCheckNAdd(15); 469 break; 470 case 18: 471 if (curChar == 34) 472 jjCheckNAddStates(7, 9); 473 break; 474 case 19: 475 if ((0xfffffffbffffdbffL & l) != 0L) 476 jjCheckNAddStates(7, 9); 477 break; 478 case 21: 479 if ((0x8400000000L & l) != 0L) 480 jjCheckNAddStates(7, 9); 481 break; 482 case 22: 483 if (curChar == 34 && kind > 41) 484 kind = 41; 485 break; 486 case 23: 487 if ((0xff000000000000L & l) != 0L) 488 jjCheckNAddStates(18, 21); 489 break; 490 case 24: 491 if ((0xff000000000000L & l) != 0L) 492 jjCheckNAddStates(7, 9); 493 break; 494 case 25: 495 if ((0xf000000000000L & l) != 0L) 496 jjstateSet[jjnewStateCnt++] = 26; 497 break; 498 case 26: 499 if ((0xff000000000000L & l) != 0L) 500 jjCheckNAdd(24); 501 break; 502 case 27: 503 if (curChar != 36) 504 break; 505 if (kind > 42) 506 kind = 42; 507 jjCheckNAdd(28); 508 break; 509 case 28: 510 if ((0x3ff001000000000L & l) == 0L) 511 break; 512 if (kind > 42) 513 kind = 42; 514 jjCheckNAdd(28); 515 break; 516 case 29: 517 if ((0x3ff000000000000L & l) != 0L) 518 jjCheckNAddStates(0, 6); 519 break; 520 case 30: 521 if ((0x3ff000000000000L & l) != 0L) 522 jjCheckNAddTwoStates(30, 31); 523 break; 524 case 31: 525 if (curChar != 46) 526 break; 527 if (kind > 38) 528 kind = 38; 529 jjCheckNAddStates(22, 24); 530 break; 531 case 32: 532 if ((0x3ff000000000000L & l) == 0L) 533 break; 534 if (kind > 38) 535 kind = 38; 536 jjCheckNAddStates(22, 24); 537 break; 538 case 34: 539 if ((0x280000000000L & l) != 0L) 540 jjCheckNAdd(35); 541 break; 542 case 35: 543 if ((0x3ff000000000000L & l) == 0L) 544 break; 545 if (kind > 38) 546 kind = 38; 547 jjCheckNAddTwoStates(35, 8); 548 break; 549 case 36: 550 if ((0x3ff000000000000L & l) != 0L) 551 jjCheckNAddTwoStates(36, 37); 552 break; 553 case 38: 554 if ((0x280000000000L & l) != 0L) 555 jjCheckNAdd(39); 556 break; 557 case 39: 558 if ((0x3ff000000000000L & l) == 0L) 559 break; 560 if (kind > 38) 561 kind = 38; 562 jjCheckNAddTwoStates(39, 8); 563 break; 564 case 40: 565 if ((0x3ff000000000000L & l) != 0L) 566 jjCheckNAddStates(25, 27); 567 break; 568 case 42: 569 if ((0x280000000000L & l) != 0L) 570 jjCheckNAdd(43); 571 break; 572 case 43: 573 if ((0x3ff000000000000L & l) != 0L) 574 jjCheckNAddTwoStates(43, 8); 575 break; 576 case 44: 577 if (curChar != 48) 578 break; 579 if (kind > 34) 580 kind = 34; 581 jjCheckNAddStates(12, 14); 582 break; 583 case 46: 584 if ((0x3ff000000000000L & l) == 0L) 585 break; 586 if (kind > 34) 587 kind = 34; 588 jjCheckNAddTwoStates(46, 2); 589 break; 590 case 47: 591 if ((0xff000000000000L & l) == 0L) 592 break; 593 if (kind > 34) 594 kind = 34; 595 jjCheckNAddTwoStates(47, 2); 596 break; 597 default : 598 break; 599 } 600 } while (i != startsAt); 601 } else if (curChar < 128) { 602 long l = 1L << (curChar & 077); 603 MatchLoop: do { 604 switch (jjstateSet[--i]) { 605 case 0: 606 case 28: 607 if ((0x7fffffe87fffffeL & l) == 0L) 608 break; 609 if (kind > 42) 610 kind = 42; 611 jjCheckNAdd(28); 612 break; 613 case 2: 614 if ((0x100000001000L & l) != 0L && kind > 34) 615 kind = 34; 616 break; 617 case 5: 618 if ((0x2000000020L & l) != 0L) 619 jjAddStates(28, 29); 620 break; 621 case 8: 622 if ((0x5000000050L & l) != 0L && kind > 38) 623 kind = 38; 624 break; 625 case 10: 626 if ((0xffffffffefffffffL & l) != 0L) 627 jjCheckNAdd(11); 628 break; 629 case 12: 630 if (curChar == 92) 631 jjAddStates(30, 32); 632 break; 633 case 13: 634 if ((0x14404410000000L & l) != 0L) 635 jjCheckNAdd(11); 636 break; 637 case 19: 638 if ((0xffffffffefffffffL & l) != 0L) 639 jjCheckNAddStates(7, 9); 640 break; 641 case 20: 642 if (curChar == 92) 643 jjAddStates(33, 35); 644 break; 645 case 21: 646 if ((0x14404410000000L & l) != 0L) 647 jjCheckNAddStates(7, 9); 648 break; 649 case 33: 650 if ((0x2000000020L & l) != 0L) 651 jjAddStates(36, 37); 652 break; 653 case 37: 654 if ((0x2000000020L & l) != 0L) 655 jjAddStates(38, 39); 656 break; 657 case 41: 658 if ((0x2000000020L & l) != 0L) 659 jjAddStates(40, 41); 660 break; 661 case 45: 662 if ((0x100000001000000L & l) != 0L) 663 jjCheckNAdd(46); 664 break; 665 case 46: 666 if ((0x7e0000007eL & l) == 0L) 667 break; 668 if (kind > 34) 669 kind = 34; 670 jjCheckNAddTwoStates(46, 2); 671 break; 672 default : 673 break; 674 } 675 } while (i != startsAt); 676 } else { 677 int i2 = (curChar & 0xff) >> 6; 678 long l2 = 1L << (curChar & 077); 679 MatchLoop: do { 680 switch (jjstateSet[--i]) { 681 case 10: 682 if ((jjbitVec0[i2] & l2) != 0L) 683 jjstateSet[jjnewStateCnt++] = 11; 684 break; 685 case 19: 686 if ((jjbitVec0[i2] & l2) != 0L) 687 jjAddStates(7, 9); 688 break; 689 default : 690 break; 691 } 692 } while (i != startsAt); 693 } 694 if (kind != 0x7fffffff) { 695 jjmatchedKind = kind; 696 jjmatchedPos = curPos; 697 kind = 0x7fffffff; 698 } 699 ++curPos; 700 if ((i = jjnewStateCnt) == (startsAt = 48 - (jjnewStateCnt = startsAt))) 701 return curPos; 702 try { 703 curChar = input_stream.readChar(); 704 } catch (java.io.IOException e) { 705 return curPos; 706 } 707 } 708 } 709 710 static final int[] jjnextStates = { 711 30, 31, 36, 37, 40, 41, 8, 19, 20, 22, 10, 12, 45, 47, 2, 4, 712 5, 8, 19, 20, 24, 22, 32, 33, 8, 40, 41, 8, 6, 7, 13, 14, 713 16, 21, 23, 25, 34, 35, 38, 39, 42, 43, 714 }; 715 public static final String [] jjstrLiteralImages = { 716 "", null, null, null, null, "\142\157\157\154\145\141\156", 717 "\146\154\157\141\164", "\144\157\165\142\154\145", "\156\165\154\154", "\164\162\165\145", 718 "\146\141\154\163\145", "\151\156\164", "\142\171\164\145", "\143\150\141\162", "\154\157\156\147", 719 "\163\150\157\162\164", "\74", "\76", "\74\75", "\76\75", "\53", "\55", "\52", "\57", "\75\75", 720 "\41\75", "\174\174", "\46\46", "\174", "\136", "\46", "\176", "\41", "\56", null, null, 721 null, null, null, null, null, null, null, null, null, "\50", "\51", }; 722 public static final String [] lexStateNames = { 723 "DEFAULT", 724 }; 725 static final long[] jjtoToken = { 726 0x6747ffffffe1L, 727 }; 728 static final long[] jjtoSkip = { 729 0x1eL, 730 }; 731 private SimpleCharStream input_stream; 732 private final int[] jjrounds = new int[48]; 733 private final int[] jjstateSet = new int[96]; 734 protected char curChar; 735 736 public SpeedoQLTokenManager(SimpleCharStream stream) { 737 if (SimpleCharStream.staticFlag) 738 throw new Error ("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); 739 input_stream = stream; 740 } 741 742 public SpeedoQLTokenManager(SimpleCharStream stream, int lexState) { 743 this(stream); 744 SwitchTo(lexState); 745 } 746 747 public void ReInit(SimpleCharStream stream) { 748 jjmatchedPos = jjnewStateCnt = 0; 749 curLexState = defaultLexState; 750 input_stream = stream; 751 ReInitRounds(); 752 } 753 754 private final void ReInitRounds() { 755 int i; 756 jjround = 0x80000001; 757 for (i = 48; i-- > 0;) 758 jjrounds[i] = 0x80000000; 759 } 760 761 public void ReInit(SimpleCharStream stream, int lexState) { 762 ReInit(stream); 763 SwitchTo(lexState); 764 } 765 766 public void SwitchTo(int lexState) { 767 if (lexState >= 1 || lexState < 0) 768 throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); 769 else 770 curLexState = lexState; 771 } 772 773 private final Token jjFillToken() { 774 Token t = Token.newToken(jjmatchedKind); 775 t.kind = jjmatchedKind; 776 String im = jjstrLiteralImages[jjmatchedKind]; 777 t.image = (im == null) ? input_stream.GetImage() : im; 778 t.beginLine = input_stream.getBeginLine(); 779 t.beginColumn = input_stream.getBeginColumn(); 780 t.endLine = input_stream.getEndLine(); 781 t.endColumn = input_stream.getEndColumn(); 782 return t; 783 } 784 785 int curLexState = 0; 786 int defaultLexState = 0; 787 int jjnewStateCnt; 788 int jjround; 789 int jjmatchedPos; 790 int jjmatchedKind; 791 792 public final Token getNextToken() { 793 int kind; 794 Token specialToken = null; 795 Token matchedToken; 796 int curPos = 0; 797 798 EOFLoop : 799 for (; ;) { 800 try { 801 curChar = input_stream.BeginToken(); 802 } catch (java.io.IOException e) { 803 jjmatchedKind = 0; 804 matchedToken = jjFillToken(); 805 return matchedToken; 806 } 807 808 try { 809 input_stream.backup(0); 810 while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L) 811 curChar = input_stream.BeginToken(); 812 } catch (java.io.IOException e1) { 813 continue EOFLoop; 814 } 815 jjmatchedKind = 0x7fffffff; 816 jjmatchedPos = 0; 817 curPos = jjMoveStringLiteralDfa0_0(); 818 if (jjmatchedKind != 0x7fffffff) { 819 if (jjmatchedPos + 1 < curPos) 820 input_stream.backup(curPos - jjmatchedPos - 1); 821 if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { 822 matchedToken = jjFillToken(); 823 return matchedToken; 824 } else { 825 continue EOFLoop; 826 } 827 } 828 int error_line = input_stream.getEndLine(); 829 int error_column = input_stream.getEndColumn(); 830 String error_after = null; 831 boolean EOFSeen = false; 832 try { 833 input_stream.readChar(); 834 input_stream.backup(1); 835 } catch (java.io.IOException e1) { 836 EOFSeen = true; 837 error_after = curPos <= 1 ? "" : input_stream.GetImage(); 838 if (curChar == '\n' || curChar == '\r') { 839 error_line++; 840 error_column = 0; 841 } else 842 error_column++; 843 } 844 if (!EOFSeen) { 845 input_stream.backup(1); 846 error_after = curPos <= 1 ? "" : input_stream.GetImage(); 847 } 848 throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); 849 } 850 } 851 852 } 853 | Popular Tags |