View Javadoc

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