View Javadoc

    1   /* Generated By:JavaCC: Do not edit this line. PropertyListParserTokenManager.java */
    2   package org.apache.commons.configuration.plist;
    3
    4   class PropertyListParserTokenManager implements PropertyListParserConstants
    5   {
    6       public java.io.PrintStream debugStream = System.out;
    7
    8       public void setDebugStream(java.io.PrintStream ds)
    9       {
    10          debugStream = ds;
    11      }
    12
    13      private final int jjStopStringLiteralDfa_0(int pos, long active0)
    14      {
    15          switch (pos)
    16          {
    17              case 0:
    18                  if ((active0 & 0x2000L) != 0L)
    19                  {
    20                      return 8;
    21                  }
    22                  if ((active0 & 0x8000L) != 0L)
    23                  {
    24                      return 14;
    25                  }
    26                  if ((active0 & 0x800000L) != 0L)
    27                  {
    28                      jjmatchedKind = 21;
    29                      return 8;
    30                  }
    31                  if ((active0 & 0x5000L) != 0L)
    32                  {
    33                      return 6;
    34                  }
    35                  return -1;
    36              case 1:
    37                  if ((active0 & 0x4000L) != 0L)
    38                  {
    39                      jjmatchedKind = 21;
    40                      jjmatchedPos = 1;
    41                      return 3;
    42                  }
    43                  return -1;
    44              default :
    45                  return -1;
    46          }
    47      }
    48
    49      private final int jjStartNfa_0(int pos, long active0)
    50      {
    51          return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
    52      }
    53
    54      private final int jjStopAtPos(int pos, int kind)
    55      {
    56          jjmatchedKind = kind;
    57          jjmatchedPos = pos;
    58          return pos + 1;
    59      }
    60
    61      private final int jjStartNfaWithStates_0(int pos, int kind, int state)
    62      {
    63          jjmatchedKind = kind;
    64          jjmatchedPos = pos;
    65          try
    66          {
    67              curChar = input_stream.readChar();
    68          }
    69          catch (java.io.IOException e)
    70          {
    71              return pos + 1;
    72          }
    73          return jjMoveNfa_0(state, pos + 1);
    74      }
    75
    76      private final int jjMoveStringLiteralDfa0_0()
    77      {
    78          switch (curChar)
    79          {
    80              case 34:
    81                  return jjStartNfaWithStates_0(0, 15, 14);
    82              case 40:
    83                  return jjStopAtPos(0, 5);
    84              case 41:
    85                  return jjStopAtPos(0, 6);
    86              case 44:
    87                  return jjStopAtPos(0, 7);
    88              case 59:
    89                  return jjStopAtPos(0, 10);
    90              case 60:
    91                  jjmatchedKind = 12;
    92                  return jjMoveStringLiteralDfa1_0(0x4000L);
    93              case 61:
    94                  return jjStopAtPos(0, 11);
    95              case 62:
    96                  return jjStartNfaWithStates_0(0, 13, 8);
    97              case 92:
    98                  return jjMoveStringLiteralDfa1_0(0x800000L);
    99              case 123:
    100                 return jjStopAtPos(0, 8);
    101             case 125:
    102                 return jjStopAtPos(0, 9);
    103             default :
    104                 return jjMoveNfa_0(0, 0);
    105         }
    106     }
    107
    108     private final int jjMoveStringLiteralDfa1_0(long active0)
    109     {
    110         try
    111         {
    112             curChar = input_stream.readChar();
    113         }
    114         catch (java.io.IOException e)
    115         {
    116             jjStopStringLiteralDfa_0(0, active0);
    117             return 1;
    118         }
    119         switch (curChar)
    120         {
    121             case 34:
    122                 if ((active0 & 0x800000L) != 0L)
    123                 {
    124                     return jjStopAtPos(1, 23);
    125                 }
    126                 break;
    127             case 42:
    128                 return jjMoveStringLiteralDfa2_0(active0, 0x4000L);
    129             default :
    130                 break;
    131         }
    132         return jjStartNfa_0(0, active0);
    133     }
    134
    135     private final int jjMoveStringLiteralDfa2_0(long old0, long active0)
    136     {
    137         if (((active0 &= old0)) == 0L)
    138         {
    139             return jjStartNfa_0(0, old0);
    140         }
    141         try
    142         {
    143             curChar = input_stream.readChar();
    144         }
    145         catch (java.io.IOException e)
    146         {
    147             jjStopStringLiteralDfa_0(1, active0);
    148             return 2;
    149         }
    150         switch (curChar)
    151         {
    152             case 68:
    153                 if ((active0 & 0x4000L) != 0L)
    154                 {
    155                     return jjStartNfaWithStates_0(2, 14, 15);
    156                 }
    157                 break;
    158             default :
    159                 break;
    160         }
    161         return jjStartNfa_0(1, active0);
    162     }
    163
    164     private final void jjCheckNAdd(int state)
    165     {
    166         if (jjrounds[state] != jjround)
    167         {
    168             jjstateSet[jjnewStateCnt++] = state;
    169             jjrounds[state] = jjround;
    170         }
    171     }
    172
    173     private final void jjAddStates(int start, int end)
    174     {
    175         do
    176         {
    177             jjstateSet[jjnewStateCnt++] = jjnextStates[start];
    178         }
    179         while (start++ != end);
    180     }
    181
    182     private final void jjCheckNAddTwoStates(int state1, int state2)
    183     {
    184         jjCheckNAdd(state1);
    185         jjCheckNAdd(state2);
    186     }
    187
    188     private final void jjCheckNAddStates(int start, int end)
    189     {
    190         do
    191         {
    192             jjCheckNAdd(jjnextStates[start]);
    193         }
    194         while (start++ != end);
    195     }
    196
    197     private final void jjCheckNAddStates(int start)
    198     {
    199         jjCheckNAdd(jjnextStates[start]);
    200         jjCheckNAdd(jjnextStates[start + 1]);
    201     }
    202
    203     static final long[] jjbitVec0 = {
    204             0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
    205     };
    206
    207     private final int jjMoveNfa_0(int startState, int curPos)
    208     {
    209         int[] nextStates;
    210         int startsAt = 0;
    211         jjnewStateCnt = 14;
    212         int i = 1;
    213         jjstateSet[0] = startState;
    214         int j, kind = 0x7fffffff;
    215         for (; ;)
    216         {
    217             if (++jjround == 0x7fffffff)
    218             {
    219                 ReInitRounds();
    220             }
    221             if (curChar < 64)
    222             {
    223                 long l = 1L << curChar;
    224                 MatchLoop:
    225                 do
    226                 {
    227                     switch (jjstateSet[--i])
    228                     {
    229                         case 15:
    230                             if ((0xd7ffecfaffffd9ffL & l) != 0L)
    231                             {
    232                                 if (kind > 21)
    233                                 {
    234                                     kind = 21;
    235                                 }
    236                                 jjCheckNAdd(8);
    237                             }
    238                             if ((0x7ff280100000000L & l) != 0L)
    239                             {
    240                                 jjCheckNAddTwoStates(4, 5);
    241                             }
    242                             else if (curChar == 62)
    243                             {
    244                                 if (kind > 20)
    245                                 {
    246                                     kind = 20;
    247                                 }
    248                             }
    249                             break;
    250                         case 6:
    251                             if ((0xd7ffecfaffffd9ffL & l) != 0L)
    252                             {
    253                                 if (kind > 21)
    254                                 {
    255                                     kind = 21;
    256                                 }
    257                                 jjCheckNAdd(8);
    258                             }
    259                             if ((0x3ff000100002600L & l) != 0L)
    260                             {
    261                                 jjCheckNAddTwoStates(1, 2);
    262                             }
    263                             else if (curChar == 42)
    264                             {
    265                                 jjstateSet[jjnewStateCnt++] = 3;
    266                             }
    267                             else if (curChar == 62)
    268                             {
    269                                 if (kind > 19)
    270                                 {
    271                                     kind = 19;
    272                                 }
    273                             }
    274                             break;
    275                         case 14:
    276                             if ((0xfffffffbffffffffL & l) != 0L)
    277                             {
    278                                 jjCheckNAddStates(0, 2);
    279                             }
    280                             else if (curChar == 34)
    281                             {
    282                                 if (kind > 22)
    283                                 {
    284                                     kind = 22;
    285                                 }
    286                             }
    287                             break;
    288                         case 3:
    289                         case 8:
    290                             if ((0xd7ffecfaffffd9ffL & l) == 0L)
    291                             {
    292                                 break;
    293                             }
    294                             if (kind > 21)
    295                             {
    296                                 kind = 21;
    297                             }
    298                             jjCheckNAdd(8);
    299                             break;
    300                         case 0:
    301                             if ((0xd7ffecfaffffd9ffL & l) != 0L)
    302                             {
    303                                 if (kind > 21)
    304                                 {
    305                                     kind = 21;
    306                                 }
    307                                 jjCheckNAdd(8);
    308                             }
    309                             else if (curChar == 34)
    310                             {
    311                                 jjCheckNAddStates(0, 2);
    312                             }
    313                             if (curChar == 60)
    314                             {
    315                                 jjstateSet[jjnewStateCnt++] = 6;
    316                             }
    317                             if (curChar == 60)
    318                             {
    319                                 jjCheckNAddTwoStates(1, 2);
    320                             }
    321                             break;
    322                         case 1:
    323                             if ((0x3ff000100002600L & l) != 0L)
    324                             {
    325                                 jjCheckNAddTwoStates(1, 2);
    326                             }
    327                             break;
    328                         case 2:
    329                             if (curChar == 62 && kind > 19)
    330                             {
    331                                 kind = 19;
    332                             }
    333                             break;
    334                         case 4:
    335                             if ((0x7ff280100000000L & l) != 0L)
    336                             {
    337                                 jjCheckNAddTwoStates(4, 5);
    338                             }
    339                             break;
    340                         case 5:
    341                             if (curChar == 62 && kind > 20)
    342                             {
    343                                 kind = 20;
    344                             }
    345                             break;
    346                         case 7:
    347                             if (curChar == 60)
    348                             {
    349                                 jjstateSet[jjnewStateCnt++] = 6;
    350                             }
    351                             break;
    352                         case 9:
    353                         case 11:
    354                             if (curChar == 34)
    355                             {
    356                                 jjCheckNAddStates(0, 2);
    357                             }
    358                             break;
    359                         case 10:
    360                             if ((0xfffffffbffffffffL & l) != 0L)
    361                             {
    362                                 jjCheckNAddStates(0, 2);
    363                             }
    364                             break;
    365                         case 13:
    366                             if (curChar == 34 && kind > 22)
    367                             {
    368                                 kind = 22;
    369                             }
    370                             break;
    371                         default :
    372                             break;
    373                     }
    374                 }
    375                 while (i != startsAt);
    376             }
    377             else if (curChar < 128)
    378             {
    379                 long l = 1L << (curChar & 077);
    380                 MatchLoop:
    381                 do
    382                 {
    383                     switch (jjstateSet[--i])
    384                     {
    385                         case 15:
    386                             if ((0xd7ffffffffffffffL & l) != 0L)
    387                             {
    388                                 if (kind > 21)
    389                                 {
    390                                     kind = 21;
    391                                 }
    392                                 jjCheckNAdd(8);
    393                             }
    394                             if (curChar == 90)
    395                             {
    396                                 jjCheckNAddTwoStates(4, 5);
    397                             }
    398                             break;
    399                         case 6:
    400                             if ((0xd7ffffffffffffffL & l) != 0L)
    401                             {
    402                                 if (kind > 21)
    403                                 {
    404                                     kind = 21;
    405                                 }
    406                                 jjCheckNAdd(8);
    407                             }
    408                             if ((0x7e0000007eL & l) != 0L)
    409                             {
    410                                 jjCheckNAddTwoStates(1, 2);
    411                             }
    412                             break;
    413                         case 14:
    414                             jjCheckNAddStates(0, 2);
    415                             if (curChar == 92)
    416                             {
    417                                 jjstateSet[jjnewStateCnt++] = 11;
    418                             }
    419                             break;
    420                         case 3:
    421                             if ((0xd7ffffffffffffffL & l) != 0L)
    422                             {
    423                                 if (kind > 21)
    424                                 {
    425                                     kind = 21;
    426                                 }
    427                                 jjCheckNAdd(8);
    428                             }
    429                             if (curChar == 68)
    430                             {
    431                                 jjCheckNAddTwoStates(4, 5);
    432                             }
    433                             break;
    434                         case 0:
    435                         case 8:
    436                             if ((0xd7ffffffffffffffL & l) == 0L)
    437                             {
    438                                 break;
    439                             }
    440                             if (kind > 21)
    441                             {
    442                                 kind = 21;
    443                             }
    444                             jjCheckNAdd(8);
    445                             break;
    446                         case 1:
    447                             if ((0x7e0000007eL & l) != 0L)
    448                             {
    449                                 jjCheckNAddTwoStates(1, 2);
    450                             }
    451                             break;
    452                         case 4:
    453                             if (curChar == 90)
    454                             {
    455                                 jjCheckNAddTwoStates(4, 5);
    456                             }
    457                             break;
    458                         case 10:
    459                             jjCheckNAddStates(0, 2);
    460                             break;
    461                         case 12:
    462                             if (curChar == 92)
    463                             {
    464                                 jjstateSet[jjnewStateCnt++] = 11;
    465                             }
    466                             break;
    467                         default :
    468                             break;
    469                     }
    470                 }
    471                 while (i != startsAt);
    472             }
    473             else
    474             {
    475                 int i2 = (curChar & 0xff) >> 6;
    476                 long l2 = 1L << (curChar & 077);
    477                 MatchLoop:
    478                 do
    479                 {
    480                     switch (jjstateSet[--i])
    481                     {
    482                         case 15:
    483                         case 8:
    484                             if ((jjbitVec0[i2] & l2) == 0L)
    485                             {
    486                                 break;
    487                             }
    488                             if (kind > 21)
    489                             {
    490                                 kind = 21;
    491                             }
    492                             jjCheckNAdd(8);
    493                             break;
    494                         case 6:
    495                             if ((jjbitVec0[i2] & l2) == 0L)
    496                             {
    497                                 break;
    498                             }
    499                             if (kind > 21)
    500                             {
    501                                 kind = 21;
    502                             }
    503                             jjCheckNAdd(8);
    504                             break;
    505                         case 14:
    506                         case 10:
    507                             if ((jjbitVec0[i2] & l2) != 0L)
    508                             {
    509                                 jjCheckNAddStates(0, 2);
    510                             }
    511                             break;
    512                         case 3:
    513                             if ((jjbitVec0[i2] & l2) == 0L)
    514                             {
    515                                 break;
    516                             }
    517                             if (kind > 21)
    518                             {
    519                                 kind = 21;
    520                             }
    521                             jjCheckNAdd(8);
    522                             break;
    523                         case 0:
    524                             if ((jjbitVec0[i2] & l2) == 0L)
    525                             {
    526                                 break;
    527                             }
    528                             if (kind > 21)
    529                             {
    530                                 kind = 21;
    531                             }
    532                             jjCheckNAdd(8);
    533                             break;
    534                         default :
    535                             break;
    536                     }
    537                 }
    538                 while (i != startsAt);
    539             }
    540             if (kind != 0x7fffffff)
    541             {
    542                 jjmatchedKind = kind;
    543                 jjmatchedPos = curPos;
    544                 kind = 0x7fffffff;
    545             }
    546             ++curPos;
    547             if ((i = jjnewStateCnt) == (startsAt = 14 - (jjnewStateCnt = startsAt)))
    548             {
    549                 return curPos;
    550             }
    551             try
    552             {
    553                 curChar = input_stream.readChar();
    554             }
    555             catch (java.io.IOException e)
    556             {
    557                 return curPos;
    558             }
    559         }
    560     }
    561
    562     static final int[] jjnextStates = {
    563             10, 12, 13,
    564     };
    565     public static final String[] jjstrLiteralImages = {
    566             "", null, null, null, null, "\50", "\51", "\54", "\173", "\175", "\73", "\75",
    567             "\74", "\76", "\74\52\104", "\42", null, null, null, null, null, null, null,
    568             "\134\42",};
    569     public static final String[] lexStateNames = {
    570             "DEFAULT",
    571     };
    572     static final long[] jjtoToken = {
    573             0xf8ffe1L,
    574     };
    575     static final long[] jjtoSkip = {
    576             0x1eL,
    577     };
    578     protected SimpleCharStream input_stream;
    579     private final int[] jjrounds = new int[14];
    580     private final int[] jjstateSet = new int[28];
    581     protected char curChar;
    582
    583     public PropertyListParserTokenManager(SimpleCharStream stream)
    584     {
    585         if (SimpleCharStream.staticFlag)
    586         {
    587             throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
    588         }
    589         input_stream = stream;
    590     }
    591
    592     public PropertyListParserTokenManager(SimpleCharStream stream, int lexState)
    593     {
    594         this(stream);
    595         SwitchTo(lexState);
    596     }
    597
    598     public void ReInit(SimpleCharStream stream)
    599     {
    600         jjmatchedPos = jjnewStateCnt = 0;
    601         curLexState = defaultLexState;
    602         input_stream = stream;
    603         ReInitRounds();
    604     }
    605
    606     private final void ReInitRounds()
    607     {
    608         int i;
    609         jjround = 0x80000001;
    610         for (i = 14; i-- > 0;)
    611         {
    612             jjrounds[i] = 0x80000000;
    613         }
    614     }
    615
    616     public void ReInit(SimpleCharStream stream, int lexState)
    617     {
    618         ReInit(stream);
    619         SwitchTo(lexState);
    620     }
    621
    622     public void SwitchTo(int lexState)
    623     {
    624         if (lexState >= 1 || lexState < 0)
    625         {
    626             throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
    627         }
    628         else
    629         {
    630             curLexState = lexState;
    631         }
    632     }
    633
    634     protected Token jjFillToken()
    635     {
    636         Token t = Token.newToken(jjmatchedKind);
    637         t.kind = jjmatchedKind;
    638         String im = jjstrLiteralImages[jjmatchedKind];
    639         t.image = (im == null) ? input_stream.GetImage() : im;
    640         t.beginLine = input_stream.getBeginLine();
    641         t.beginColumn = input_stream.getBeginColumn();
    642         t.endLine = input_stream.getEndLine();
    643         t.endColumn = input_stream.getEndColumn();
    644         return t;
    645     }
    646
    647     int curLexState = 0;
    648     int defaultLexState = 0;
    649     int jjnewStateCnt;
    650     int jjround;
    651     int jjmatchedPos;
    652     int jjmatchedKind;
    653
    654     public Token getNextToken()
    655     {
    656         int kind;
    657         Token specialToken = null;
    658         Token matchedToken;
    659         int curPos = 0;
    660
    661         EOFLoop :
    662         for (; ;)
    663         {
    664             try
    665             {
    666                 curChar = input_stream.BeginToken();
    667             }
    668             catch (java.io.IOException e)
    669             {
    670                 jjmatchedKind = 0;
    671                 matchedToken = jjFillToken();
    672                 return matchedToken;
    673             }
    674
    675             try
    676             {
    677                 input_stream.backup(0);
    678                 while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L)
    679                 {
    680                     curChar = input_stream.BeginToken();
    681                 }
    682             }
    683             catch (java.io.IOException e1)
    684             {
    685                 continue EOFLoop;
    686             }
    687             jjmatchedKind = 0x7fffffff;
    688             jjmatchedPos = 0;
    689             curPos = jjMoveStringLiteralDfa0_0();
    690             if (jjmatchedKind != 0x7fffffff)
    691             {
    692                 if (jjmatchedPos + 1 < curPos)
    693                 {
    694                     input_stream.backup(curPos - jjmatchedPos - 1);
    695                 }
    696                 if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
    697                 {
    698                     matchedToken = jjFillToken();
    699                     return matchedToken;
    700                 }
    701                 else
    702                 {
    703                     continue EOFLoop;
    704                 }
    705             }
    706             int error_line = input_stream.getEndLine();
    707             int error_column = input_stream.getEndColumn();
    708             String error_after = null;
    709             boolean EOFSeen = false;
    710             try
    711             {
    712                 input_stream.readChar();
    713                 input_stream.backup(1);
    714             }
    715             catch (java.io.IOException e1)
    716             {
    717                 EOFSeen = true;
    718                 error_after = curPos <= 1 ? "" : input_stream.GetImage();
    719                 if (curChar == '\n' || curChar == '\r')
    720                 {
    721                     error_line++;
    722                     error_column = 0;
    723                 }
    724                 else
    725                 {
    726                     error_column++;
    727                 }
    728             }
    729             if (!EOFSeen)
    730             {
    731                 input_stream.backup(1);
    732                 error_after = curPos <= 1 ? "" : input_stream.GetImage();
    733             }
    734             throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
    735         }
    736     }
    737
    738 }