1 22 package org.jboss.aop.annotation.factory.duplicate.ast; 23 24 public class AnnotationParserimplements AnnotationParserTreeConstants, AnnotationParserConstants { 25 protected JJTAnnotationParserState jjtree = new JJTAnnotationParserState(); 26 27 final public ASTStart Start() throws ParseException { 28 29 ASTStart jjtn000 = new ASTStart(JJTSTART); 30 boolean jjtc000 = true; 31 jjtree.openNodeScope(jjtn000); 32 try { 33 Annotation(); 34 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 35 case 7: 36 jj_consume_token(7); 37 break; 38 case 8: 39 jj_consume_token(8); 40 break; 41 case 0: 42 jj_consume_token(0); 43 break; 44 default: 45 jj_la1[0] = jj_gen; 46 jj_consume_token(-1); 47 throw new ParseException(); 48 } 49 jjtree.closeNodeScope(jjtn000, true); 50 jjtc000 = false; 51 {if (true) return jjtn000;} 52 } catch (Throwable jjte000) { 53 if (jjtc000) { 54 jjtree.clearNodeScope(jjtn000); 55 jjtc000 = false; 56 } else { 57 jjtree.popNode(); 58 } 59 if (jjte000 instanceof RuntimeException ) { 60 {if (true) throw (RuntimeException )jjte000;} 61 } 62 if (jjte000 instanceof ParseException) { 63 {if (true) throw (ParseException)jjte000;} 64 } 65 {if (true) throw (Error )jjte000;} 66 } finally { 67 if (jjtc000) { 68 jjtree.closeNodeScope(jjtn000, true); 69 } 70 } 71 throw new Error ("Missing return statement in function"); 72 } 73 74 final public void Annotation() throws ParseException { 75 76 ASTAnnotation jjtn000 = new ASTAnnotation(JJTANNOTATION); 77 boolean jjtc000 = true; 78 jjtree.openNodeScope(jjtn000);Token tok; 79 try { 80 jj_consume_token(9); 81 tok = jj_consume_token(IDENTIFIER); 82 jjtn000.setIdentifier(tok.image); 83 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 84 case 10: 85 jj_consume_token(10); 86 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 87 case IDENTIFIER: 88 case CHARACTER: 89 case STRING: 90 case 9: 91 case 14: 92 if (jj_2_1(2)) { 93 MemberValuePairs(); 94 } else { 95 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 96 case IDENTIFIER: 97 case CHARACTER: 98 case STRING: 99 case 9: 100 case 14: 101 SingleMemberValue(); 102 break; 103 default: 104 jj_la1[1] = jj_gen; 105 jj_consume_token(-1); 106 throw new ParseException(); 107 } 108 } 109 break; 110 default: 111 jj_la1[2] = jj_gen; 112 ; 113 } 114 jj_consume_token(11); 115 break; 116 default: 117 jj_la1[3] = jj_gen; 118 ; 119 } 120 } catch (Throwable jjte000) { 121 if (jjtc000) { 122 jjtree.clearNodeScope(jjtn000); 123 jjtc000 = false; 124 } else { 125 jjtree.popNode(); 126 } 127 if (jjte000 instanceof RuntimeException ) { 128 {if (true) throw (RuntimeException )jjte000;} 129 } 130 if (jjte000 instanceof ParseException) { 131 {if (true) throw (ParseException)jjte000;} 132 } 133 {if (true) throw (Error )jjte000;} 134 } finally { 135 if (jjtc000) { 136 jjtree.closeNodeScope(jjtn000, true); 137 } 138 } 139 } 140 141 final public void SingleMemberValue() throws ParseException { 142 143 ASTSingleMemberValue jjtn000 = new ASTSingleMemberValue(JJTSINGLEMEMBERVALUE); 144 boolean jjtc000 = true; 145 jjtree.openNodeScope(jjtn000); 146 try { 147 MemberValue(); 148 } catch (Throwable jjte000) { 149 if (jjtc000) { 150 jjtree.clearNodeScope(jjtn000); 151 jjtc000 = false; 152 } else { 153 jjtree.popNode(); 154 } 155 if (jjte000 instanceof RuntimeException ) { 156 {if (true) throw (RuntimeException )jjte000;} 157 } 158 if (jjte000 instanceof ParseException) { 159 {if (true) throw (ParseException)jjte000;} 160 } 161 {if (true) throw (Error )jjte000;} 162 } finally { 163 if (jjtc000) { 164 jjtree.closeNodeScope(jjtn000, true); 165 } 166 } 167 } 168 169 final public void MemberValuePairs() throws ParseException { 170 171 ASTMemberValuePairs jjtn000 = new ASTMemberValuePairs(JJTMEMBERVALUEPAIRS); 172 boolean jjtc000 = true; 173 jjtree.openNodeScope(jjtn000); 174 try { 175 MemberValuePair(); 176 label_1: 177 while (true) { 178 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 179 case 12: 180 ; 181 break; 182 default: 183 jj_la1[4] = jj_gen; 184 break label_1; 185 } 186 jj_consume_token(12); 187 MemberValuePair(); 188 } 189 } catch (Throwable jjte000) { 190 if (jjtc000) { 191 jjtree.clearNodeScope(jjtn000); 192 jjtc000 = false; 193 } else { 194 jjtree.popNode(); 195 } 196 if (jjte000 instanceof RuntimeException ) { 197 {if (true) throw (RuntimeException )jjte000;} 198 } 199 if (jjte000 instanceof ParseException) { 200 {if (true) throw (ParseException)jjte000;} 201 } 202 {if (true) throw (Error )jjte000;} 203 } finally { 204 if (jjtc000) { 205 jjtree.closeNodeScope(jjtn000, true); 206 } 207 } 208 } 209 210 final public void MemberValuePair() throws ParseException { 211 212 ASTMemberValuePair jjtn000 = new ASTMemberValuePair(JJTMEMBERVALUEPAIR); 213 boolean jjtc000 = true; 214 jjtree.openNodeScope(jjtn000);Token specialToken; 215 try { 216 Identifier(); 217 jj_consume_token(13); 218 MemberValue(); 219 } catch (Throwable jjte000) { 220 if (jjtc000) { 221 jjtree.clearNodeScope(jjtn000); 222 jjtc000 = false; 223 } else { 224 jjtree.popNode(); 225 } 226 if (jjte000 instanceof RuntimeException ) { 227 {if (true) throw (RuntimeException )jjte000;} 228 } 229 if (jjte000 instanceof ParseException) { 230 {if (true) throw (ParseException)jjte000;} 231 } 232 {if (true) throw (Error )jjte000;} 233 } finally { 234 if (jjtc000) { 235 jjtree.closeNodeScope(jjtn000, true); 236 } 237 } 238 } 239 240 final public void MemberValue() throws ParseException { 241 Token tok; 242 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 243 case 9: 244 Annotation(); 245 break; 246 case 14: 247 MemberValueArrayInitializer(); 248 break; 249 case STRING: 250 String(); 251 break; 252 case CHARACTER: 253 Char(); 254 break; 255 case IDENTIFIER: 256 Identifier(); 257 break; 258 default: 259 jj_la1[5] = jj_gen; 260 jj_consume_token(-1); 261 throw new ParseException(); 262 } 263 } 264 265 final public void MemberValueArrayInitializer() throws ParseException { 266 267 ASTMemberValueArrayInitializer jjtn000 = new ASTMemberValueArrayInitializer(JJTMEMBERVALUEARRAYINITIALIZER); 268 boolean jjtc000 = true; 269 jjtree.openNodeScope(jjtn000); 270 try { 271 jj_consume_token(14); 272 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 273 case IDENTIFIER: 274 case CHARACTER: 275 case STRING: 276 case 9: 277 case 14: 278 MemberValue(); 279 label_2: 280 while (true) { 281 if (jj_2_2(2)) { 282 ; 283 } else { 284 break label_2; 285 } 286 jj_consume_token(12); 287 MemberValue(); 288 } 289 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 290 case 12: 291 jj_consume_token(12); 292 break; 293 default: 294 jj_la1[6] = jj_gen; 295 ; 296 } 297 break; 298 default: 299 jj_la1[7] = jj_gen; 300 ; 301 } 302 jj_consume_token(15); 303 } catch (Throwable jjte000) { 304 if (jjtc000) { 305 jjtree.clearNodeScope(jjtn000); 306 jjtc000 = false; 307 } else { 308 jjtree.popNode(); 309 } 310 if (jjte000 instanceof RuntimeException ) { 311 {if (true) throw (RuntimeException )jjte000;} 312 } 313 if (jjte000 instanceof ParseException) { 314 {if (true) throw (ParseException)jjte000;} 315 } 316 {if (true) throw (Error )jjte000;} 317 } finally { 318 if (jjtc000) { 319 jjtree.closeNodeScope(jjtn000, true); 320 } 321 } 322 } 323 324 final public void Identifier() throws ParseException { 325 326 ASTIdentifier jjtn000 = new ASTIdentifier(JJTIDENTIFIER); 327 boolean jjtc000 = true; 328 jjtree.openNodeScope(jjtn000);Token tok; 329 try { 330 tok = jj_consume_token(IDENTIFIER); 331 jjtree.closeNodeScope(jjtn000, true); 332 jjtc000 = false; 333 jjtn000.setValue(tok.image); 334 } finally { 335 if (jjtc000) { 336 jjtree.closeNodeScope(jjtn000, true); 337 } 338 } 339 } 340 341 final public void String() throws ParseException { 342 343 ASTString jjtn000 = new ASTString(JJTSTRING); 344 boolean jjtc000 = true; 345 jjtree.openNodeScope(jjtn000);Token tok; 346 try { 347 tok = jj_consume_token(STRING); 348 jjtree.closeNodeScope(jjtn000, true); 349 jjtc000 = false; 350 jjtn000.setValue(tok.image); 351 } finally { 352 if (jjtc000) { 353 jjtree.closeNodeScope(jjtn000, true); 354 } 355 } 356 } 357 358 final public void Char() throws ParseException { 359 360 ASTChar jjtn000 = new ASTChar(JJTCHAR); 361 boolean jjtc000 = true; 362 jjtree.openNodeScope(jjtn000);Token tok; 363 try { 364 tok = jj_consume_token(CHARACTER); 365 jjtree.closeNodeScope(jjtn000, true); 366 jjtc000 = false; 367 jjtn000.setValue(tok.image); 368 } finally { 369 if (jjtc000) { 370 jjtree.closeNodeScope(jjtn000, true); 371 } 372 } 373 } 374 375 final private boolean jj_2_1(int xla) { 376 jj_la = xla; jj_lastpos = jj_scanpos = token; 377 try { return !jj_3_1(); } 378 catch(LookaheadSuccess ls) { return true; } 379 finally { jj_save(0, xla); } 380 } 381 382 final private boolean jj_2_2(int xla) { 383 jj_la = xla; jj_lastpos = jj_scanpos = token; 384 try { return !jj_3_2(); } 385 catch(LookaheadSuccess ls) { return true; } 386 finally { jj_save(1, xla); } 387 } 388 389 final private boolean jj_3R_4() { 390 Token xsp; 391 xsp = jj_scanpos; 392 if (jj_3R_6()) { 393 jj_scanpos = xsp; 394 if (jj_3R_7()) { 395 jj_scanpos = xsp; 396 if (jj_3R_8()) { 397 jj_scanpos = xsp; 398 if (jj_3R_9()) { 399 jj_scanpos = xsp; 400 if (jj_3R_10()) return true; 401 } 402 } 403 } 404 } 405 return false; 406 } 407 408 final private boolean jj_3R_6() { 409 if (jj_3R_12()) return true; 410 return false; 411 } 412 413 final private boolean jj_3_1() { 414 if (jj_3R_3()) return true; 415 return false; 416 } 417 418 final private boolean jj_3R_14() { 419 if (jj_scan_token(STRING)) return true; 420 return false; 421 } 422 423 final private boolean jj_3R_13() { 424 if (jj_scan_token(14)) return true; 425 return false; 426 } 427 428 final private boolean jj_3R_5() { 429 if (jj_3R_11()) return true; 430 if (jj_scan_token(13)) return true; 431 return false; 432 } 433 434 final private boolean jj_3_2() { 435 if (jj_scan_token(12)) return true; 436 if (jj_3R_4()) return true; 437 return false; 438 } 439 440 final private boolean jj_3R_10() { 441 if (jj_3R_11()) return true; 442 return false; 443 } 444 445 final private boolean jj_3R_9() { 446 if (jj_3R_15()) return true; 447 return false; 448 } 449 450 final private boolean jj_3R_12() { 451 if (jj_scan_token(9)) return true; 452 return false; 453 } 454 455 final private boolean jj_3R_11() { 456 if (jj_scan_token(IDENTIFIER)) return true; 457 return false; 458 } 459 460 final private boolean jj_3R_15() { 461 if (jj_scan_token(CHARACTER)) return true; 462 return false; 463 } 464 465 final private boolean jj_3R_8() { 466 if (jj_3R_14()) return true; 467 return false; 468 } 469 470 final private boolean jj_3R_3() { 471 if (jj_3R_5()) return true; 472 return false; 473 } 474 475 final private boolean jj_3R_7() { 476 if (jj_3R_13()) return true; 477 return false; 478 } 479 480 public AnnotationParserTokenManager token_source; 481 SimpleCharStream jj_input_stream; 482 public Token token, jj_nt; 483 private int jj_ntk; 484 private Token jj_scanpos, jj_lastpos; 485 private int jj_la; 486 public boolean lookingAhead = false; 487 private boolean jj_semLA; 488 private int jj_gen; 489 final private int[] jj_la1 = new int[8]; 490 static private int[] jj_la1_0; 491 static { 492 jj_la1_0(); 493 } 494 private static void jj_la1_0() { 495 jj_la1_0 = new int[] {0x181,0x4268,0x4268,0x400,0x1000,0x4268,0x1000,0x4268,}; 496 } 497 final private JJCalls[] jj_2_rtns = new JJCalls[2]; 498 private boolean jj_rescan = false; 499 private int jj_gc = 0; 500 501 public AnnotationParser(java.io.InputStream stream) { 502 jj_input_stream = new SimpleCharStream(stream, 1, 1); 503 token_source = new AnnotationParserTokenManager(jj_input_stream); 504 token = new Token(); 505 jj_ntk = -1; 506 jj_gen = 0; 507 for (int i = 0; i < 8; i++) jj_la1[i] = -1; 508 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 509 } 510 511 public void ReInit(java.io.InputStream stream) { 512 jj_input_stream.ReInit(stream, 1, 1); 513 token_source.ReInit(jj_input_stream); 514 token = new Token(); 515 jj_ntk = -1; 516 jjtree.reset(); 517 jj_gen = 0; 518 for (int i = 0; i < 8; i++) jj_la1[i] = -1; 519 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 520 } 521 522 public AnnotationParser(java.io.Reader stream) { 523 jj_input_stream = new SimpleCharStream(stream, 1, 1); 524 token_source = new AnnotationParserTokenManager(jj_input_stream); 525 token = new Token(); 526 jj_ntk = -1; 527 jj_gen = 0; 528 for (int i = 0; i < 8; i++) jj_la1[i] = -1; 529 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 530 } 531 532 public void ReInit(java.io.Reader stream) { 533 jj_input_stream.ReInit(stream, 1, 1); 534 token_source.ReInit(jj_input_stream); 535 token = new Token(); 536 jj_ntk = -1; 537 jjtree.reset(); 538 jj_gen = 0; 539 for (int i = 0; i < 8; i++) jj_la1[i] = -1; 540 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 541 } 542 543 public AnnotationParser(AnnotationParserTokenManager tm) { 544 token_source = tm; 545 token = new Token(); 546 jj_ntk = -1; 547 jj_gen = 0; 548 for (int i = 0; i < 8; i++) jj_la1[i] = -1; 549 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 550 } 551 552 public void ReInit(AnnotationParserTokenManager tm) { 553 token_source = tm; 554 token = new Token(); 555 jj_ntk = -1; 556 jjtree.reset(); 557 jj_gen = 0; 558 for (int i = 0; i < 8; i++) jj_la1[i] = -1; 559 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 560 } 561 562 final private Token jj_consume_token(int kind) throws ParseException { 563 Token oldToken; 564 if ((oldToken = token).next != null) token = token.next; 565 else token = token.next = token_source.getNextToken(); 566 jj_ntk = -1; 567 if (token.kind == kind) { 568 jj_gen++; 569 if (++jj_gc > 100) { 570 jj_gc = 0; 571 for (int i = 0; i < jj_2_rtns.length; i++) { 572 JJCalls c = jj_2_rtns[i]; 573 while (c != null) { 574 if (c.gen < jj_gen) c.first = null; 575 c = c.next; 576 } 577 } 578 } 579 return token; 580 } 581 token = oldToken; 582 jj_kind = kind; 583 throw generateParseException(); 584 } 585 586 static private final class LookaheadSuccess extends java.lang.Error {} 587 final private LookaheadSuccess jj_ls = new LookaheadSuccess(); 588 final private boolean jj_scan_token(int kind) { 589 if (jj_scanpos == jj_lastpos) { 590 jj_la--; 591 if (jj_scanpos.next == null) { 592 jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); 593 } else { 594 jj_lastpos = jj_scanpos = jj_scanpos.next; 595 } 596 } else { 597 jj_scanpos = jj_scanpos.next; 598 } 599 if (jj_rescan) { 600 int i = 0; Token tok = token; 601 while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } 602 if (tok != null) jj_add_error_token(kind, i); 603 } 604 if (jj_scanpos.kind != kind) return true; 605 if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; 606 return false; 607 } 608 609 final public Token getNextToken() { 610 if (token.next != null) token = token.next; 611 else token = token.next = token_source.getNextToken(); 612 jj_ntk = -1; 613 jj_gen++; 614 return token; 615 } 616 617 final public Token getToken(int index) { 618 Token t = lookingAhead ? jj_scanpos : token; 619 for (int i = 0; i < index; i++) { 620 if (t.next != null) t = t.next; 621 else t = t.next = token_source.getNextToken(); 622 } 623 return t; 624 } 625 626 final private int jj_ntk() { 627 if ((jj_nt=token.next) == null) 628 return (jj_ntk = (token.next=token_source.getNextToken()).kind); 629 else 630 return (jj_ntk = jj_nt.kind); 631 } 632 633 private java.util.Vector jj_expentries = new java.util.Vector (); 634 private int[] jj_expentry; 635 private int jj_kind = -1; 636 private int[] jj_lasttokens = new int[100]; 637 private int jj_endpos; 638 639 private void jj_add_error_token(int kind, int pos) { 640 if (pos >= 100) return; 641 if (pos == jj_endpos + 1) { 642 jj_lasttokens[jj_endpos++] = kind; 643 } else if (jj_endpos != 0) { 644 jj_expentry = new int[jj_endpos]; 645 for (int i = 0; i < jj_endpos; i++) { 646 jj_expentry[i] = jj_lasttokens[i]; 647 } 648 boolean exists = false; 649 for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements();) { 650 int[] oldentry = (int[])(e.nextElement()); 651 if (oldentry.length == jj_expentry.length) { 652 exists = true; 653 for (int i = 0; i < jj_expentry.length; i++) { 654 if (oldentry[i] != jj_expentry[i]) { 655 exists = false; 656 break; 657 } 658 } 659 if (exists) break; 660 } 661 } 662 if (!exists) jj_expentries.addElement(jj_expentry); 663 if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; 664 } 665 } 666 667 public ParseException generateParseException() { 668 jj_expentries.removeAllElements(); 669 boolean[] la1tokens = new boolean[16]; 670 for (int i = 0; i < 16; i++) { 671 la1tokens[i] = false; 672 } 673 if (jj_kind >= 0) { 674 la1tokens[jj_kind] = true; 675 jj_kind = -1; 676 } 677 for (int i = 0; i < 8; i++) { 678 if (jj_la1[i] == jj_gen) { 679 for (int j = 0; j < 32; j++) { 680 if ((jj_la1_0[i] & (1<<j)) != 0) { 681 la1tokens[j] = true; 682 } 683 } 684 } 685 } 686 for (int i = 0; i < 16; i++) { 687 if (la1tokens[i]) { 688 jj_expentry = new int[1]; 689 jj_expentry[0] = i; 690 jj_expentries.addElement(jj_expentry); 691 } 692 } 693 jj_endpos = 0; 694 jj_rescan_token(); 695 jj_add_error_token(0, 0); 696 int[][] exptokseq = new int[jj_expentries.size()][]; 697 for (int i = 0; i < jj_expentries.size(); i++) { 698 exptokseq[i] = (int[])jj_expentries.elementAt(i); 699 } 700 return new ParseException(token, exptokseq, tokenImage); 701 } 702 703 final public void enable_tracing() { 704 } 705 706 final public void disable_tracing() { 707 } 708 709 final private void jj_rescan_token() { 710 jj_rescan = true; 711 for (int i = 0; i < 2; i++) { 712 JJCalls p = jj_2_rtns[i]; 713 do { 714 if (p.gen > jj_gen) { 715 jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; 716 switch (i) { 717 case 0: jj_3_1(); break; 718 case 1: jj_3_2(); break; 719 } 720 } 721 p = p.next; 722 } while (p != null); 723 } 724 jj_rescan = false; 725 } 726 727 final private void jj_save(int index, int xla) { 728 JJCalls p = jj_2_rtns[index]; 729 while (p.gen > jj_gen) { 730 if (p.next == null) { p = p.next = new JJCalls(); break; } 731 p = p.next; 732 } 733 p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; 734 } 735 736 static final class JJCalls { 737 int gen; 738 Token first; 739 int arg; 740 JJCalls next; 741 } 742 743 } 744 | Popular Tags |