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