1 2 6 7 package net.sourceforge.pmd.jsp.ast; 8 9 public class JspParserimplements JspParserTreeConstants, JspParserConstants { 10 protected JJTJspParserState jjtree = new JJTJspParserState(); 11 17 private static String quoteContent(String quote) { 18 return quote.substring(1, quote.length()-1); 19 } 20 21 27 private static String expressionContent(String expression) { 28 return expression.substring(2, expression.length()-1).trim(); 29 } 30 31 32 33 34 35 38 final public ASTCompilationUnit CompilationUnit() throws ParseException { 39 40 ASTCompilationUnit jjtn000 = new ASTCompilationUnit(this, JJTCOMPILATIONUNIT); 41 boolean jjtc000 = true; 42 jjtree.openNodeScope(jjtn000); 43 try { 44 Prolog(); 45 Content(); 46 jj_consume_token(0); 47 jjtree.closeNodeScope(jjtn000, true); 48 jjtc000 = false; 49 {if (true) return jjtn000;} 50 } catch (Throwable jjte000) { 51 if (jjtc000) { 52 jjtree.clearNodeScope(jjtn000); 53 jjtc000 = false; 54 } else { 55 jjtree.popNode(); 56 } 57 if (jjte000 instanceof RuntimeException ) { 58 {if (true) throw (RuntimeException )jjte000;} 59 } 60 if (jjte000 instanceof ParseException) { 61 {if (true) throw (ParseException)jjte000;} 62 } 63 {if (true) throw (Error )jjte000;} 64 } finally { 65 if (jjtc000) { 66 jjtree.closeNodeScope(jjtn000, true); 67 } 68 } 69 throw new RuntimeException ("Missing return statement in function"); 70 } 71 72 75 final public void Prolog() throws ParseException { 76 if (jj_2_1(2147483647)) { 77 label_1: 78 while (true) { 79 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 80 case COMMENT_START: 81 case JSP_COMMENT_START: 82 ; 83 break; 84 default: 85 jj_la1[0] = jj_gen; 86 break label_1; 87 } 88 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 89 case COMMENT_START: 90 CommentTag(); 91 break; 92 case JSP_COMMENT_START: 93 JspComment(); 94 break; 95 default: 96 jj_la1[1] = jj_gen; 97 jj_consume_token(-1); 98 throw new ParseException(); 99 } 100 } 101 Declaration(); 102 } else { 103 ; 104 } 105 if (jj_2_2(2147483647)) { 106 label_2: 107 while (true) { 108 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 109 case COMMENT_START: 110 case JSP_COMMENT_START: 111 ; 112 break; 113 default: 114 jj_la1[2] = jj_gen; 115 break label_2; 116 } 117 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 118 case COMMENT_START: 119 CommentTag(); 120 break; 121 case JSP_COMMENT_START: 122 JspComment(); 123 break; 124 default: 125 jj_la1[3] = jj_gen; 126 jj_consume_token(-1); 127 throw new ParseException(); 128 } 129 } 130 DoctypeDeclaration(); 131 } else { 132 ; 133 } 134 } 135 136 139 final public void Content() throws ParseException { 140 141 ASTContent jjtn000 = new ASTContent(this, JJTCONTENT); 142 boolean jjtc000 = true; 143 jjtree.openNodeScope(jjtn000); 144 try { 145 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 146 case EL_EXPRESSION: 147 case UNPARSED_TEXT: 148 Text(); 149 break; 150 case TAG_START: 151 case COMMENT_START: 152 case CDATA_START: 153 case JSP_COMMENT_START: 154 case JSP_DECLARATION_START: 155 case JSP_EXPRESSION_START: 156 case JSP_SCRIPTLET_START: 157 case JSP_DIRECTIVE_START: 158 ContentElementPossiblyWithText(); 159 break; 160 default: 161 jj_la1[4] = jj_gen; 162 jj_consume_token(-1); 163 throw new ParseException(); 164 } 165 label_3: 166 while (true) { 167 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 168 case TAG_START: 169 case COMMENT_START: 170 case CDATA_START: 171 case JSP_COMMENT_START: 172 case JSP_DECLARATION_START: 173 case JSP_EXPRESSION_START: 174 case JSP_SCRIPTLET_START: 175 case JSP_DIRECTIVE_START: 176 ; 177 break; 178 default: 179 jj_la1[5] = jj_gen; 180 break label_3; 181 } 182 ContentElementPossiblyWithText(); 183 } 184 } catch (Throwable jjte000) { 185 if (jjtc000) { 186 jjtree.clearNodeScope(jjtn000); 187 jjtc000 = false; 188 } else { 189 jjtree.popNode(); 190 } 191 if (jjte000 instanceof RuntimeException ) { 192 {if (true) throw (RuntimeException )jjte000;} 193 } 194 if (jjte000 instanceof ParseException) { 195 {if (true) throw (ParseException)jjte000;} 196 } 197 {if (true) throw (Error )jjte000;} 198 } finally { 199 if (jjtc000) { 200 jjtree.closeNodeScope(jjtn000, true); 201 } 202 } 203 } 204 205 209 final public void ContentElementPossiblyWithText() throws ParseException { 210 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 211 case COMMENT_START: 212 CommentTag(); 213 break; 214 case TAG_START: 215 Element(); 216 break; 217 case CDATA_START: 218 CData(); 219 break; 220 case JSP_COMMENT_START: 221 JspComment(); 222 break; 223 case JSP_DECLARATION_START: 224 JspDeclaration(); 225 break; 226 case JSP_EXPRESSION_START: 227 JspExpression(); 228 break; 229 case JSP_SCRIPTLET_START: 230 JspScriptlet(); 231 break; 232 case JSP_DIRECTIVE_START: 233 JspDirective(); 234 break; 235 default: 236 jj_la1[6] = jj_gen; 237 jj_consume_token(-1); 238 throw new ParseException(); 239 } 240 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 241 case EL_EXPRESSION: 242 case UNPARSED_TEXT: 243 Text(); 244 break; 245 default: 246 jj_la1[7] = jj_gen; 247 ; 248 } 249 } 250 251 final public void JspDirective() throws ParseException { 252 253 ASTJspDirective jjtn000 = new ASTJspDirective(this, JJTJSPDIRECTIVE); 254 boolean jjtc000 = true; 255 jjtree.openNodeScope(jjtn000);Token t; 256 try { 257 jj_consume_token(JSP_DIRECTIVE_START); 258 t = jj_consume_token(JSP_DIRECTIVE_NAME); 259 jjtn000.setName(t.image); 260 label_4: 261 while (true) { 262 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 263 case JSP_DIRECTIVE_ATTRIBUTE_NAME: 264 ; 265 break; 266 default: 267 jj_la1[8] = jj_gen; 268 break label_4; 269 } 270 JspDirectiveAttribute(); 271 } 272 jj_consume_token(JSP_DIRECTIVE_END); 273 } catch (Throwable jjte000) { 274 if (jjtc000) { 275 jjtree.clearNodeScope(jjtn000); 276 jjtc000 = false; 277 } else { 278 jjtree.popNode(); 279 } 280 if (jjte000 instanceof RuntimeException ) { 281 {if (true) throw (RuntimeException )jjte000;} 282 } 283 if (jjte000 instanceof ParseException) { 284 {if (true) throw (ParseException)jjte000;} 285 } 286 {if (true) throw (Error )jjte000;} 287 } finally { 288 if (jjtc000) { 289 jjtree.closeNodeScope(jjtn000, true); 290 } 291 } 292 } 293 294 final public void JspDirectiveAttribute() throws ParseException { 295 296 ASTJspDirectiveAttribute jjtn000 = new ASTJspDirectiveAttribute(this, JJTJSPDIRECTIVEATTRIBUTE); 297 boolean jjtc000 = true; 298 jjtree.openNodeScope(jjtn000);Token t; 299 try { 300 t = jj_consume_token(JSP_DIRECTIVE_ATTRIBUTE_NAME); 301 jjtn000.setName(t.image); 302 jj_consume_token(JSP_DIRECTIVE_ATTRIBUTE_EQUALS); 303 t = jj_consume_token(JSP_DIRECTIVE_ATTRIBUTE_VALUE); 304 jjtree.closeNodeScope(jjtn000, true); 305 jjtc000 = false; 306 jjtn000.setValue(quoteContent(t.image)); 307 } finally { 308 if (jjtc000) { 309 jjtree.closeNodeScope(jjtn000, true); 310 } 311 } 312 } 313 314 final public void JspScriptlet() throws ParseException { 315 316 ASTJspScriptlet jjtn000 = new ASTJspScriptlet(this, JJTJSPSCRIPTLET); 317 boolean jjtc000 = true; 318 jjtree.openNodeScope(jjtn000);Token t; 319 try { 320 jj_consume_token(JSP_SCRIPTLET_START); 321 t = jj_consume_token(JSP_SCRIPTLET); 322 jjtn000.setImage(t.image.trim()); 323 jj_consume_token(JSP_SCRIPTLET_END); 324 } finally { 325 if (jjtc000) { 326 jjtree.closeNodeScope(jjtn000, true); 327 } 328 } 329 } 330 331 final public void JspExpression() throws ParseException { 332 333 ASTJspExpression jjtn000 = new ASTJspExpression(this, JJTJSPEXPRESSION); 334 boolean jjtc000 = true; 335 jjtree.openNodeScope(jjtn000);Token t; 336 try { 337 jj_consume_token(JSP_EXPRESSION_START); 338 t = jj_consume_token(JSP_EXPRESSION); 339 jjtn000.setImage(t.image.trim()); 340 jj_consume_token(JSP_EXPRESSION_END); 341 } finally { 342 if (jjtc000) { 343 jjtree.closeNodeScope(jjtn000, true); 344 } 345 } 346 } 347 348 final public void JspDeclaration() throws ParseException { 349 350 ASTJspDeclaration jjtn000 = new ASTJspDeclaration(this, JJTJSPDECLARATION); 351 boolean jjtc000 = true; 352 jjtree.openNodeScope(jjtn000);Token t; 353 try { 354 jj_consume_token(JSP_DECLARATION_START); 355 t = jj_consume_token(JSP_DECLARATION); 356 jjtn000.setImage(t.image.trim()); 357 jj_consume_token(JSP_DECLARATION_END); 358 } finally { 359 if (jjtc000) { 360 jjtree.closeNodeScope(jjtn000, true); 361 } 362 } 363 } 364 365 final public void JspComment() throws ParseException { 366 367 ASTJspComment jjtn000 = new ASTJspComment(this, JJTJSPCOMMENT); 368 boolean jjtc000 = true; 369 jjtree.openNodeScope(jjtn000);Token t; 370 try { 371 jj_consume_token(JSP_COMMENT_START); 372 t = jj_consume_token(JSP_COMMENT_CONTENT); 373 jjtn000.setImage(t.image.trim()); 374 jj_consume_token(JSP_COMMENT_END); 375 } finally { 376 if (jjtc000) { 377 jjtree.closeNodeScope(jjtn000, true); 378 } 379 } 380 } 381 382 387 final public void Text() throws ParseException { 388 389 ASTText jjtn000 = new ASTText(this, JJTTEXT); 390 boolean jjtc000 = true; 391 jjtree.openNodeScope(jjtn000);StringBuffer content = new StringBuffer (); 392 String tmp; 393 try { 394 label_5: 395 while (true) { 396 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 397 case UNPARSED_TEXT: 398 tmp = UnparsedText(); 399 content.append(tmp); 400 break; 401 case EL_EXPRESSION: 402 tmp = ElExpression(); 403 content.append(tmp); 404 break; 405 default: 406 jj_la1[9] = jj_gen; 407 jj_consume_token(-1); 408 throw new ParseException(); 409 } 410 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 411 case EL_EXPRESSION: 412 case UNPARSED_TEXT: 413 ; 414 break; 415 default: 416 jj_la1[10] = jj_gen; 417 break label_5; 418 } 419 } 420 jjtree.closeNodeScope(jjtn000, true); 421 jjtc000 = false; 422 jjtn000.setImage(content.toString()); 423 } catch (Throwable jjte000) { 424 if (jjtc000) { 425 jjtree.clearNodeScope(jjtn000); 426 jjtc000 = false; 427 } else { 428 jjtree.popNode(); 429 } 430 if (jjte000 instanceof RuntimeException ) { 431 {if (true) throw (RuntimeException )jjte000;} 432 } 433 if (jjte000 instanceof ParseException) { 434 {if (true) throw (ParseException)jjte000;} 435 } 436 {if (true) throw (Error )jjte000;} 437 } finally { 438 if (jjtc000) { 439 jjtree.closeNodeScope(jjtn000, true); 440 } 441 } 442 } 443 444 final public String UnparsedText() throws ParseException { 445 446 ASTUnparsedText jjtn000 = new ASTUnparsedText(this, JJTUNPARSEDTEXT); 447 boolean jjtc000 = true; 448 jjtree.openNodeScope(jjtn000);Token t; 449 try { 450 t = jj_consume_token(UNPARSED_TEXT); 451 jjtree.closeNodeScope(jjtn000, true); 452 jjtc000 = false; 453 jjtn000.setImage(t.image); 454 {if (true) return t.image;} 455 } finally { 456 if (jjtc000) { 457 jjtree.closeNodeScope(jjtn000, true); 458 } 459 } 460 throw new RuntimeException ("Missing return statement in function"); 461 } 462 463 467 final public String UnparsedTextNoSingleQuotes() throws ParseException { 468 469 ASTUnparsedText jjtn000 = new ASTUnparsedText(this, JJTUNPARSEDTEXT); 470 boolean jjtc000 = true; 471 jjtree.openNodeScope(jjtn000);Token t; 472 try { 473 t = jj_consume_token(UNPARSED_TEXT_NO_SINGLE_QUOTES); 474 jjtree.closeNodeScope(jjtn000, true); 475 jjtc000 = false; 476 jjtn000.setImage(t.image); 477 {if (true) return t.image;} 478 } finally { 479 if (jjtc000) { 480 jjtree.closeNodeScope(jjtn000, true); 481 } 482 } 483 throw new RuntimeException ("Missing return statement in function"); 484 } 485 486 490 final public String UnparsedTextNoDoubleQuotes() throws ParseException { 491 492 ASTUnparsedText jjtn000 = new ASTUnparsedText(this, JJTUNPARSEDTEXT); 493 boolean jjtc000 = true; 494 jjtree.openNodeScope(jjtn000);Token t; 495 try { 496 t = jj_consume_token(UNPARSED_TEXT_NO_DOUBLE_QUOTES); 497 jjtree.closeNodeScope(jjtn000, true); 498 jjtc000 = false; 499 jjtn000.setImage(t.image); 500 {if (true) return t.image;} 501 } finally { 502 if (jjtc000) { 503 jjtree.closeNodeScope(jjtn000, true); 504 } 505 } 506 throw new RuntimeException ("Missing return statement in function"); 507 } 508 509 512 final public String ElExpression() throws ParseException { 513 514 ASTElExpression jjtn000 = new ASTElExpression(this, JJTELEXPRESSION); 515 boolean jjtc000 = true; 516 jjtree.openNodeScope(jjtn000);Token t; 517 try { 518 t = jj_consume_token(EL_EXPRESSION); 519 jjtree.closeNodeScope(jjtn000, true); 520 jjtc000 = false; 521 jjtn000.setImage(expressionContent(t.image)); 522 {if (true) return t.image;} 523 } finally { 524 if (jjtc000) { 525 jjtree.closeNodeScope(jjtn000, true); 526 } 527 } 528 throw new RuntimeException ("Missing return statement in function"); 529 } 530 531 final public String ValueBindingInAttribute() throws ParseException { 532 533 ASTValueBinding jjtn000 = new ASTValueBinding(this, JJTVALUEBINDING); 534 boolean jjtc000 = true; 535 jjtree.openNodeScope(jjtn000);Token t; 536 try { 537 t = jj_consume_token(VALUE_BINDING_IN_ATTRIBUTE); 538 jjtree.closeNodeScope(jjtn000, true); 539 jjtc000 = false; 540 jjtn000.setImage(expressionContent(t.image)); 541 {if (true) return t.image;} 542 } finally { 543 if (jjtc000) { 544 jjtree.closeNodeScope(jjtn000, true); 545 } 546 } 547 throw new RuntimeException ("Missing return statement in function"); 548 } 549 550 final public String ElExpressionInAttribute() throws ParseException { 551 552 ASTElExpression jjtn000 = new ASTElExpression(this, JJTELEXPRESSION); 553 boolean jjtc000 = true; 554 jjtree.openNodeScope(jjtn000);Token t; 555 try { 556 t = jj_consume_token(EL_EXPRESSION_IN_ATTRIBUTE); 557 jjtree.closeNodeScope(jjtn000, true); 558 jjtc000 = false; 559 jjtn000.setImage(expressionContent(t.image)); 560 {if (true) return t.image;} 561 } finally { 562 if (jjtc000) { 563 jjtree.closeNodeScope(jjtn000, true); 564 } 565 } 566 throw new RuntimeException ("Missing return statement in function"); 567 } 568 569 final public void CData() throws ParseException { 570 571 ASTCData jjtn000 = new ASTCData(this, JJTCDATA); 572 boolean jjtc000 = true; 573 jjtree.openNodeScope(jjtn000);StringBuffer content = new StringBuffer (); 574 Token t; 575 try { 576 jj_consume_token(CDATA_START); 577 label_6: 578 while (true) { 579 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 580 case UNPARSED: 581 ; 582 break; 583 default: 584 jj_la1[11] = jj_gen; 585 break label_6; 586 } 587 t = jj_consume_token(UNPARSED); 588 content.append(t.image); 589 } 590 jj_consume_token(CDATA_END); 591 jjtree.closeNodeScope(jjtn000, true); 592 jjtc000 = false; 593 jjtn000.setImage(content.toString()); 594 } finally { 595 if (jjtc000) { 596 jjtree.closeNodeScope(jjtn000, true); 597 } 598 } 599 } 600 601 605 final public void Element() throws ParseException { 606 607 ASTElement jjtn000 = new ASTElement(this, JJTELEMENT); 608 boolean jjtc000 = true; 609 jjtree.openNodeScope(jjtn000);Token startTagName; 610 Token endTagName; 611 String tagName; 612 try { 613 jj_consume_token(TAG_START); 614 startTagName = jj_consume_token(TAG_NAME); 615 tagName = startTagName.image; jjtn000.setName(tagName); 616 label_7: 617 while (true) { 618 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 619 case ATTR_NAME: 620 ; 621 break; 622 default: 623 jj_la1[12] = jj_gen; 624 break label_7; 625 } 626 Attribute(); 627 } 628 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 629 case TAG_END: 630 jj_consume_token(TAG_END); 631 jjtn000.setEmpty(false); 632 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 633 case TAG_START: 634 case COMMENT_START: 635 case CDATA_START: 636 case JSP_COMMENT_START: 637 case JSP_DECLARATION_START: 638 case JSP_EXPRESSION_START: 639 case JSP_SCRIPTLET_START: 640 case JSP_DIRECTIVE_START: 641 case EL_EXPRESSION: 642 case UNPARSED_TEXT: 643 Content(); 644 break; 645 default: 646 jj_la1[13] = jj_gen; 647 ; 648 } 649 jj_consume_token(ENDTAG_START); 650 endTagName = jj_consume_token(TAG_NAME); 651 if (! tagName.equalsIgnoreCase(endTagName.image)) { 652 {if (true) throw new StartAndEndTagMismatchException( 653 startTagName.beginLine, startTagName.beginColumn, 654 startTagName.image, 655 endTagName.beginLine, endTagName.beginColumn, 656 endTagName.image );} 657 } 658 jj_consume_token(TAG_END); 659 break; 660 case TAG_SLASHEND: 661 jj_consume_token(TAG_SLASHEND); 662 jjtree.closeNodeScope(jjtn000, true); 663 jjtc000 = false; 664 jjtn000.setEmpty(true); 665 break; 666 default: 667 jj_la1[14] = jj_gen; 668 jj_consume_token(-1); 669 throw new ParseException(); 670 } 671 } catch (Throwable jjte000) { 672 if (jjtc000) { 673 jjtree.clearNodeScope(jjtn000); 674 jjtc000 = false; 675 } else { 676 jjtree.popNode(); 677 } 678 if (jjte000 instanceof RuntimeException ) { 679 {if (true) throw (RuntimeException )jjte000;} 680 } 681 if (jjte000 instanceof ParseException) { 682 {if (true) throw (ParseException)jjte000;} 683 } 684 {if (true) throw (Error )jjte000;} 685 } finally { 686 if (jjtc000) { 687 jjtree.closeNodeScope(jjtn000, true); 688 } 689 } 690 } 691 692 final public void Attribute() throws ParseException { 693 694 ASTAttribute jjtn000 = new ASTAttribute(this, JJTATTRIBUTE); 695 boolean jjtc000 = true; 696 jjtree.openNodeScope(jjtn000);Token t; 697 try { 698 t = jj_consume_token(ATTR_NAME); 699 jjtn000.setName(t.image); 700 jj_consume_token(ATTR_EQ); 701 AttributeValue(); 702 } catch (Throwable jjte000) { 703 if (jjtc000) { 704 jjtree.clearNodeScope(jjtn000); 705 jjtc000 = false; 706 } else { 707 jjtree.popNode(); 708 } 709 if (jjte000 instanceof RuntimeException ) { 710 {if (true) throw (RuntimeException )jjte000;} 711 } 712 if (jjte000 instanceof ParseException) { 713 {if (true) throw (ParseException)jjte000;} 714 } 715 {if (true) throw (Error )jjte000;} 716 } finally { 717 if (jjtc000) { 718 jjtree.closeNodeScope(jjtn000, true); 719 } 720 } 721 } 722 723 728 final public void AttributeValue() throws ParseException { 729 730 ASTAttributeValue jjtn000 = new ASTAttributeValue(this, JJTATTRIBUTEVALUE); 731 boolean jjtc000 = true; 732 jjtree.openNodeScope(jjtn000);StringBuffer content = new StringBuffer (); 733 String tmp; 734 Token t; 735 try { 736 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 737 case DOUBLE_QUOTE: 738 jj_consume_token(DOUBLE_QUOTE); 739 label_8: 740 while (true) { 741 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 742 case EL_EXPRESSION_IN_ATTRIBUTE: 743 case VALUE_BINDING_IN_ATTRIBUTE: 744 case JSP_EXPRESSION_IN_ATTRIBUTE: 745 case UNPARSED_TEXT_NO_DOUBLE_QUOTES: 746 ; 747 break; 748 default: 749 jj_la1[15] = jj_gen; 750 break label_8; 751 } 752 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 753 case UNPARSED_TEXT_NO_DOUBLE_QUOTES: 754 tmp = UnparsedTextNoDoubleQuotes(); 755 break; 756 case EL_EXPRESSION_IN_ATTRIBUTE: 757 case VALUE_BINDING_IN_ATTRIBUTE: 758 case JSP_EXPRESSION_IN_ATTRIBUTE: 759 tmp = QuoteIndependentAttributeValueContent(); 760 break; 761 default: 762 jj_la1[16] = jj_gen; 763 jj_consume_token(-1); 764 throw new ParseException(); 765 } 766 content.append(tmp); 767 } 768 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 769 case ENDING_DOUBLE_QUOTE: 770 jj_consume_token(ENDING_DOUBLE_QUOTE); 771 break; 772 case DOLLAR_OR_HASH_DOUBLE_QUOTE: 773 t = jj_consume_token(DOLLAR_OR_HASH_DOUBLE_QUOTE); 774 content.append(t.image.substring(0, 1)); 775 break; 776 default: 777 jj_la1[17] = jj_gen; 778 jj_consume_token(-1); 779 throw new ParseException(); 780 } 781 break; 782 case SINGLE_QUOTE: 783 jj_consume_token(SINGLE_QUOTE); 784 label_9: 785 while (true) { 786 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 787 case EL_EXPRESSION_IN_ATTRIBUTE: 788 case VALUE_BINDING_IN_ATTRIBUTE: 789 case JSP_EXPRESSION_IN_ATTRIBUTE: 790 case UNPARSED_TEXT_NO_SINGLE_QUOTES: 791 ; 792 break; 793 default: 794 jj_la1[18] = jj_gen; 795 break label_9; 796 } 797 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 798 case UNPARSED_TEXT_NO_SINGLE_QUOTES: 799 tmp = UnparsedTextNoSingleQuotes(); 800 break; 801 case EL_EXPRESSION_IN_ATTRIBUTE: 802 case VALUE_BINDING_IN_ATTRIBUTE: 803 case JSP_EXPRESSION_IN_ATTRIBUTE: 804 tmp = QuoteIndependentAttributeValueContent(); 805 break; 806 default: 807 jj_la1[19] = jj_gen; 808 jj_consume_token(-1); 809 throw new ParseException(); 810 } 811 content.append(tmp); 812 } 813 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 814 case ENDING_SINGLE_QUOTE: 815 jj_consume_token(ENDING_SINGLE_QUOTE); 816 break; 817 case DOLLAR_OR_HASH_SINGLE_QUOTE: 818 t = jj_consume_token(DOLLAR_OR_HASH_SINGLE_QUOTE); 819 content.append(t.image.substring(0, 1)); 820 break; 821 default: 822 jj_la1[20] = jj_gen; 823 jj_consume_token(-1); 824 throw new ParseException(); 825 } 826 break; 827 default: 828 jj_la1[21] = jj_gen; 829 jj_consume_token(-1); 830 throw new ParseException(); 831 } 832 jjtree.closeNodeScope(jjtn000, true); 833 jjtc000 = false; 834 jjtn000.setImage( content.toString() ); 835 } catch (Throwable jjte000) { 836 if (jjtc000) { 837 jjtree.clearNodeScope(jjtn000); 838 jjtc000 = false; 839 } else { 840 jjtree.popNode(); 841 } 842 if (jjte000 instanceof RuntimeException ) { 843 {if (true) throw (RuntimeException )jjte000;} 844 } 845 if (jjte000 instanceof ParseException) { 846 {if (true) throw (ParseException)jjte000;} 847 } 848 {if (true) throw (Error )jjte000;} 849 } finally { 850 if (jjtc000) { 851 jjtree.closeNodeScope(jjtn000, true); 852 } 853 } 854 } 855 856 860 final public String QuoteIndependentAttributeValueContent() throws ParseException { 861 String tmp; 862 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 863 case EL_EXPRESSION_IN_ATTRIBUTE: 864 tmp = ElExpressionInAttribute(); 865 break; 866 case VALUE_BINDING_IN_ATTRIBUTE: 867 tmp = ValueBindingInAttribute(); 868 break; 869 case JSP_EXPRESSION_IN_ATTRIBUTE: 870 tmp = JspExpressionInAttribute(); 871 break; 872 default: 873 jj_la1[22] = jj_gen; 874 jj_consume_token(-1); 875 throw new ParseException(); 876 } 877 {if (true) return tmp;} 878 throw new RuntimeException ("Missing return statement in function"); 879 } 880 881 final public String JspExpressionInAttribute() throws ParseException { 882 883 ASTJspExpressionInAttribute jjtn000 = new ASTJspExpressionInAttribute(this, JJTJSPEXPRESSIONINATTRIBUTE); 884 boolean jjtc000 = true; 885 jjtree.openNodeScope(jjtn000);Token t; 886 try { 887 t = jj_consume_token(JSP_EXPRESSION_IN_ATTRIBUTE); 888 jjtree.closeNodeScope(jjtn000, true); 889 jjtc000 = false; 890 jjtn000.setImage(t.image.substring(3, t.image.length()-2).trim()); {if (true) return t.image;} 892 } finally { 893 if (jjtc000) { 894 jjtree.closeNodeScope(jjtn000, true); 895 } 896 } 897 throw new RuntimeException ("Missing return statement in function"); 898 } 899 900 final public void CommentTag() throws ParseException { 901 902 ASTCommentTag jjtn000 = new ASTCommentTag(this, JJTCOMMENTTAG); 903 boolean jjtc000 = true; 904 jjtree.openNodeScope(jjtn000);StringBuffer content = new StringBuffer (); 905 Token t; 906 try { 907 jj_consume_token(COMMENT_START); 908 label_10: 909 while (true) { 910 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 911 case COMMENT_TEXT: 912 ; 913 break; 914 default: 915 jj_la1[23] = jj_gen; 916 break label_10; 917 } 918 t = jj_consume_token(COMMENT_TEXT); 919 content.append(t.image); 920 } 921 jj_consume_token(COMMENT_END); 922 jjtree.closeNodeScope(jjtn000, true); 923 jjtc000 = false; 924 jjtn000.setImage(content.toString().trim()); 925 } finally { 926 if (jjtc000) { 927 jjtree.closeNodeScope(jjtn000, true); 928 } 929 } 930 } 931 932 final public void Declaration() throws ParseException { 933 934 ASTDeclaration jjtn000 = new ASTDeclaration(this, JJTDECLARATION); 935 boolean jjtc000 = true; 936 jjtree.openNodeScope(jjtn000);Token t; 937 try { 938 jj_consume_token(DECL_START); 939 t = jj_consume_token(TAG_NAME); 940 jjtn000.setName(t.image); 941 label_11: 942 while (true) { 943 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 944 case ATTR_NAME: 945 ; 946 break; 947 default: 948 jj_la1[24] = jj_gen; 949 break label_11; 950 } 951 Attribute(); 952 } 953 jj_consume_token(DECL_END); 954 } catch (Throwable jjte000) { 955 if (jjtc000) { 956 jjtree.clearNodeScope(jjtn000); 957 jjtc000 = false; 958 } else { 959 jjtree.popNode(); 960 } 961 if (jjte000 instanceof RuntimeException ) { 962 {if (true) throw (RuntimeException )jjte000;} 963 } 964 if (jjte000 instanceof ParseException) { 965 {if (true) throw (ParseException)jjte000;} 966 } 967 {if (true) throw (Error )jjte000;} 968 } finally { 969 if (jjtc000) { 970 jjtree.closeNodeScope(jjtn000, true); 971 } 972 } 973 } 974 975 final public void DoctypeDeclaration() throws ParseException { 976 977 ASTDoctypeDeclaration jjtn000 = new ASTDoctypeDeclaration(this, JJTDOCTYPEDECLARATION); 978 boolean jjtc000 = true; 979 jjtree.openNodeScope(jjtn000);Token t; 980 try { 981 jj_consume_token(DOCTYPE_DECL_START); 982 jj_consume_token(WHITESPACES); 983 t = jj_consume_token(NAME); 984 jjtn000.setName(t.image); 985 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 986 case WHITESPACES: 987 jj_consume_token(WHITESPACES); 988 break; 989 default: 990 jj_la1[25] = jj_gen; 991 ; 992 } 993 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 994 case PUBLIC: 995 case SYSTEM: 996 DoctypeExternalId(); 997 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 998 case WHITESPACES: 999 jj_consume_token(WHITESPACES); 1000 break; 1001 default: 1002 jj_la1[26] = jj_gen; 1003 ; 1004 } 1005 break; 1006 default: 1007 jj_la1[27] = jj_gen; 1008 ; 1009 } 1010 jj_consume_token(DOCTYPE_DECL_END); 1011 } catch (Throwable jjte000) { 1012 if (jjtc000) { 1013 jjtree.clearNodeScope(jjtn000); 1014 jjtc000 = false; 1015 } else { 1016 jjtree.popNode(); 1017 } 1018 if (jjte000 instanceof RuntimeException ) { 1019 {if (true) throw (RuntimeException )jjte000;} 1020 } 1021 if (jjte000 instanceof ParseException) { 1022 {if (true) throw (ParseException)jjte000;} 1023 } 1024 {if (true) throw (Error )jjte000;} 1025 } finally { 1026 if (jjtc000) { 1027 jjtree.closeNodeScope(jjtn000, true); 1028 } 1029 } 1030 } 1031 1032 final public void DoctypeExternalId() throws ParseException { 1033 1034 ASTDoctypeExternalId jjtn000 = new ASTDoctypeExternalId(this, JJTDOCTYPEEXTERNALID); 1035 boolean jjtc000 = true; 1036 jjtree.openNodeScope(jjtn000);Token systemLiteral; 1037 Token pubIdLiteral; 1038 try { 1039 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1040 case SYSTEM: 1041 jj_consume_token(SYSTEM); 1042 jj_consume_token(WHITESPACES); 1043 systemLiteral = jj_consume_token(QUOTED_LITERAL); 1044 jjtree.closeNodeScope(jjtn000, true); 1045 jjtc000 = false; 1046 jjtn000.setUri(quoteContent(systemLiteral.image)); 1047 break; 1048 case PUBLIC: 1049 jj_consume_token(PUBLIC); 1050 jj_consume_token(WHITESPACES); 1051 pubIdLiteral = jj_consume_token(QUOTED_LITERAL); 1052 jjtn000.setPublicId(quoteContent(pubIdLiteral.image)); 1053 jj_consume_token(WHITESPACES); 1054 systemLiteral = jj_consume_token(QUOTED_LITERAL); 1055 jjtree.closeNodeScope(jjtn000, true); 1056 jjtc000 = false; 1057 jjtn000.setUri(quoteContent(systemLiteral.image)); 1058 break; 1059 default: 1060 jj_la1[28] = jj_gen; 1061 jj_consume_token(-1); 1062 throw new ParseException(); 1063 } 1064 } finally { 1065 if (jjtc000) { 1066 jjtree.closeNodeScope(jjtn000, true); 1067 } 1068 } 1069 } 1070 1071 final private boolean jj_2_1(int xla) { 1072 jj_la = xla; jj_lastpos = jj_scanpos = token; 1073 try { return !jj_3_1(); } 1074 catch(LookaheadSuccess ls) { return true; } 1075 finally { jj_save(0, xla); } 1076 } 1077 1078 final private boolean jj_2_2(int xla) { 1079 jj_la = xla; jj_lastpos = jj_scanpos = token; 1080 try { return !jj_3_2(); } 1081 catch(LookaheadSuccess ls) { return true; } 1082 finally { jj_save(1, xla); } 1083 } 1084 1085 final private boolean jj_3R_31() { 1086 if (jj_scan_token(SINGLE_QUOTE)) return true; 1087 Token xsp; 1088 while (true) { 1089 xsp = jj_scanpos; 1090 if (jj_3R_34()) { jj_scanpos = xsp; break; } 1091 } 1092 xsp = jj_scanpos; 1093 if (jj_scan_token(69)) { 1094 jj_scanpos = xsp; 1095 if (jj_3R_35()) return true; 1096 } 1097 return false; 1098 } 1099 1100 final private boolean jj_3R_46() { 1101 if (jj_scan_token(EL_EXPRESSION_IN_ATTRIBUTE)) return true; 1102 return false; 1103 } 1104 1105 final private boolean jj_3R_30() { 1106 if (jj_scan_token(DOUBLE_QUOTE)) return true; 1107 Token xsp; 1108 while (true) { 1109 xsp = jj_scanpos; 1110 if (jj_3R_32()) { jj_scanpos = xsp; break; } 1111 } 1112 xsp = jj_scanpos; 1113 if (jj_scan_token(72)) { 1114 jj_scanpos = xsp; 1115 if (jj_3R_33()) return true; 1116 } 1117 return false; 1118 } 1119 1120 final private boolean jj_3R_29() { 1121 if (jj_scan_token(PUBLIC)) return true; 1122 if (jj_scan_token(WHITESPACES)) return true; 1123 if (jj_scan_token(QUOTED_LITERAL)) return true; 1124 if (jj_scan_token(WHITESPACES)) return true; 1125 if (jj_scan_token(QUOTED_LITERAL)) return true; 1126 return false; 1127 } 1128 1129 final private boolean jj_3R_47() { 1130 if (jj_scan_token(VALUE_BINDING_IN_ATTRIBUTE)) return true; 1131 return false; 1132 } 1133 1134 final private boolean jj_3R_27() { 1135 Token xsp; 1136 xsp = jj_scanpos; 1137 if (jj_3R_30()) { 1138 jj_scanpos = xsp; 1139 if (jj_3R_31()) return true; 1140 } 1141 return false; 1142 } 1143 1144 final private boolean jj_3R_25() { 1145 Token xsp; 1146 xsp = jj_scanpos; 1147 if (jj_3R_28()) { 1148 jj_scanpos = xsp; 1149 if (jj_3R_29()) return true; 1150 } 1151 return false; 1152 } 1153 1154 final private boolean jj_3R_28() { 1155 if (jj_scan_token(SYSTEM)) return true; 1156 if (jj_scan_token(WHITESPACES)) return true; 1157 if (jj_scan_token(QUOTED_LITERAL)) return true; 1158 return false; 1159 } 1160 1161 final private boolean jj_3R_21() { 1162 if (jj_3R_25()) return true; 1163 Token xsp; 1164 xsp = jj_scanpos; 1165 if (jj_scan_token(48)) jj_scanpos = xsp; 1166 return false; 1167 } 1168 1169 final private boolean jj_3R_40() { 1170 if (jj_scan_token(UNPARSED_TEXT_NO_DOUBLE_QUOTES)) return true; 1171 return false; 1172 } 1173 1174 final private boolean jj_3R_15() { 1175 if (jj_scan_token(DOCTYPE_DECL_START)) return true; 1176 if (jj_scan_token(WHITESPACES)) return true; 1177 if (jj_scan_token(NAME)) return true; 1178 Token xsp; 1179 xsp = jj_scanpos; 1180 if (jj_scan_token(48)) jj_scanpos = xsp; 1181 xsp = jj_scanpos; 1182 if (jj_3R_21()) jj_scanpos = xsp; 1183 if (jj_scan_token(DOCTYPE_DECL_END)) return true; 1184 return false; 1185 } 1186 1187 final private boolean jj_3R_24() { 1188 if (jj_scan_token(ATTR_NAME)) return true; 1189 if (jj_scan_token(ATTR_EQ)) return true; 1190 if (jj_3R_27()) return true; 1191 return false; 1192 } 1193 1194 final private boolean jj_3R_20() { 1195 if (jj_3R_23()) return true; 1196 return false; 1197 } 1198 1199 final private boolean jj_3R_42() { 1200 if (jj_scan_token(UNPARSED_TEXT_NO_SINGLE_QUOTES)) return true; 1201 return false; 1202 } 1203 1204 final private boolean jj_3R_18() { 1205 if (jj_3R_24()) return true; 1206 return false; 1207 } 1208 1209 final private boolean jj_3R_13() { 1210 if (jj_scan_token(DECL_START)) return true; 1211 if (jj_scan_token(TAG_NAME)) return true; 1212 Token xsp; 1213 while (true) { 1214 xsp = jj_scanpos; 1215 if (jj_3R_18()) { jj_scanpos = xsp; break; } 1216 } 1217 if (jj_scan_token(DECL_END)) return true; 1218 return false; 1219 } 1220 1221 final private boolean jj_3R_17() { 1222 if (jj_3R_23()) return true; 1223 return false; 1224 } 1225 1226 final private boolean jj_3R_26() { 1227 if (jj_scan_token(COMMENT_TEXT)) return true; 1228 return false; 1229 } 1230 1231 final private boolean jj_3R_19() { 1232 if (jj_3R_22()) return true; 1233 return false; 1234 } 1235 1236 final private boolean jj_3R_14() { 1237 Token xsp; 1238 xsp = jj_scanpos; 1239 if (jj_3R_19()) { 1240 jj_scanpos = xsp; 1241 if (jj_3R_20()) return true; 1242 } 1243 return false; 1244 } 1245 1246 final private boolean jj_3R_22() { 1247 if (jj_scan_token(COMMENT_START)) return true; 1248 Token xsp; 1249 while (true) { 1250 xsp = jj_scanpos; 1251 if (jj_3R_26()) { jj_scanpos = xsp; break; } 1252 } 1253 if (jj_scan_token(COMMENT_END)) return true; 1254 return false; 1255 } 1256 1257 final private boolean jj_3_2() { 1258 Token xsp; 1259 while (true) { 1260 xsp = jj_scanpos; 1261 if (jj_3R_14()) { jj_scanpos = xsp; break; } 1262 } 1263 if (jj_3R_15()) return true; 1264 return false; 1265 } 1266 1267 final private boolean jj_3R_12() { 1268 Token xsp; 1269 xsp = jj_scanpos; 1270 if (jj_3R_16()) { 1271 jj_scanpos = xsp; 1272 if (jj_3R_17()) return true; 1273 } 1274 return false; 1275 } 1276 1277 final private boolean jj_3R_16() { 1278 if (jj_3R_22()) return true; 1279 return false; 1280 } 1281 1282 final private boolean jj_3R_48() { 1283 if (jj_scan_token(JSP_EXPRESSION_IN_ATTRIBUTE)) return true; 1284 return false; 1285 } 1286 1287 final private boolean jj_3R_45() { 1288 if (jj_3R_48()) return true; 1289 return false; 1290 } 1291 1292 final private boolean jj_3_1() { 1293 Token xsp; 1294 while (true) { 1295 xsp = jj_scanpos; 1296 if (jj_3R_12()) { jj_scanpos = xsp; break; } 1297 } 1298 if (jj_3R_13()) return true; 1299 return false; 1300 } 1301 1302 final private boolean jj_3R_44() { 1303 if (jj_3R_47()) return true; 1304 return false; 1305 } 1306 1307 final private boolean jj_3R_43() { 1308 if (jj_3R_46()) return true; 1309 return false; 1310 } 1311 1312 final private boolean jj_3R_39() { 1313 if (jj_3R_41()) return true; 1314 return false; 1315 } 1316 1317 final private boolean jj_3R_35() { 1318 if (jj_scan_token(DOLLAR_OR_HASH_SINGLE_QUOTE)) return true; 1319 return false; 1320 } 1321 1322 final private boolean jj_3R_38() { 1323 if (jj_3R_42()) return true; 1324 return false; 1325 } 1326 1327 final private boolean jj_3R_33() { 1328 if (jj_scan_token(DOLLAR_OR_HASH_DOUBLE_QUOTE)) return true; 1329 return false; 1330 } 1331 1332 final private boolean jj_3R_41() { 1333 Token xsp; 1334 xsp = jj_scanpos; 1335 if (jj_3R_43()) { 1336 jj_scanpos = xsp; 1337 if (jj_3R_44()) { 1338 jj_scanpos = xsp; 1339 if (jj_3R_45()) return true; 1340 } 1341 } 1342 return false; 1343 } 1344 1345 final private boolean jj_3R_34() { 1346 Token xsp; 1347 xsp = jj_scanpos; 1348 if (jj_3R_38()) { 1349 jj_scanpos = xsp; 1350 if (jj_3R_39()) return true; 1351 } 1352 return false; 1353 } 1354 1355 final private boolean jj_3R_37() { 1356 if (jj_3R_41()) return true; 1357 return false; 1358 } 1359 1360 final private boolean jj_3R_36() { 1361 if (jj_3R_40()) return true; 1362 return false; 1363 } 1364 1365 final private boolean jj_3R_23() { 1366 if (jj_scan_token(JSP_COMMENT_START)) return true; 1367 if (jj_scan_token(JSP_COMMENT_CONTENT)) return true; 1368 if (jj_scan_token(JSP_COMMENT_END)) return true; 1369 return false; 1370 } 1371 1372 final private boolean jj_3R_32() { 1373 Token xsp; 1374 xsp = jj_scanpos; 1375 if (jj_3R_36()) { 1376 jj_scanpos = xsp; 1377 if (jj_3R_37()) return true; 1378 } 1379 return false; 1380 } 1381 1382 public JspParserTokenManager token_source; 1383 public Token token, jj_nt; 1384 private int jj_ntk; 1385 private Token jj_scanpos, jj_lastpos; 1386 private int jj_la; 1387 public boolean lookingAhead = false; 1388 private boolean jj_semLA; 1389 private int jj_gen; 1390 final private int[] jj_la1 = new int[29]; 1391 static private int[] jj_la1_0; 1392 static private int[] jj_la1_1; 1393 static private int[] jj_la1_2; 1394 static { 1395 jj_la1_0(); 1396 jj_la1_1(); 1397 jj_la1_2(); 1398 } 1399 private static void jj_la1_0() { 1400 jj_la1_0 = new int[] {0x11000000,0x11000000,0x11000000,0x11000000,0xf9400000,0xf9400000,0xf9400000,0x0,0x0,0x0,0x0,0x0,0x0,0xf9400000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; 1401 } 1402 private static void jj_la1_1() { 1403 jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x7,0x1,0x1,0x6,0x10,0x6,0x6,0x400000,0x4000000,0x7,0x28000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4000000,0x10000,0x10000,0xc0000,0xc0000,}; 1404 } 1405 private static void jj_la1_2() { 1406 jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x21c,0x21c,0x500,0x5c,0x5c,0xa0,0x3,0x1c,0x1000,0x0,0x0,0x0,0x0,0x0,}; 1407 } 1408 final private JJCalls[] jj_2_rtns = new JJCalls[2]; 1409 private boolean jj_rescan = false; 1410 private int jj_gc = 0; 1411 1412 public JspParser(CharStream stream) { 1413 token_source = new JspParserTokenManager(stream); 1414 token = new Token(); 1415 jj_ntk = -1; 1416 jj_gen = 0; 1417 for (int i = 0; i < 29; i++) jj_la1[i] = -1; 1418 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 1419 } 1420 1421 public void ReInit(CharStream stream) { 1422 token_source.ReInit(stream); 1423 token = new Token(); 1424 jj_ntk = -1; 1425 jjtree.reset(); 1426 jj_gen = 0; 1427 for (int i = 0; i < 29; i++) jj_la1[i] = -1; 1428 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 1429 } 1430 1431 public JspParser(JspParserTokenManager tm) { 1432 token_source = tm; 1433 token = new Token(); 1434 jj_ntk = -1; 1435 jj_gen = 0; 1436 for (int i = 0; i < 29; i++) jj_la1[i] = -1; 1437 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 1438 } 1439 1440 public void ReInit(JspParserTokenManager tm) { 1441 token_source = tm; 1442 token = new Token(); 1443 jj_ntk = -1; 1444 jjtree.reset(); 1445 jj_gen = 0; 1446 for (int i = 0; i < 29; i++) jj_la1[i] = -1; 1447 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 1448 } 1449 1450 final private Token jj_consume_token(int kind) throws ParseException { 1451 Token oldToken; 1452 if ((oldToken = token).next != null) token = token.next; 1453 else token = token.next = token_source.getNextToken(); 1454 jj_ntk = -1; 1455 if (token.kind == kind) { 1456 jj_gen++; 1457 if (++jj_gc > 100) { 1458 jj_gc = 0; 1459 for (int i = 0; i < jj_2_rtns.length; i++) { 1460 JJCalls c = jj_2_rtns[i]; 1461 while (c != null) { 1462 if (c.gen < jj_gen) c.first = null; 1463 c = c.next; 1464 } 1465 } 1466 } 1467 return token; 1468 } 1469 token = oldToken; 1470 jj_kind = kind; 1471 throw generateParseException(); 1472 } 1473 1474 static private final class LookaheadSuccess extends java.lang.Error { } 1475 final private LookaheadSuccess jj_ls = new LookaheadSuccess(); 1476 final private boolean jj_scan_token(int kind) { 1477 if (jj_scanpos == jj_lastpos) { 1478 jj_la--; 1479 if (jj_scanpos.next == null) { 1480 jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); 1481 } else { 1482 jj_lastpos = jj_scanpos = jj_scanpos.next; 1483 } 1484 } else { 1485 jj_scanpos = jj_scanpos.next; 1486 } 1487 if (jj_rescan) { 1488 int i = 0; Token tok = token; 1489 while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } 1490 if (tok != null) jj_add_error_token(kind, i); 1491 } 1492 if (jj_scanpos.kind != kind) return true; 1493 if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; 1494 return false; 1495 } 1496 1497 final public Token getNextToken() { 1498 if (token.next != null) token = token.next; 1499 else token = token.next = token_source.getNextToken(); 1500 jj_ntk = -1; 1501 jj_gen++; 1502 return token; 1503 } 1504 1505 final public Token getToken(int index) { 1506 Token t = lookingAhead ? jj_scanpos : token; 1507 for (int i = 0; i < index; i++) { 1508 if (t.next != null) t = t.next; 1509 else t = t.next = token_source.getNextToken(); 1510 } 1511 return t; 1512 } 1513 1514 final private int jj_ntk() { 1515 if ((jj_nt=token.next) == null) 1516 return (jj_ntk = (token.next=token_source.getNextToken()).kind); 1517 else 1518 return (jj_ntk = jj_nt.kind); 1519 } 1520 1521 private java.util.Vector jj_expentries = new java.util.Vector (); 1522 private int[] jj_expentry; 1523 private int jj_kind = -1; 1524 private int[] jj_lasttokens = new int[100]; 1525 private int jj_endpos; 1526 1527 private void jj_add_error_token(int kind, int pos) { 1528 if (pos >= 100) return; 1529 if (pos == jj_endpos + 1) { 1530 jj_lasttokens[jj_endpos++] = kind; 1531 } else if (jj_endpos != 0) { 1532 jj_expentry = new int[jj_endpos]; 1533 for (int i = 0; i < jj_endpos; i++) { 1534 jj_expentry[i] = jj_lasttokens[i]; 1535 } 1536 boolean exists = false; 1537 for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements();) { 1538 int[] oldentry = (int[])(e.nextElement()); 1539 if (oldentry.length == jj_expentry.length) { 1540 exists = true; 1541 for (int i = 0; i < jj_expentry.length; i++) { 1542 if (oldentry[i] != jj_expentry[i]) { 1543 exists = false; 1544 break; 1545 } 1546 } 1547 if (exists) break; 1548 } 1549 } 1550 if (!exists) jj_expentries.addElement(jj_expentry); 1551 if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; 1552 } 1553 } 1554 1555 public ParseException generateParseException() { 1556 jj_expentries.removeAllElements(); 1557 boolean[] la1tokens = new boolean[77]; 1558 for (int i = 0; i < 77; i++) { 1559 la1tokens[i] = false; 1560 } 1561 if (jj_kind >= 0) { 1562 la1tokens[jj_kind] = true; 1563 jj_kind = -1; 1564 } 1565 for (int i = 0; i < 29; i++) { 1566 if (jj_la1[i] == jj_gen) { 1567 for (int j = 0; j < 32; j++) { 1568 if ((jj_la1_0[i] & (1<<j)) != 0) { 1569 la1tokens[j] = true; 1570 } 1571 if ((jj_la1_1[i] & (1<<j)) != 0) { 1572 la1tokens[32+j] = true; 1573 } 1574 if ((jj_la1_2[i] & (1<<j)) != 0) { 1575 la1tokens[64+j] = true; 1576 } 1577 } 1578 } 1579 } 1580 for (int i = 0; i < 77; i++) { 1581 if (la1tokens[i]) { 1582 jj_expentry = new int[1]; 1583 jj_expentry[0] = i; 1584 jj_expentries.addElement(jj_expentry); 1585 } 1586 } 1587 jj_endpos = 0; 1588 jj_rescan_token(); 1589 jj_add_error_token(0, 0); 1590 int[][] exptokseq = new int[jj_expentries.size()][]; 1591 for (int i = 0; i < jj_expentries.size(); i++) { 1592 exptokseq[i] = (int[])jj_expentries.elementAt(i); 1593 } 1594 return new ParseException(token, exptokseq, tokenImage); 1595 } 1596 1597 final public void enable_tracing() { 1598 } 1599 1600 final public void disable_tracing() { 1601 } 1602 1603 final private void jj_rescan_token() { 1604 jj_rescan = true; 1605 for (int i = 0; i < 2; i++) { 1606 try { 1607 JJCalls p = jj_2_rtns[i]; 1608 do { 1609 if (p.gen > jj_gen) { 1610 jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; 1611 switch (i) { 1612 case 0: jj_3_1(); break; 1613 case 1: jj_3_2(); break; 1614 } 1615 } 1616 p = p.next; 1617 } while (p != null); 1618 } catch(LookaheadSuccess ls) { } 1619 } 1620 jj_rescan = false; 1621 } 1622 1623 final private void jj_save(int index, int xla) { 1624 JJCalls p = jj_2_rtns[index]; 1625 while (p.gen > jj_gen) { 1626 if (p.next == null) { p = p.next = new JJCalls(); break; } 1627 p = p.next; 1628 } 1629 p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; 1630 } 1631 1632 static final class JJCalls { 1633 int gen; 1634 Token first; 1635 int arg; 1636 JJCalls next; 1637 } 1638 1639} 1640 | Popular Tags |