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