001/* PropertyListParserTokenManager.java */ 002/* Generated By:JavaCC: Do not edit this line. PropertyListParserTokenManager.java */ 003package org.apache.commons.configuration.plist; 004import java.util.Date; 005import java.util.List; 006import java.util.ArrayList; 007import org.apache.commons.configuration.HierarchicalConfiguration; 008import org.apache.commons.configuration.HierarchicalConfiguration.Node; 009import org.apache.commons.codec.binary.Hex; 010 011/** Token Manager. */ 012@SuppressWarnings ("unused") 013public class PropertyListParserTokenManager implements PropertyListParserConstants { 014 015 /** Debug output. */ 016 public java.io.PrintStream debugStream = System.out; 017 /** Set debug output. */ 018 public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } 019private final int jjStopStringLiteralDfa_0(int pos, long active0){ 020 switch (pos) 021 { 022 case 0: 023 if ((active0 & 0x20000120L) != 0L) 024 { 025 jjmatchedKind = 27; 026 return 8; 027 } 028 if ((active0 & 0x80000L) != 0L) 029 return 8; 030 if ((active0 & 0x200000L) != 0L) 031 return 14; 032 if ((active0 & 0x140000L) != 0L) 033 return 6; 034 return -1; 035 case 1: 036 if ((active0 & 0x100000L) != 0L) 037 { 038 jjmatchedKind = 27; 039 jjmatchedPos = 1; 040 return 3; 041 } 042 if ((active0 & 0x120L) != 0L) 043 return 8; 044 return -1; 045 default : 046 return -1; 047 } 048} 049private final int jjStartNfa_0(int pos, long active0){ 050 return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); 051} 052private int jjStopAtPos(int pos, int kind) 053{ 054 jjmatchedKind = kind; 055 jjmatchedPos = pos; 056 return pos + 1; 057} 058private int jjMoveStringLiteralDfa0_0(){ 059 switch(curChar) 060 { 061 case 34: 062 return jjStartNfaWithStates_0(0, 21, 14); 063 case 40: 064 return jjStopAtPos(0, 11); 065 case 41: 066 return jjStopAtPos(0, 12); 067 case 44: 068 return jjStopAtPos(0, 13); 069 case 47: 070 return jjMoveStringLiteralDfa1_0(0x120L); 071 case 59: 072 return jjStopAtPos(0, 16); 073 case 60: 074 jjmatchedKind = 18; 075 return jjMoveStringLiteralDfa1_0(0x100000L); 076 case 61: 077 return jjStopAtPos(0, 17); 078 case 62: 079 return jjStartNfaWithStates_0(0, 19, 8); 080 case 92: 081 return jjMoveStringLiteralDfa1_0(0x20000000L); 082 case 123: 083 return jjStopAtPos(0, 14); 084 case 125: 085 return jjStopAtPos(0, 15); 086 default : 087 return jjMoveNfa_0(0, 0); 088 } 089} 090private int jjMoveStringLiteralDfa1_0(long active0){ 091 try { curChar = input_stream.readChar(); } 092 catch(java.io.IOException e) { 093 jjStopStringLiteralDfa_0(0, active0); 094 return 1; 095 } 096 switch(curChar) 097 { 098 case 34: 099 if ((active0 & 0x20000000L) != 0L) 100 return jjStopAtPos(1, 29); 101 break; 102 case 42: 103 if ((active0 & 0x20L) != 0L) 104 return jjStartNfaWithStates_0(1, 5, 8); 105 return jjMoveStringLiteralDfa2_0(active0, 0x100000L); 106 case 47: 107 if ((active0 & 0x100L) != 0L) 108 return jjStartNfaWithStates_0(1, 8, 8); 109 break; 110 default : 111 break; 112 } 113 return jjStartNfa_0(0, active0); 114} 115private int jjMoveStringLiteralDfa2_0(long old0, long active0){ 116 if (((active0 &= old0)) == 0L) 117 return jjStartNfa_0(0, old0); 118 try { curChar = input_stream.readChar(); } 119 catch(java.io.IOException e) { 120 jjStopStringLiteralDfa_0(1, active0); 121 return 2; 122 } 123 switch(curChar) 124 { 125 case 68: 126 if ((active0 & 0x100000L) != 0L) 127 return jjStartNfaWithStates_0(2, 20, 15); 128 break; 129 default : 130 break; 131 } 132 return jjStartNfa_0(1, active0); 133} 134private int jjStartNfaWithStates_0(int pos, int kind, int state) 135{ 136 jjmatchedKind = kind; 137 jjmatchedPos = pos; 138 try { curChar = input_stream.readChar(); } 139 catch(java.io.IOException e) { return pos + 1; } 140 return jjMoveNfa_0(state, pos + 1); 141} 142static final long[] jjbitVec0 = { 143 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL 144}; 145private int jjMoveNfa_0(int startState, int curPos) 146{ 147 int startsAt = 0; 148 jjnewStateCnt = 14; 149 int i = 1; 150 jjstateSet[0] = startState; 151 int kind = 0x7fffffff; 152 for (;;) 153 { 154 if (++jjround == 0x7fffffff) 155 ReInitRounds(); 156 if (curChar < 64) 157 { 158 long l = 1L << curChar; 159 do 160 { 161 switch(jjstateSet[--i]) 162 { 163 case 15: 164 if ((0xd7ffecfaffffd9ffL & l) != 0L) 165 { 166 if (kind > 27) 167 kind = 27; 168 { jjCheckNAdd(8); } 169 } 170 if ((0x7ff280100000000L & l) != 0L) 171 { jjCheckNAddTwoStates(4, 5); } 172 else if (curChar == 62) 173 { 174 if (kind > 26) 175 kind = 26; 176 } 177 break; 178 case 6: 179 if ((0xd7ffecfaffffd9ffL & l) != 0L) 180 { 181 if (kind > 27) 182 kind = 27; 183 { jjCheckNAdd(8); } 184 } 185 if ((0x3ff000100002600L & l) != 0L) 186 { jjCheckNAddTwoStates(1, 2); } 187 else if (curChar == 42) 188 jjstateSet[jjnewStateCnt++] = 3; 189 else if (curChar == 62) 190 { 191 if (kind > 25) 192 kind = 25; 193 } 194 break; 195 case 14: 196 if ((0xfffffffbffffffffL & l) != 0L) 197 { jjCheckNAddStates(0, 2); } 198 else if (curChar == 34) 199 { 200 if (kind > 28) 201 kind = 28; 202 } 203 break; 204 case 3: 205 case 8: 206 if ((0xd7ffecfaffffd9ffL & l) == 0L) 207 break; 208 if (kind > 27) 209 kind = 27; 210 { jjCheckNAdd(8); } 211 break; 212 case 0: 213 if ((0xd7ffecfaffffd9ffL & l) != 0L) 214 { 215 if (kind > 27) 216 kind = 27; 217 { jjCheckNAdd(8); } 218 } 219 else if (curChar == 34) 220 { jjCheckNAddStates(0, 2); } 221 if (curChar == 60) 222 jjstateSet[jjnewStateCnt++] = 6; 223 if (curChar == 60) 224 { jjCheckNAddTwoStates(1, 2); } 225 break; 226 case 1: 227 if ((0x3ff000100002600L & l) != 0L) 228 { jjCheckNAddTwoStates(1, 2); } 229 break; 230 case 2: 231 if (curChar == 62 && kind > 25) 232 kind = 25; 233 break; 234 case 4: 235 if ((0x7ff280100000000L & l) != 0L) 236 { jjCheckNAddTwoStates(4, 5); } 237 break; 238 case 5: 239 if (curChar == 62 && kind > 26) 240 kind = 26; 241 break; 242 case 7: 243 if (curChar == 60) 244 jjstateSet[jjnewStateCnt++] = 6; 245 break; 246 case 9: 247 case 11: 248 if (curChar == 34) 249 { jjCheckNAddStates(0, 2); } 250 break; 251 case 10: 252 if ((0xfffffffbffffffffL & l) != 0L) 253 { jjCheckNAddStates(0, 2); } 254 break; 255 case 13: 256 if (curChar == 34 && kind > 28) 257 kind = 28; 258 break; 259 default : break; 260 } 261 } while(i != startsAt); 262 } 263 else if (curChar < 128) 264 { 265 long l = 1L << (curChar & 077); 266 do 267 { 268 switch(jjstateSet[--i]) 269 { 270 case 15: 271 if ((0xd7ffffffffffffffL & l) != 0L) 272 { 273 if (kind > 27) 274 kind = 27; 275 { jjCheckNAdd(8); } 276 } 277 if (curChar == 90) 278 { jjCheckNAddTwoStates(4, 5); } 279 break; 280 case 6: 281 if ((0xd7ffffffffffffffL & l) != 0L) 282 { 283 if (kind > 27) 284 kind = 27; 285 { jjCheckNAdd(8); } 286 } 287 if ((0x7e0000007eL & l) != 0L) 288 { jjCheckNAddTwoStates(1, 2); } 289 break; 290 case 14: 291 { jjCheckNAddStates(0, 2); } 292 if (curChar == 92) 293 jjstateSet[jjnewStateCnt++] = 11; 294 break; 295 case 3: 296 if ((0xd7ffffffffffffffL & l) != 0L) 297 { 298 if (kind > 27) 299 kind = 27; 300 { jjCheckNAdd(8); } 301 } 302 if (curChar == 68) 303 { jjCheckNAddTwoStates(4, 5); } 304 break; 305 case 0: 306 case 8: 307 if ((0xd7ffffffffffffffL & l) == 0L) 308 break; 309 if (kind > 27) 310 kind = 27; 311 { jjCheckNAdd(8); } 312 break; 313 case 1: 314 if ((0x7e0000007eL & l) != 0L) 315 { jjCheckNAddTwoStates(1, 2); } 316 break; 317 case 4: 318 if (curChar == 90) 319 { jjCheckNAddTwoStates(4, 5); } 320 break; 321 case 10: 322 { jjCheckNAddStates(0, 2); } 323 break; 324 case 12: 325 if (curChar == 92) 326 jjstateSet[jjnewStateCnt++] = 11; 327 break; 328 default : break; 329 } 330 } while(i != startsAt); 331 } 332 else 333 { 334 int i2 = (curChar & 0xff) >> 6; 335 long l2 = 1L << (curChar & 077); 336 do 337 { 338 switch(jjstateSet[--i]) 339 { 340 case 15: 341 case 8: 342 if ((jjbitVec0[i2] & l2) == 0L) 343 break; 344 if (kind > 27) 345 kind = 27; 346 { jjCheckNAdd(8); } 347 break; 348 case 6: 349 if ((jjbitVec0[i2] & l2) == 0L) 350 break; 351 if (kind > 27) 352 kind = 27; 353 { jjCheckNAdd(8); } 354 break; 355 case 14: 356 case 10: 357 if ((jjbitVec0[i2] & l2) != 0L) 358 { jjCheckNAddStates(0, 2); } 359 break; 360 case 3: 361 if ((jjbitVec0[i2] & l2) == 0L) 362 break; 363 if (kind > 27) 364 kind = 27; 365 { jjCheckNAdd(8); } 366 break; 367 case 0: 368 if ((jjbitVec0[i2] & l2) == 0L) 369 break; 370 if (kind > 27) 371 kind = 27; 372 { jjCheckNAdd(8); } 373 break; 374 default : break; 375 } 376 } while(i != startsAt); 377 } 378 if (kind != 0x7fffffff) 379 { 380 jjmatchedKind = kind; 381 jjmatchedPos = curPos; 382 kind = 0x7fffffff; 383 } 384 ++curPos; 385 if ((i = jjnewStateCnt) == (startsAt = 14 - (jjnewStateCnt = startsAt))) 386 return curPos; 387 try { curChar = input_stream.readChar(); } 388 catch(java.io.IOException e) { return curPos; } 389 } 390} 391private int jjMoveStringLiteralDfa0_2() 392{ 393 return jjMoveNfa_2(0, 0); 394} 395private int jjMoveNfa_2(int startState, int curPos) 396{ 397 int startsAt = 0; 398 jjnewStateCnt = 3; 399 int i = 1; 400 jjstateSet[0] = startState; 401 int kind = 0x7fffffff; 402 for (;;) 403 { 404 if (++jjround == 0x7fffffff) 405 ReInitRounds(); 406 if (curChar < 64) 407 { 408 long l = 1L << curChar; 409 do 410 { 411 switch(jjstateSet[--i]) 412 { 413 case 0: 414 if ((0x2400L & l) != 0L) 415 { 416 if (kind > 9) 417 kind = 9; 418 } 419 if (curChar == 13) 420 jjstateSet[jjnewStateCnt++] = 1; 421 break; 422 case 1: 423 if (curChar == 10 && kind > 9) 424 kind = 9; 425 break; 426 case 2: 427 if (curChar == 13) 428 jjstateSet[jjnewStateCnt++] = 1; 429 break; 430 default : break; 431 } 432 } while(i != startsAt); 433 } 434 else if (curChar < 128) 435 { 436 long l = 1L << (curChar & 077); 437 do 438 { 439 switch(jjstateSet[--i]) 440 { 441 default : break; 442 } 443 } while(i != startsAt); 444 } 445 else 446 { 447 int i2 = (curChar & 0xff) >> 6; 448 long l2 = 1L << (curChar & 077); 449 do 450 { 451 switch(jjstateSet[--i]) 452 { 453 default : break; 454 } 455 } while(i != startsAt); 456 } 457 if (kind != 0x7fffffff) 458 { 459 jjmatchedKind = kind; 460 jjmatchedPos = curPos; 461 kind = 0x7fffffff; 462 } 463 ++curPos; 464 if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt))) 465 return curPos; 466 try { curChar = input_stream.readChar(); } 467 catch(java.io.IOException e) { return curPos; } 468 } 469} 470private int jjMoveStringLiteralDfa0_1(){ 471 switch(curChar) 472 { 473 case 42: 474 return jjMoveStringLiteralDfa1_1(0x80L); 475 default : 476 return 1; 477 } 478} 479private int jjMoveStringLiteralDfa1_1(long active0){ 480 try { curChar = input_stream.readChar(); } 481 catch(java.io.IOException e) { 482 return 1; 483 } 484 switch(curChar) 485 { 486 case 47: 487 if ((active0 & 0x80L) != 0L) 488 return jjStopAtPos(1, 7); 489 break; 490 default : 491 return 2; 492 } 493 return 2; 494} 495 496/** Token literal values. */ 497public static final String[] jjstrLiteralImages = { 498"", null, null, null, null, null, null, null, null, null, null, "\50", "\51", 499"\54", "\173", "\175", "\73", "\75", "\74", "\76", "\74\52\104", "\42", null, null, 500null, null, null, null, null, "\134\42", }; 501protected Token jjFillToken() 502{ 503 final Token t; 504 final String curTokenImage; 505 final int beginLine; 506 final int endLine; 507 final int beginColumn; 508 final int endColumn; 509 String im = jjstrLiteralImages[jjmatchedKind]; 510 curTokenImage = (im == null) ? input_stream.GetImage() : im; 511 beginLine = input_stream.getBeginLine(); 512 beginColumn = input_stream.getBeginColumn(); 513 endLine = input_stream.getEndLine(); 514 endColumn = input_stream.getEndColumn(); 515 t = Token.newToken(jjmatchedKind, curTokenImage); 516 517 t.beginLine = beginLine; 518 t.endLine = endLine; 519 t.beginColumn = beginColumn; 520 t.endColumn = endColumn; 521 522 return t; 523} 524static final int[] jjnextStates = { 525 10, 12, 13, 526}; 527 528int curLexState = 0; 529int defaultLexState = 0; 530int jjnewStateCnt; 531int jjround; 532int jjmatchedPos; 533int jjmatchedKind; 534 535/** Get the next Token. */ 536public Token getNextToken() 537{ 538 Token specialToken = null; 539 Token matchedToken; 540 int curPos = 0; 541 542 EOFLoop : 543 for (;;) 544 { 545 try 546 { 547 curChar = input_stream.BeginToken(); 548 } 549 catch(Exception e) 550 { 551 jjmatchedKind = 0; 552 jjmatchedPos = -1; 553 matchedToken = jjFillToken(); 554 matchedToken.specialToken = specialToken; 555 return matchedToken; 556 } 557 image = jjimage; 558 image.setLength(0); 559 jjimageLen = 0; 560 561 for (;;) 562 { 563 switch(curLexState) 564 { 565 case 0: 566 try { input_stream.backup(0); 567 while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L) 568 curChar = input_stream.BeginToken(); 569 } 570 catch (java.io.IOException e1) { continue EOFLoop; } 571 jjmatchedKind = 0x7fffffff; 572 jjmatchedPos = 0; 573 curPos = jjMoveStringLiteralDfa0_0(); 574 break; 575 case 1: 576 jjmatchedKind = 0x7fffffff; 577 jjmatchedPos = 0; 578 curPos = jjMoveStringLiteralDfa0_1(); 579 if (jjmatchedPos == 0 && jjmatchedKind > 6) 580 { 581 jjmatchedKind = 6; 582 } 583 break; 584 case 2: 585 jjmatchedKind = 0x7fffffff; 586 jjmatchedPos = 0; 587 curPos = jjMoveStringLiteralDfa0_2(); 588 if (jjmatchedPos == 0 && jjmatchedKind > 10) 589 { 590 jjmatchedKind = 10; 591 } 592 break; 593 } 594 if (jjmatchedKind != 0x7fffffff) 595 { 596 if (jjmatchedPos + 1 < curPos) 597 input_stream.backup(curPos - jjmatchedPos - 1); 598 if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) 599 { 600 matchedToken = jjFillToken(); 601 matchedToken.specialToken = specialToken; 602 if (jjnewLexState[jjmatchedKind] != -1) 603 curLexState = jjnewLexState[jjmatchedKind]; 604 return matchedToken; 605 } 606 else if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) 607 { 608 if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) 609 { 610 matchedToken = jjFillToken(); 611 if (specialToken == null) 612 specialToken = matchedToken; 613 else 614 { 615 matchedToken.specialToken = specialToken; 616 specialToken = (specialToken.next = matchedToken); 617 } 618 SkipLexicalActions(matchedToken); 619 } 620 else 621 SkipLexicalActions(null); 622 if (jjnewLexState[jjmatchedKind] != -1) 623 curLexState = jjnewLexState[jjmatchedKind]; 624 continue EOFLoop; 625 } 626 jjimageLen += jjmatchedPos + 1; 627 if (jjnewLexState[jjmatchedKind] != -1) 628 curLexState = jjnewLexState[jjmatchedKind]; 629 curPos = 0; 630 jjmatchedKind = 0x7fffffff; 631 try { 632 curChar = input_stream.readChar(); 633 continue; 634 } 635 catch (java.io.IOException e1) { } 636 } 637 int error_line = input_stream.getEndLine(); 638 int error_column = input_stream.getEndColumn(); 639 String error_after = null; 640 boolean EOFSeen = false; 641 try { input_stream.readChar(); input_stream.backup(1); } 642 catch (java.io.IOException e1) { 643 EOFSeen = true; 644 error_after = curPos <= 1 ? "" : input_stream.GetImage(); 645 if (curChar == '\n' || curChar == '\r') { 646 error_line++; 647 error_column = 0; 648 } 649 else 650 error_column++; 651 } 652 if (!EOFSeen) { 653 input_stream.backup(1); 654 error_after = curPos <= 1 ? "" : input_stream.GetImage(); 655 } 656 throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); 657 } 658 } 659} 660 661void SkipLexicalActions(Token matchedToken) 662{ 663 switch(jjmatchedKind) 664 { 665 default : 666 break; 667 } 668} 669void MoreLexicalActions() 670{ 671 jjimageLen += (lengthOfMatch = jjmatchedPos + 1); 672 switch(jjmatchedKind) 673 { 674 default : 675 break; 676 } 677} 678void TokenLexicalActions(Token matchedToken) 679{ 680 switch(jjmatchedKind) 681 { 682 default : 683 break; 684 } 685} 686private void jjCheckNAdd(int state) 687{ 688 if (jjrounds[state] != jjround) 689 { 690 jjstateSet[jjnewStateCnt++] = state; 691 jjrounds[state] = jjround; 692 } 693} 694private void jjAddStates(int start, int end) 695{ 696 do { 697 jjstateSet[jjnewStateCnt++] = jjnextStates[start]; 698 } while (start++ != end); 699} 700private void jjCheckNAddTwoStates(int state1, int state2) 701{ 702 jjCheckNAdd(state1); 703 jjCheckNAdd(state2); 704} 705 706private void jjCheckNAddStates(int start, int end) 707{ 708 do { 709 jjCheckNAdd(jjnextStates[start]); 710 } while (start++ != end); 711} 712 713 /** Constructor. */ 714 public PropertyListParserTokenManager(SimpleCharStream stream){ 715 716 if (SimpleCharStream.staticFlag) 717 throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); 718 719 input_stream = stream; 720 } 721 722 /** Constructor. */ 723 public PropertyListParserTokenManager (SimpleCharStream stream, int lexState){ 724 ReInit(stream); 725 SwitchTo(lexState); 726 } 727 728 /** Reinitialise parser. */ 729 730 public void ReInit(SimpleCharStream stream) 731 { 732 733 734 jjmatchedPos = 735 jjnewStateCnt = 736 0; 737 curLexState = defaultLexState; 738 input_stream = stream; 739 ReInitRounds(); 740 } 741 742 private void ReInitRounds() 743 { 744 int i; 745 jjround = 0x80000001; 746 for (i = 14; i-- > 0;) 747 jjrounds[i] = 0x80000000; 748 } 749 750 /** Reinitialise parser. */ 751 public void ReInit(SimpleCharStream stream, int lexState) 752 753 { 754 ReInit(stream); 755 SwitchTo(lexState); 756 } 757 758 /** Switch to specified lex state. */ 759 public void SwitchTo(int lexState) 760 { 761 if (lexState >= 3 || lexState < 0) 762 throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); 763 else 764 curLexState = lexState; 765 } 766 767 768/** Lexer state names. */ 769public static final String[] lexStateNames = { 770 "DEFAULT", 771 "IN_COMMENT", 772 "IN_SINGLE_LINE_COMMENT", 773}; 774 775/** Lex State array. */ 776public static final int[] jjnewLexState = { 777 -1, -1, -1, -1, -1, 1, -1, 0, 2, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 778 -1, -1, -1, -1, -1, 779}; 780static final long[] jjtoToken = { 781 0x3e3ff801L, 782}; 783static final long[] jjtoSkip = { 784 0x29eL, 785}; 786static final long[] jjtoSpecial = { 787 0x200L, 788}; 789static final long[] jjtoMore = { 790 0x560L, 791}; 792 protected SimpleCharStream input_stream; 793 794 private final int[] jjrounds = new int[14]; 795 private final int[] jjstateSet = new int[2 * 14]; 796 private final StringBuilder jjimage = new StringBuilder(); 797 private StringBuilder image = jjimage; 798 private int jjimageLen; 799 private int lengthOfMatch; 800 protected int curChar; 801}