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