View Javadoc

    1   /* Generated By:JavaCC: Do not edit this line. PropertyListParserTokenManager.java */
    2   package org.apache.commons.configuration.plist;
    3
    4   import java.io.IOException;
    5   import java.io.PrintStream;
    6
    7   class PropertyListParserTokenManager implements PropertyListParserConstants
    8   {
    9       public PrintStream debugStream = System.out;
    10
    11      private final int jjStopStringLiteralDfa_0(int pos, long active0)
    12      {
    13          switch (pos)
    14          {
    15              case 0:
    16                  if ((active0 & 0x4000L) != 0L)
    17                      return 9;
    18                  if ((active0 & 0x1000L) != 0L)
    19                      return 10;
    20                  if ((active0 & 0x2000L) != 0L)
    21                      return 3;
    22                  if ((active0 & 0x200000L) != 0L)
    23                  {
    24                      jjmatchedKind = 19;
    25                      return 3;
    26                  }
    27                  return -1;
    28              default :
    29                  return -1;
    30          }
    31      }
    32
    33      private final int jjStartNfa_0(int pos, long active0)
    34      {
    35          return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
    36      }
    37
    38      private final int jjStopAtPos(int pos, int kind)
    39      {
    40          jjmatchedKind = kind;
    41          jjmatchedPos = pos;
    42          return pos + 1;
    43      }
    44
    45      private final int jjStartNfaWithStates_0(int pos, int kind, int state)
    46      {
    47          jjmatchedKind = kind;
    48          jjmatchedPos = pos;
    49          try
    50          {
    51              curChar = input_stream.readChar();
    52          }
    53          catch (IOException e)
    54          {
    55              return pos + 1;
    56          }
    57          return jjMoveNfa_0(state, pos + 1);
    58      }
    59
    60      private final int jjMoveStringLiteralDfa0_0()
    61      {
    62          switch (curChar)
    63          {
    64              case 34:
    65                  return jjStartNfaWithStates_0(0, 14, 9);
    66              case 40:
    67                  return jjStopAtPos(0, 5);
    68              case 41:
    69                  return jjStopAtPos(0, 6);
    70              case 44:
    71                  return jjStopAtPos(0, 7);
    72              case 59:
    73                  return jjStopAtPos(0, 10);
    74              case 60:
    75                  return jjStartNfaWithStates_0(0, 12, 10);
    76              case 61:
    77                  return jjStopAtPos(0, 11);
    78              case 62:
    79                  return jjStartNfaWithStates_0(0, 13, 3);
    80              case 92:
    81                  return jjMoveStringLiteralDfa1_0(0x200000L);
    82              case 123:
    83                  return jjStopAtPos(0, 8);
    84              case 125:
    85                  return jjStopAtPos(0, 9);
    86              default :
    87                  return jjMoveNfa_0(0, 0);
    88          }
    89      }
    90
    91      private final int jjMoveStringLiteralDfa1_0(long active0)
    92      {
    93          try
    94          {
    95              curChar = input_stream.readChar();
    96          }
    97          catch (IOException e)
    98          {
    99              jjStopStringLiteralDfa_0(0, active0);
    100             return 1;
    101         }
    102         switch (curChar)
    103         {
    104             case 34:
    105                 if ((active0 & 0x200000L) != 0L)
    106                     return jjStopAtPos(1, 21);
    107                 break;
    108             default :
    109                 break;
    110         }
    111         return jjStartNfa_0(0, active0);
    112     }
    113
    114     private final void jjCheckNAdd(int state)
    115     {
    116         if (jjrounds[state] != jjround)
    117         {
    118             jjstateSet[jjnewStateCnt++] = state;
    119             jjrounds[state] = jjround;
    120         }
    121     }
    122
    123     private final void jjCheckNAddTwoStates(int state1, int state2)
    124     {
    125         jjCheckNAdd(state1);
    126         jjCheckNAdd(state2);
    127     }
    128
    129     private final void jjCheckNAddStates(int start, int end)
    130     {
    131         do
    132         {
    133             jjCheckNAdd(jjnextStates[start]);
    134         }
    135         while (start++ != end);
    136     }
    137
    138     static final long[] jjbitVec0 = {
    139         0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
    140     };
    141
    142     private final int jjMoveNfa_0(int startState, int curPos)
    143     {
    144         int startsAt = 0;
    145         jjnewStateCnt = 9;
    146         int i = 1;
    147         jjstateSet[0] = startState;
    148         int kind = 0x7fffffff;
    149         for (; ;)
    150         {
    151             if (++jjround == 0x7fffffff)
    152                 ReInitRounds();
    153             if (curChar < 64)
    154             {
    155                 long l = 1L << curChar;
    156                 MatchLoop: do
    157                 {
    158                     switch (jjstateSet[--i])
    159                     {
    160                         case 9:
    161                             if ((0xfffffffbffffffffL & l) != 0L)
    162                                 jjCheckNAddStates(0, 2);
    163                             else if (curChar == 34)
    164                             {
    165                                 if (kind > 20)
    166                                     kind = 20;
    167                             }
    168                             break;
    169                         case 10:
    170                             if ((0xd7ffecfaffffd9ffL & l) != 0L)
    171                             {
    172                                 if (kind > 19)
    173                                     kind = 19;
    174                                 jjCheckNAdd(3);
    175                             }
    176                             if ((0x3ff000100002600L & l) != 0L)
    177                                 jjCheckNAddTwoStates(1, 2);
    178                             else if (curChar == 62)
    179                             {
    180                                 if (kind > 18)
    181                                     kind = 18;
    182                             }
    183                             break;
    184                         case 0:
    185                             if ((0xd7ffecfaffffd9ffL & l) != 0L)
    186                             {
    187                                 if (kind > 19)
    188                                     kind = 19;
    189                                 jjCheckNAdd(3);
    190                             }
    191                             else if (curChar == 34)
    192                                 jjCheckNAddStates(0, 2);
    193                             if (curChar == 60)
    194                                 jjCheckNAddTwoStates(1, 2);
    195                             break;
    196                         case 1:
    197                             if ((0x3ff000100002600L & l) != 0L)
    198                                 jjCheckNAddTwoStates(1, 2);
    199                             break;
    200                         case 2:
    201                             if (curChar == 62 && kind > 18)
    202                                 kind = 18;
    203                             break;
    204                         case 3:
    205                             if ((0xd7ffecfaffffd9ffL & l) == 0L)
    206                                 break;
    207                             if (kind > 19)
    208                                 kind = 19;
    209                             jjCheckNAdd(3);
    210                             break;
    211                         case 4:
    212                         case 6:
    213                             if (curChar == 34)
    214                                 jjCheckNAddStates(0, 2);
    215                             break;
    216                         case 5:
    217                             if ((0xfffffffbffffffffL & l) != 0L)
    218                                 jjCheckNAddStates(0, 2);
    219                             break;
    220                         case 8:
    221                             if (curChar == 34 && kind > 20)
    222                                 kind = 20;
    223                             break;
    224                         default :
    225                             break;
    226                     }
    227                 }
    228                 while (i != startsAt);
    229             }
    230             else if (curChar < 128)
    231             {
    232                 long l = 1L << (curChar & 077);
    233                 MatchLoop: do
    234                 {
    235                     switch (jjstateSet[--i])
    236                     {
    237                         case 9:
    238                             jjCheckNAddStates(0, 2);
    239                             if (curChar == 92)
    240                                 jjstateSet[jjnewStateCnt++] = 6;
    241                             break;
    242                         case 10:
    243                             if ((0xd7ffffffffffffffL & l) != 0L)
    244                             {
    245                                 if (kind > 19)
    246                                     kind = 19;
    247                                 jjCheckNAdd(3);
    248                             }
    249                             if ((0x7e0000007eL & l) != 0L)
    250                                 jjCheckNAddTwoStates(1, 2);
    251                             break;
    252                         case 0:
    253                         case 3:
    254                             if ((0xd7ffffffffffffffL & l) == 0L)
    255                                 break;
    256                             if (kind > 19)
    257                                 kind = 19;
    258                             jjCheckNAdd(3);
    259                             break;
    260                         case 1:
    261                             if ((0x7e0000007eL & l) != 0L)
    262                                 jjCheckNAddTwoStates(1, 2);
    263                             break;
    264                         case 5:
    265                             jjCheckNAddStates(0, 2);
    266                             break;
    267                         case 7:
    268                             if (curChar == 92)
    269                                 jjstateSet[jjnewStateCnt++] = 6;
    270                             break;
    271                         default :
    272                             break;
    273                     }
    274                 }
    275                 while (i != startsAt);
    276             }
    277             else
    278             {
    279                 int i2 = (curChar & 0xff) >> 6;
    280                 long l2 = 1L << (curChar & 077);
    281                 MatchLoop: do
    282                 {
    283                     switch (jjstateSet[--i])
    284                     {
    285                         case 9:
    286                         case 5:
    287                             if ((jjbitVec0[i2] & l2) != 0L)
    288                                 jjCheckNAddStates(0, 2);
    289                             break;
    290                         case 10:
    291                         case 3:
    292                             if ((jjbitVec0[i2] & l2) == 0L)
    293                                 break;
    294                             if (kind > 19)
    295                                 kind = 19;
    296                             jjCheckNAdd(3);
    297                             break;
    298                         case 0:
    299                             if ((jjbitVec0[i2] & l2) == 0L)
    300                                 break;
    301                             if (kind > 19)
    302                                 kind = 19;
    303                             jjCheckNAdd(3);
    304                             break;
    305                         default :
    306                             break;
    307                     }
    308                 }
    309                 while (i != startsAt);
    310             }
    311             if (kind != 0x7fffffff)
    312             {
    313                 jjmatchedKind = kind;
    314                 jjmatchedPos = curPos;
    315                 kind = 0x7fffffff;
    316             }
    317             ++curPos;
    318             if ((i = jjnewStateCnt) == (startsAt = 9 - (jjnewStateCnt = startsAt)))
    319                 return curPos;
    320             try
    321             {
    322                 curChar = input_stream.readChar();
    323             }
    324             catch (IOException e)
    325             {
    326                 return curPos;
    327             }
    328         }
    329     }
    330
    331     static final int[] jjnextStates = {
    332         5, 7, 8,
    333     };
    334     public static final String[] jjstrLiteralImages = {
    335         "", null, null, null, null, "\50", "\51", "\54", "\173", "\175", "\73", "\75",
    336         "\74", "\76", "\42", null, null, null, null, null, null, "\134\42", };
    337     public static final String[] lexStateNames = {
    338         "DEFAULT",
    339     };
    340     static final long[] jjtoToken = {
    341         0x3c7fe1L,
    342     };
    343     static final long[] jjtoSkip = {
    344         0x1eL,
    345     };
    346     protected SimpleCharStream input_stream;
    347     private final int[] jjrounds = new int[9];
    348     private final int[] jjstateSet = new int[18];
    349     protected char curChar;
    350
    351     public PropertyListParserTokenManager(SimpleCharStream stream)
    352     {
    353         if (SimpleCharStream.staticFlag)
    354             throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
    355         input_stream = stream;
    356     }
    357
    358     public void ReInit(SimpleCharStream stream)
    359     {
    360         jjmatchedPos = jjnewStateCnt = 0;
    361         curLexState = defaultLexState;
    362         input_stream = stream;
    363         ReInitRounds();
    364     }
    365
    366     private final void ReInitRounds()
    367     {
    368         int i;
    369         jjround = 0x80000001;
    370         for (i = 9; i-- > 0;)
    371             jjrounds[i] = 0x80000000;
    372     }
    373
    374     protected Token jjFillToken()
    375     {
    376         Token t = Token.newToken(jjmatchedKind);
    377         t.kind = jjmatchedKind;
    378         String im = jjstrLiteralImages[jjmatchedKind];
    379         t.image = (im == null) ? input_stream.GetImage() : im;
    380         t.beginLine = input_stream.getBeginLine();
    381         t.beginColumn = input_stream.getBeginColumn();
    382         t.endLine = input_stream.getEndLine();
    383         t.endColumn = input_stream.getEndColumn();
    384         return t;
    385     }
    386
    387     int curLexState = 0;
    388     int defaultLexState = 0;
    389     int jjnewStateCnt;
    390     int jjround;
    391     int jjmatchedPos;
    392     int jjmatchedKind;
    393
    394     public Token getNextToken()
    395     {
    396         Token matchedToken;
    397         int curPos = 0;
    398
    399         EOFLoop :
    400         for (; ;)
    401         {
    402             try
    403             {
    404                 curChar = input_stream.BeginToken();
    405             }
    406             catch (IOException e)
    407             {
    408                 jjmatchedKind = 0;
    409                 matchedToken = jjFillToken();
    410                 return matchedToken;
    411             }
    412
    413             try
    414             {
    415                 input_stream.backup(0);
    416                 while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L)
    417                     curChar = input_stream.BeginToken();
    418             }
    419             catch (IOException e1)
    420             {
    421                 continue EOFLoop;
    422             }
    423             jjmatchedKind = 0x7fffffff;
    424             jjmatchedPos = 0;
    425             curPos = jjMoveStringLiteralDfa0_0();
    426             if (jjmatchedKind != 0x7fffffff)
    427             {
    428                 if (jjmatchedPos + 1 < curPos)
    429                     input_stream.backup(curPos - jjmatchedPos - 1);
    430                 if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
    431                 {
    432                     matchedToken = jjFillToken();
    433                     return matchedToken;
    434                 }
    435                 else
    436                 {
    437                     continue EOFLoop;
    438                 }
    439             }
    440             int error_line = input_stream.getEndLine();
    441             int error_column = input_stream.getEndColumn();
    442             String error_after = null;
    443             boolean EOFSeen = false;
    444             try
    445             {
    446                 input_stream.readChar();
    447                 input_stream.backup(1);
    448             }
    449             catch (IOException e1)
    450             {
    451                 EOFSeen = true;
    452                 error_after = curPos <= 1 ? "" : input_stream.GetImage();
    453                 if (curChar == '\n' || curChar == '\r')
    454                 {
    455                     error_line++;
    456                     error_column = 0;
    457                 }
    458                 else
    459                     error_column++;
    460             }
    461             if (!EOFSeen)
    462             {
    463                 input_stream.backup(1);
    464                 error_after = curPos <= 1 ? "" : input_stream.GetImage();
    465             }
    466             throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
    467         }
    468     }
    469
    470 }