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