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