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