001 /* Generated By:JJTree&JavaCC: Do not edit this line. AddressListParserTokenManager.java */ 002 /**************************************************************** 003 * Licensed to the Apache Software Foundation (ASF) under one * 004 * or more contributor license agreements. See the NOTICE file * 005 * distributed with this work for additional information * 006 * regarding copyright ownership. The ASF licenses this file * 007 * to you under the Apache License, Version 2.0 (the * 008 * "License"); you may not use this file except in compliance * 009 * with the License. You may obtain a copy of the License at * 010 * * 011 * http://www.apache.org/licenses/LICENSE-2.0 * 012 * * 013 * Unless required by applicable law or agreed to in writing, * 014 * software distributed under the License is distributed on an * 015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * 016 * KIND, either express or implied. See the License for the * 017 * specific language governing permissions and limitations * 018 * under the License. * 019 ****************************************************************/ 020 package org.apache.james.mime4j.field.address; 021 022 /** Token Manager. */ 023 public class AddressListParserTokenManager implements AddressListParserConstants 024 { 025 // Keeps track of how many levels of comment nesting 026 // we've encountered. This is only used when the 2nd 027 // level is reached, for example ((this)), not (this). 028 // This is because the outermost level must be treated 029 // specially anyway, because the outermost ")" has a 030 // different token type than inner ")" instances. 031 static int commentNest; 032 033 /** Debug output. */ 034 public java.io.PrintStream debugStream = System.out; 035 /** Set debug output. */ 036 public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } 037 private final int jjStopStringLiteralDfa_0(int pos, long active0) 038 { 039 switch (pos) 040 { 041 default : 042 return -1; 043 } 044 } 045 private final int jjStartNfa_0(int pos, long active0) 046 { 047 return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); 048 } 049 private int jjStopAtPos(int pos, int kind) 050 { 051 jjmatchedKind = kind; 052 jjmatchedPos = pos; 053 return pos + 1; 054 } 055 private int jjMoveStringLiteralDfa0_0() 056 { 057 switch(curChar) 058 { 059 case 10: 060 return jjStopAtPos(0, 2); 061 case 13: 062 return jjStopAtPos(0, 1); 063 case 34: 064 return jjStopAtPos(0, 28); 065 case 40: 066 return jjStopAtPos(0, 19); 067 case 44: 068 return jjStopAtPos(0, 3); 069 case 46: 070 return jjStopAtPos(0, 9); 071 case 58: 072 return jjStopAtPos(0, 4); 073 case 59: 074 return jjStopAtPos(0, 5); 075 case 60: 076 return jjStopAtPos(0, 6); 077 case 62: 078 return jjStopAtPos(0, 7); 079 case 64: 080 return jjStopAtPos(0, 8); 081 case 91: 082 return jjStopAtPos(0, 15); 083 default : 084 return jjMoveNfa_0(1, 0); 085 } 086 } 087 private int jjMoveNfa_0(int startState, int curPos) 088 { 089 int startsAt = 0; 090 jjnewStateCnt = 3; 091 int i = 1; 092 jjstateSet[0] = startState; 093 int kind = 0x7fffffff; 094 for (;;) 095 { 096 if (++jjround == 0x7fffffff) 097 ReInitRounds(); 098 if (curChar < 64) 099 { 100 long l = 1L << curChar; 101 do 102 { 103 switch(jjstateSet[--i]) 104 { 105 case 1: 106 if ((0xa3ffacfa00000000L & l) != 0L) 107 { 108 if (kind > 14) 109 kind = 14; 110 jjCheckNAdd(2); 111 } 112 else if ((0x100000200L & l) != 0L) 113 { 114 if (kind > 10) 115 kind = 10; 116 jjCheckNAdd(0); 117 } 118 break; 119 case 0: 120 if ((0x100000200L & l) == 0L) 121 break; 122 kind = 10; 123 jjCheckNAdd(0); 124 break; 125 case 2: 126 if ((0xa3ffecfa00000000L & l) == 0L) 127 break; 128 if (kind > 14) 129 kind = 14; 130 jjCheckNAdd(2); 131 break; 132 default : break; 133 } 134 } while(i != startsAt); 135 } 136 else if (curChar < 128) 137 { 138 long l = 1L << (curChar & 077); 139 do 140 { 141 switch(jjstateSet[--i]) 142 { 143 case 1: 144 case 2: 145 if ((0x7fffffffc7fffffeL & l) == 0L) 146 break; 147 if (kind > 14) 148 kind = 14; 149 jjCheckNAdd(2); 150 break; 151 default : break; 152 } 153 } while(i != startsAt); 154 } 155 else 156 { 157 int i2 = (curChar & 0xff) >> 6; 158 long l2 = 1L << (curChar & 077); 159 do 160 { 161 switch(jjstateSet[--i]) 162 { 163 default : break; 164 } 165 } while(i != startsAt); 166 } 167 if (kind != 0x7fffffff) 168 { 169 jjmatchedKind = kind; 170 jjmatchedPos = curPos; 171 kind = 0x7fffffff; 172 } 173 ++curPos; 174 if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt))) 175 return curPos; 176 try { curChar = input_stream.readChar(); } 177 catch(java.io.IOException e) { return curPos; } 178 } 179 } 180 private final int jjStopStringLiteralDfa_2(int pos, long active0) 181 { 182 switch (pos) 183 { 184 default : 185 return -1; 186 } 187 } 188 private final int jjStartNfa_2(int pos, long active0) 189 { 190 return jjMoveNfa_2(jjStopStringLiteralDfa_2(pos, active0), pos + 1); 191 } 192 private int jjMoveStringLiteralDfa0_2() 193 { 194 switch(curChar) 195 { 196 case 40: 197 return jjStopAtPos(0, 22); 198 case 41: 199 return jjStopAtPos(0, 20); 200 default : 201 return jjMoveNfa_2(0, 0); 202 } 203 } 204 static final long[] jjbitVec0 = { 205 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL 206 }; 207 private int jjMoveNfa_2(int startState, int curPos) 208 { 209 int startsAt = 0; 210 jjnewStateCnt = 3; 211 int i = 1; 212 jjstateSet[0] = startState; 213 int kind = 0x7fffffff; 214 for (;;) 215 { 216 if (++jjround == 0x7fffffff) 217 ReInitRounds(); 218 if (curChar < 64) 219 { 220 long l = 1L << curChar; 221 do 222 { 223 switch(jjstateSet[--i]) 224 { 225 case 0: 226 if (kind > 23) 227 kind = 23; 228 break; 229 case 1: 230 if (kind > 21) 231 kind = 21; 232 break; 233 default : break; 234 } 235 } while(i != startsAt); 236 } 237 else if (curChar < 128) 238 { 239 long l = 1L << (curChar & 077); 240 do 241 { 242 switch(jjstateSet[--i]) 243 { 244 case 0: 245 if (kind > 23) 246 kind = 23; 247 if (curChar == 92) 248 jjstateSet[jjnewStateCnt++] = 1; 249 break; 250 case 1: 251 if (kind > 21) 252 kind = 21; 253 break; 254 case 2: 255 if (kind > 23) 256 kind = 23; 257 break; 258 default : break; 259 } 260 } while(i != startsAt); 261 } 262 else 263 { 264 int i2 = (curChar & 0xff) >> 6; 265 long l2 = 1L << (curChar & 077); 266 do 267 { 268 switch(jjstateSet[--i]) 269 { 270 case 0: 271 if ((jjbitVec0[i2] & l2) != 0L && kind > 23) 272 kind = 23; 273 break; 274 case 1: 275 if ((jjbitVec0[i2] & l2) != 0L && kind > 21) 276 kind = 21; 277 break; 278 default : break; 279 } 280 } while(i != startsAt); 281 } 282 if (kind != 0x7fffffff) 283 { 284 jjmatchedKind = kind; 285 jjmatchedPos = curPos; 286 kind = 0x7fffffff; 287 } 288 ++curPos; 289 if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt))) 290 return curPos; 291 try { curChar = input_stream.readChar(); } 292 catch(java.io.IOException e) { return curPos; } 293 } 294 } 295 private final int jjStopStringLiteralDfa_4(int pos, long active0) 296 { 297 switch (pos) 298 { 299 default : 300 return -1; 301 } 302 } 303 private final int jjStartNfa_4(int pos, long active0) 304 { 305 return jjMoveNfa_4(jjStopStringLiteralDfa_4(pos, active0), pos + 1); 306 } 307 private int jjMoveStringLiteralDfa0_4() 308 { 309 switch(curChar) 310 { 311 case 34: 312 return jjStopAtPos(0, 31); 313 default : 314 return jjMoveNfa_4(0, 0); 315 } 316 } 317 private int jjMoveNfa_4(int startState, int curPos) 318 { 319 int startsAt = 0; 320 jjnewStateCnt = 3; 321 int i = 1; 322 jjstateSet[0] = startState; 323 int kind = 0x7fffffff; 324 for (;;) 325 { 326 if (++jjround == 0x7fffffff) 327 ReInitRounds(); 328 if (curChar < 64) 329 { 330 long l = 1L << curChar; 331 do 332 { 333 switch(jjstateSet[--i]) 334 { 335 case 0: 336 case 2: 337 if ((0xfffffffbffffffffL & l) == 0L) 338 break; 339 if (kind > 30) 340 kind = 30; 341 jjCheckNAdd(2); 342 break; 343 case 1: 344 if (kind > 29) 345 kind = 29; 346 break; 347 default : break; 348 } 349 } while(i != startsAt); 350 } 351 else if (curChar < 128) 352 { 353 long l = 1L << (curChar & 077); 354 do 355 { 356 switch(jjstateSet[--i]) 357 { 358 case 0: 359 if ((0xffffffffefffffffL & l) != 0L) 360 { 361 if (kind > 30) 362 kind = 30; 363 jjCheckNAdd(2); 364 } 365 else if (curChar == 92) 366 jjstateSet[jjnewStateCnt++] = 1; 367 break; 368 case 1: 369 if (kind > 29) 370 kind = 29; 371 break; 372 case 2: 373 if ((0xffffffffefffffffL & l) == 0L) 374 break; 375 if (kind > 30) 376 kind = 30; 377 jjCheckNAdd(2); 378 break; 379 default : break; 380 } 381 } while(i != startsAt); 382 } 383 else 384 { 385 int i2 = (curChar & 0xff) >> 6; 386 long l2 = 1L << (curChar & 077); 387 do 388 { 389 switch(jjstateSet[--i]) 390 { 391 case 0: 392 case 2: 393 if ((jjbitVec0[i2] & l2) == 0L) 394 break; 395 if (kind > 30) 396 kind = 30; 397 jjCheckNAdd(2); 398 break; 399 case 1: 400 if ((jjbitVec0[i2] & l2) != 0L && kind > 29) 401 kind = 29; 402 break; 403 default : break; 404 } 405 } while(i != startsAt); 406 } 407 if (kind != 0x7fffffff) 408 { 409 jjmatchedKind = kind; 410 jjmatchedPos = curPos; 411 kind = 0x7fffffff; 412 } 413 ++curPos; 414 if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt))) 415 return curPos; 416 try { curChar = input_stream.readChar(); } 417 catch(java.io.IOException e) { return curPos; } 418 } 419 } 420 private final int jjStopStringLiteralDfa_3(int pos, long active0) 421 { 422 switch (pos) 423 { 424 default : 425 return -1; 426 } 427 } 428 private final int jjStartNfa_3(int pos, long active0) 429 { 430 return jjMoveNfa_3(jjStopStringLiteralDfa_3(pos, active0), pos + 1); 431 } 432 private int jjMoveStringLiteralDfa0_3() 433 { 434 switch(curChar) 435 { 436 case 40: 437 return jjStopAtPos(0, 25); 438 case 41: 439 return jjStopAtPos(0, 26); 440 default : 441 return jjMoveNfa_3(0, 0); 442 } 443 } 444 private int jjMoveNfa_3(int startState, int curPos) 445 { 446 int startsAt = 0; 447 jjnewStateCnt = 3; 448 int i = 1; 449 jjstateSet[0] = startState; 450 int kind = 0x7fffffff; 451 for (;;) 452 { 453 if (++jjround == 0x7fffffff) 454 ReInitRounds(); 455 if (curChar < 64) 456 { 457 long l = 1L << curChar; 458 do 459 { 460 switch(jjstateSet[--i]) 461 { 462 case 0: 463 if (kind > 27) 464 kind = 27; 465 break; 466 case 1: 467 if (kind > 24) 468 kind = 24; 469 break; 470 default : break; 471 } 472 } while(i != startsAt); 473 } 474 else if (curChar < 128) 475 { 476 long l = 1L << (curChar & 077); 477 do 478 { 479 switch(jjstateSet[--i]) 480 { 481 case 0: 482 if (kind > 27) 483 kind = 27; 484 if (curChar == 92) 485 jjstateSet[jjnewStateCnt++] = 1; 486 break; 487 case 1: 488 if (kind > 24) 489 kind = 24; 490 break; 491 case 2: 492 if (kind > 27) 493 kind = 27; 494 break; 495 default : break; 496 } 497 } while(i != startsAt); 498 } 499 else 500 { 501 int i2 = (curChar & 0xff) >> 6; 502 long l2 = 1L << (curChar & 077); 503 do 504 { 505 switch(jjstateSet[--i]) 506 { 507 case 0: 508 if ((jjbitVec0[i2] & l2) != 0L && kind > 27) 509 kind = 27; 510 break; 511 case 1: 512 if ((jjbitVec0[i2] & l2) != 0L && kind > 24) 513 kind = 24; 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 = 3 - (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 default : 537 return -1; 538 } 539 } 540 private final int jjStartNfa_1(int pos, long active0) 541 { 542 return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0), pos + 1); 543 } 544 private int jjMoveStringLiteralDfa0_1() 545 { 546 switch(curChar) 547 { 548 case 93: 549 return jjStopAtPos(0, 18); 550 default : 551 return jjMoveNfa_1(0, 0); 552 } 553 } 554 private int jjMoveNfa_1(int startState, int curPos) 555 { 556 int startsAt = 0; 557 jjnewStateCnt = 3; 558 int i = 1; 559 jjstateSet[0] = startState; 560 int kind = 0x7fffffff; 561 for (;;) 562 { 563 if (++jjround == 0x7fffffff) 564 ReInitRounds(); 565 if (curChar < 64) 566 { 567 long l = 1L << curChar; 568 do 569 { 570 switch(jjstateSet[--i]) 571 { 572 case 0: 573 if (kind > 17) 574 kind = 17; 575 break; 576 case 1: 577 if (kind > 16) 578 kind = 16; 579 break; 580 default : break; 581 } 582 } while(i != startsAt); 583 } 584 else if (curChar < 128) 585 { 586 long l = 1L << (curChar & 077); 587 do 588 { 589 switch(jjstateSet[--i]) 590 { 591 case 0: 592 if ((0xffffffffc7ffffffL & l) != 0L) 593 { 594 if (kind > 17) 595 kind = 17; 596 } 597 else if (curChar == 92) 598 jjstateSet[jjnewStateCnt++] = 1; 599 break; 600 case 1: 601 if (kind > 16) 602 kind = 16; 603 break; 604 case 2: 605 if ((0xffffffffc7ffffffL & l) != 0L && kind > 17) 606 kind = 17; 607 break; 608 default : break; 609 } 610 } while(i != startsAt); 611 } 612 else 613 { 614 int i2 = (curChar & 0xff) >> 6; 615 long l2 = 1L << (curChar & 077); 616 do 617 { 618 switch(jjstateSet[--i]) 619 { 620 case 0: 621 if ((jjbitVec0[i2] & l2) != 0L && kind > 17) 622 kind = 17; 623 break; 624 case 1: 625 if ((jjbitVec0[i2] & l2) != 0L && kind > 16) 626 kind = 16; 627 break; 628 default : break; 629 } 630 } while(i != startsAt); 631 } 632 if (kind != 0x7fffffff) 633 { 634 jjmatchedKind = kind; 635 jjmatchedPos = curPos; 636 kind = 0x7fffffff; 637 } 638 ++curPos; 639 if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt))) 640 return curPos; 641 try { curChar = input_stream.readChar(); } 642 catch(java.io.IOException e) { return curPos; } 643 } 644 } 645 static final int[] jjnextStates = { 646 }; 647 648 /** Token literal values. */ 649 public static final String[] jjstrLiteralImages = { 650 "", "\15", "\12", "\54", "\72", "\73", "\74", "\76", "\100", "\56", null, null, 651 null, null, null, null, null, null, null, null, null, null, null, null, null, null, 652 null, null, null, null, null, null, null, null, }; 653 654 /** Lexer state names. */ 655 public static final String[] lexStateNames = { 656 "DEFAULT", 657 "INDOMAINLITERAL", 658 "INCOMMENT", 659 "NESTED_COMMENT", 660 "INQUOTEDSTRING", 661 }; 662 663 /** Lex State array. */ 664 public static final int[] jjnewLexState = { 665 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, 2, 0, -1, 3, -1, -1, 666 -1, -1, -1, 4, -1, -1, 0, -1, -1, 667 }; 668 static final long[] jjtoToken = { 669 0x800443ffL, 670 }; 671 static final long[] jjtoSkip = { 672 0x100400L, 673 }; 674 static final long[] jjtoSpecial = { 675 0x400L, 676 }; 677 static final long[] jjtoMore = { 678 0x7feb8000L, 679 }; 680 protected SimpleCharStream input_stream; 681 private final int[] jjrounds = new int[3]; 682 private final int[] jjstateSet = new int[6]; 683 private final StringBuilder jjimage = new StringBuilder(); 684 private StringBuilder image = jjimage; 685 private int jjimageLen; 686 private int lengthOfMatch; 687 protected char curChar; 688 /** Constructor. */ 689 public AddressListParserTokenManager(SimpleCharStream stream){ 690 if (SimpleCharStream.staticFlag) 691 throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); 692 input_stream = stream; 693 } 694 695 /** Constructor. */ 696 public AddressListParserTokenManager(SimpleCharStream stream, int lexState){ 697 this(stream); 698 SwitchTo(lexState); 699 } 700 701 /** Reinitialise parser. */ 702 public void ReInit(SimpleCharStream stream) 703 { 704 jjmatchedPos = jjnewStateCnt = 0; 705 curLexState = defaultLexState; 706 input_stream = stream; 707 ReInitRounds(); 708 } 709 private void ReInitRounds() 710 { 711 int i; 712 jjround = 0x80000001; 713 for (i = 3; i-- > 0;) 714 jjrounds[i] = 0x80000000; 715 } 716 717 /** Reinitialise parser. */ 718 public void ReInit(SimpleCharStream stream, int lexState) 719 { 720 ReInit(stream); 721 SwitchTo(lexState); 722 } 723 724 /** Switch to specified lex state. */ 725 public void SwitchTo(int lexState) 726 { 727 if (lexState >= 5 || lexState < 0) 728 throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); 729 else 730 curLexState = lexState; 731 } 732 733 protected Token jjFillToken() 734 { 735 final Token t; 736 final String curTokenImage; 737 final int beginLine; 738 final int endLine; 739 final int beginColumn; 740 final int endColumn; 741 String im = jjstrLiteralImages[jjmatchedKind]; 742 curTokenImage = (im == null) ? input_stream.GetImage() : im; 743 beginLine = input_stream.getBeginLine(); 744 beginColumn = input_stream.getBeginColumn(); 745 endLine = input_stream.getEndLine(); 746 endColumn = input_stream.getEndColumn(); 747 t = Token.newToken(jjmatchedKind, curTokenImage); 748 749 t.beginLine = beginLine; 750 t.endLine = endLine; 751 t.beginColumn = beginColumn; 752 t.endColumn = endColumn; 753 754 return t; 755 } 756 757 int curLexState = 0; 758 int defaultLexState = 0; 759 int jjnewStateCnt; 760 int jjround; 761 int jjmatchedPos; 762 int jjmatchedKind; 763 764 /** Get the next Token. */ 765 public Token getNextToken() 766 { 767 Token specialToken = null; 768 Token matchedToken; 769 int curPos = 0; 770 771 EOFLoop : 772 for (;;) 773 { 774 try 775 { 776 curChar = input_stream.BeginToken(); 777 } 778 catch(java.io.IOException e) 779 { 780 jjmatchedKind = 0; 781 matchedToken = jjFillToken(); 782 matchedToken.specialToken = specialToken; 783 return matchedToken; 784 } 785 image = jjimage; 786 image.setLength(0); 787 jjimageLen = 0; 788 789 for (;;) 790 { 791 switch(curLexState) 792 { 793 case 0: 794 jjmatchedKind = 0x7fffffff; 795 jjmatchedPos = 0; 796 curPos = jjMoveStringLiteralDfa0_0(); 797 break; 798 case 1: 799 jjmatchedKind = 0x7fffffff; 800 jjmatchedPos = 0; 801 curPos = jjMoveStringLiteralDfa0_1(); 802 break; 803 case 2: 804 jjmatchedKind = 0x7fffffff; 805 jjmatchedPos = 0; 806 curPos = jjMoveStringLiteralDfa0_2(); 807 break; 808 case 3: 809 jjmatchedKind = 0x7fffffff; 810 jjmatchedPos = 0; 811 curPos = jjMoveStringLiteralDfa0_3(); 812 break; 813 case 4: 814 jjmatchedKind = 0x7fffffff; 815 jjmatchedPos = 0; 816 curPos = jjMoveStringLiteralDfa0_4(); 817 break; 818 } 819 if (jjmatchedKind != 0x7fffffff) 820 { 821 if (jjmatchedPos + 1 < curPos) 822 input_stream.backup(curPos - jjmatchedPos - 1); 823 if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) 824 { 825 matchedToken = jjFillToken(); 826 matchedToken.specialToken = specialToken; 827 TokenLexicalActions(matchedToken); 828 if (jjnewLexState[jjmatchedKind] != -1) 829 curLexState = jjnewLexState[jjmatchedKind]; 830 return matchedToken; 831 } 832 else if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) 833 { 834 if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) 835 { 836 matchedToken = jjFillToken(); 837 if (specialToken == null) 838 specialToken = matchedToken; 839 else 840 { 841 matchedToken.specialToken = specialToken; 842 specialToken = (specialToken.next = matchedToken); 843 } 844 } 845 if (jjnewLexState[jjmatchedKind] != -1) 846 curLexState = jjnewLexState[jjmatchedKind]; 847 continue EOFLoop; 848 } 849 MoreLexicalActions(); 850 if (jjnewLexState[jjmatchedKind] != -1) 851 curLexState = jjnewLexState[jjmatchedKind]; 852 curPos = 0; 853 jjmatchedKind = 0x7fffffff; 854 try { 855 curChar = input_stream.readChar(); 856 continue; 857 } 858 catch (java.io.IOException e1) { } 859 } 860 int error_line = input_stream.getEndLine(); 861 int error_column = input_stream.getEndColumn(); 862 String error_after = null; 863 boolean EOFSeen = false; 864 try { input_stream.readChar(); input_stream.backup(1); } 865 catch (java.io.IOException e1) { 866 EOFSeen = true; 867 error_after = curPos <= 1 ? "" : input_stream.GetImage(); 868 if (curChar == '\n' || curChar == '\r') { 869 error_line++; 870 error_column = 0; 871 } 872 else 873 error_column++; 874 } 875 if (!EOFSeen) { 876 input_stream.backup(1); 877 error_after = curPos <= 1 ? "" : input_stream.GetImage(); 878 } 879 throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); 880 } 881 } 882 } 883 884 void MoreLexicalActions() 885 { 886 jjimageLen += (lengthOfMatch = jjmatchedPos + 1); 887 switch(jjmatchedKind) 888 { 889 case 16 : 890 image.append(input_stream.GetSuffix(jjimageLen)); 891 jjimageLen = 0; 892 image.deleteCharAt(image.length() - 2); 893 break; 894 case 21 : 895 image.append(input_stream.GetSuffix(jjimageLen)); 896 jjimageLen = 0; 897 image.deleteCharAt(image.length() - 2); 898 break; 899 case 22 : 900 image.append(input_stream.GetSuffix(jjimageLen)); 901 jjimageLen = 0; 902 commentNest = 1; 903 break; 904 case 24 : 905 image.append(input_stream.GetSuffix(jjimageLen)); 906 jjimageLen = 0; 907 image.deleteCharAt(image.length() - 2); 908 break; 909 case 25 : 910 image.append(input_stream.GetSuffix(jjimageLen)); 911 jjimageLen = 0; 912 ++commentNest; 913 break; 914 case 26 : 915 image.append(input_stream.GetSuffix(jjimageLen)); 916 jjimageLen = 0; 917 --commentNest; if (commentNest == 0) SwitchTo(INCOMMENT); 918 break; 919 case 28 : 920 image.append(input_stream.GetSuffix(jjimageLen)); 921 jjimageLen = 0; 922 image.deleteCharAt(image.length() - 1); 923 break; 924 case 29 : 925 image.append(input_stream.GetSuffix(jjimageLen)); 926 jjimageLen = 0; 927 image.deleteCharAt(image.length() - 2); 928 break; 929 default : 930 break; 931 } 932 } 933 void TokenLexicalActions(Token matchedToken) 934 { 935 switch(jjmatchedKind) 936 { 937 case 18 : 938 image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))); 939 matchedToken.image = image.toString(); 940 break; 941 case 31 : 942 image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))); 943 matchedToken.image = image.substring(0, image.length() - 1); 944 break; 945 default : 946 break; 947 } 948 } 949 private void jjCheckNAdd(int state) 950 { 951 if (jjrounds[state] != jjround) 952 { 953 jjstateSet[jjnewStateCnt++] = state; 954 jjrounds[state] = jjround; 955 } 956 } 957 private void jjAddStates(int start, int end) 958 { 959 do { 960 jjstateSet[jjnewStateCnt++] = jjnextStates[start]; 961 } while (start++ != end); 962 } 963 private void jjCheckNAddTwoStates(int state1, int state2) 964 { 965 jjCheckNAdd(state1); 966 jjCheckNAdd(state2); 967 } 968 969 }