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