1 2 package com.genimen.djeneric.tools.generator.core; 3 4 import java.io.ByteArrayInputStream ; 5 import java.io.UnsupportedEncodingException ; 6 import java.util.ArrayList ; 7 8 import com.genimen.djeneric.tools.generator.core.nodes.AndOrNode; 9 import com.genimen.djeneric.tools.generator.core.nodes.BodyNode; 10 import com.genimen.djeneric.tools.generator.core.nodes.BoolNode; 11 import com.genimen.djeneric.tools.generator.core.nodes.CalculatedExpressionNode; 12 import com.genimen.djeneric.tools.generator.core.nodes.CharNode; 13 import com.genimen.djeneric.tools.generator.core.nodes.CommentNode; 14 import com.genimen.djeneric.tools.generator.core.nodes.ConstNode; 15 import com.genimen.djeneric.tools.generator.core.nodes.ElseNode; 16 import com.genimen.djeneric.tools.generator.core.nodes.ExpressionNode; 17 import com.genimen.djeneric.tools.generator.core.nodes.FloatNode; 18 import com.genimen.djeneric.tools.generator.core.nodes.ForNode; 19 import com.genimen.djeneric.tools.generator.core.nodes.IfNode; 20 import com.genimen.djeneric.tools.generator.core.nodes.IndentNode; 21 import com.genimen.djeneric.tools.generator.core.nodes.IntegerNode; 22 import com.genimen.djeneric.tools.generator.core.nodes.ModuleNode; 23 import com.genimen.djeneric.tools.generator.core.nodes.NullNode; 24 import com.genimen.djeneric.tools.generator.core.nodes.OperatorNode; 25 import com.genimen.djeneric.tools.generator.core.nodes.OrderByNode; 26 import com.genimen.djeneric.tools.generator.core.nodes.PropertyNode; 27 import com.genimen.djeneric.tools.generator.core.nodes.PropertyOrFunctionNode; 28 import com.genimen.djeneric.tools.generator.core.nodes.SetNode; 29 import com.genimen.djeneric.tools.generator.core.nodes.StringNode; 30 import com.genimen.djeneric.tools.generator.core.nodes.SubExpressionNode; 31 import com.genimen.djeneric.tools.generator.core.nodes.TemplateNode; 32 import com.genimen.djeneric.tools.generator.core.nodes.UnstructuredNode; 33 import com.genimen.djeneric.tools.generator.core.nodes.ValueExpression; 34 import com.genimen.djeneric.tools.generator.core.util.TreeNormalizer; 35 36 public class DjentelParserEngine 37 implements DjentelParserEngineTreeConstants, DjentelParserEngineConstants 38 { 39 protected JJTDjentelParserEngineState jjtree = new JJTDjentelParserEngineState(); 40 private String _result; 41 42 public DjentelParserEngine() 43 { 44 } 45 46 public static DjentelParserEngine parse(String src) throws UnsupportedEncodingException , ParseException 47 { 48 ByteArrayInputStream sr = new ByteArrayInputStream (src.getBytes("UTF8")); 49 DjentelParserEngine parser = new DjentelParserEngine(sr); 50 51 parser.parseTemplate(); 52 return parser; 53 } 54 55 public static TemplateNode getTree(String src) throws UnsupportedEncodingException , ParseException 56 { 57 return getTree(src, true); 58 } 59 60 public static TemplateNode getTree(String src, boolean normalize) throws UnsupportedEncodingException , ParseException 61 { 62 ByteArrayInputStream sr = new ByteArrayInputStream (src.getBytes("UTF8")); 63 DjentelParserEngine parser = new DjentelParserEngine(sr); 64 65 TemplateNode root = (TemplateNode) parser.buildTree(); 66 if (normalize) 67 { 68 TreeNormalizer norm = new TreeNormalizer(); 69 norm.normalize(root); 70 } 71 return root; 72 } 73 74 public static ValueExpression parseExpression(String src) throws UnsupportedEncodingException , ParseException 75 { 76 ByteArrayInputStream sr = new ByteArrayInputStream (src.getBytes("UTF8")); 77 DjentelParserEngine parser = new DjentelParserEngine(sr); 78 79 CalculatedExpressionNode tree = parser.buildCalculatedExpressionTree(); 80 TreeNormalizer norm = new TreeNormalizer(); 81 SimpleNode root = new SimpleNode(0); 82 root.addChild(tree); 83 norm.normalize(root); 84 return (ValueExpression) (root.getChild(0)); 85 } 86 87 public String getResult() 88 { 89 return _result; 90 } 91 92 public String getSpecialsToken(Token tok) 93 { 94 if (tok.specialToken == null) return ""; 95 96 StringBuffer sb = new StringBuffer (); 97 tok = tok.specialToken; 98 while (tok != null) 99 { 100 sb.append(tok.image); 101 tok = tok.specialToken; 102 } 103 return sb.reverse().toString(); 104 } 105 106 109 final public SimpleNode buildTree() throws ParseException 110 { 111 112 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTBUILDTREE); 113 boolean jjtc000 = true; 114 jjtree.openNodeScope(jjtn000); 115 try 116 { 117 parseTemplate(); 118 jjtree.closeNodeScope(jjtn000, true); 119 jjtc000 = false; 120 { 121 if (true) return jjtn000; 122 } 123 } 124 catch (Throwable jjte000) 125 { 126 if (jjtc000) 127 { 128 jjtree.clearNodeScope(jjtn000); 129 jjtc000 = false; 130 } 131 else 132 { 133 jjtree.popNode(); 134 } 135 if (jjte000 instanceof RuntimeException ) 136 { 137 { 138 if (true) throw (RuntimeException ) jjte000; 139 } 140 } 141 if (jjte000 instanceof ParseException) 142 { 143 { 144 if (true) throw (ParseException) jjte000; 145 } 146 } 147 { 148 if (true) throw (Error ) jjte000; 149 } 150 } 151 finally 152 { 153 if (jjtc000) 154 { 155 jjtree.closeNodeScope(jjtn000, true); 156 } 157 } 158 throw new Error ("Missing return statement in function"); 159 } 160 161 final public CalculatedExpressionNode buildCalculatedExpressionTree() throws ParseException 162 { 163 CalculatedExpressionNode node; 164 node = CalculatedExpression(); 165 jj_consume_token(0); 166 { 167 if (true) return node; 168 } 169 throw new Error ("Missing return statement in function"); 170 } 171 172 final public void parseTemplate() throws ParseException 173 { 174 ModuleDefinition(); 175 Body(); 176 jj_consume_token(0); 177 } 178 179 final public void ModuleDefinition() throws ParseException 180 { 181 182 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTMODULEDEFINITION); 183 boolean jjtc000 = true; 184 jjtree.openNodeScope(jjtn000); 185 Token token; 186 ModuleNode modNode = (ModuleNode) jjtn000; 187 try 188 { 189 token = jj_consume_token(MODULE); 190 modNode.setLineInfo(token); 191 token = jj_consume_token(IDENTIFIER); 192 modNode.setModuleName(token.image); 193 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 194 { 195 case ABSTRACTS : 196 jj_consume_token(ABSTRACTS); 197 jj_consume_token(OVER); 198 token = jj_consume_token(IDENTIFIER); 199 modNode.setObjectType(token.image); 200 token = jj_consume_token(IDENTIFIER); 201 modNode.setObjectName(token.image); 202 break; 203 default : 204 jj_la1[0] = jj_gen; 205 ; 206 } 207 jj_consume_token(FILENAME); 208 CalculatedExpression(); 209 jj_consume_token(SEMICOLON); 210 } 211 catch (Throwable jjte000) 212 { 213 if (jjtc000) 214 { 215 jjtree.clearNodeScope(jjtn000); 216 jjtc000 = false; 217 } 218 else 219 { 220 jjtree.popNode(); 221 } 222 if (jjte000 instanceof RuntimeException ) 223 { 224 { 225 if (true) throw (RuntimeException ) jjte000; 226 } 227 } 228 if (jjte000 instanceof ParseException) 229 { 230 { 231 if (true) throw (ParseException) jjte000; 232 } 233 } 234 { 235 if (true) throw (Error ) jjte000; 236 } 237 } 238 finally 239 { 240 if (jjtc000) 241 { 242 jjtree.closeNodeScope(jjtn000, true); 243 } 244 } 245 } 246 247 final public BodyNode Body() throws ParseException 248 { 249 250 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTBODY); 251 boolean jjtc000 = true; 252 jjtree.openNodeScope(jjtn000); 253 UnstructuredNode un; 254 BodyNode bodyNode = (BodyNode) jjtn000; 255 try 256 { 257 un = FetchUnstructured(); 258 bodyNode.setLineInfo(un); 259 label_1 : while (true) 260 { 261 if (jj_2_1(2)) 262 { 263 ; 264 } 265 else 266 { 267 break label_1; 268 } 269 Statement(); 270 FetchUnstructured(); 271 } 272 jjtree.closeNodeScope(jjtn000, true); 273 jjtc000 = false; 274 { 275 if (true) return bodyNode; 276 } 277 } 278 catch (Throwable jjte000) 279 { 280 if (jjtc000) 281 { 282 jjtree.clearNodeScope(jjtn000); 283 jjtc000 = false; 284 } 285 else 286 { 287 jjtree.popNode(); 288 } 289 if (jjte000 instanceof RuntimeException ) 290 { 291 { 292 if (true) throw (RuntimeException ) jjte000; 293 } 294 } 295 if (jjte000 instanceof ParseException) 296 { 297 { 298 if (true) throw (ParseException) jjte000; 299 } 300 } 301 { 302 if (true) throw (Error ) jjte000; 303 } 304 } 305 finally 306 { 307 if (jjtc000) 308 { 309 jjtree.closeNodeScope(jjtn000, true); 310 } 311 } 312 throw new Error ("Missing return statement in function"); 313 } 314 315 final public void Statement() throws ParseException 316 { 317 jj_consume_token(STARTCONSTRUCT); 318 if (jj_2_2(2)) 319 { 320 ConstStatement(); 321 } 322 else 323 { 324 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 325 { 326 case SET : 327 SetStatement(); 328 break; 329 case COMMENT : 330 CommentStatement(); 331 break; 332 case FOR : 333 ForStatement(); 334 break; 335 case IF : 336 IfStatement(); 337 break; 338 case ELSE : 339 ElseStatement(); 340 break; 341 default : 342 jj_la1[1] = jj_gen; 343 jj_consume_token(-1); 344 throw new ParseException(); 345 } 346 } 347 jj_consume_token(ENDCONSTRUCT); 348 } 349 350 final public void ConstStatement() throws ParseException 351 { 352 jj_consume_token(CONST); 353 label_2 : while (true) 354 { 355 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 356 { 357 case IDENTIFIER : 358 ; 359 break; 360 default : 361 jj_la1[2] = jj_gen; 362 break label_2; 363 } 364 Const(); 365 } 366 } 367 368 final public void CommentStatement() throws ParseException 369 { 370 371 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTCOMMENTSTATEMENT); 372 boolean jjtc000 = true; 373 jjtree.openNodeScope(jjtn000); 374 Token token; 375 CommentNode commentNode = (CommentNode) jjtn000; 376 try 377 { 378 token = jj_consume_token(COMMENT); 379 commentNode.setLineInfo(token); 380 SkipUnstructured(); 381 } 382 finally 383 { 384 if (jjtc000) 385 { 386 jjtree.closeNodeScope(jjtn000, true); 387 } 388 } 389 } 390 391 final public void Const() throws ParseException 392 { 393 394 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTCONST); 395 boolean jjtc000 = true; 396 jjtree.openNodeScope(jjtn000); 397 Token token; 398 ConstNode constNode = (ConstNode) jjtn000; 399 try 400 { 401 token = jj_consume_token(IDENTIFIER); 402 constNode.setLineInfo(token); 403 constNode.setKey(token.image); 404 jj_consume_token(ASSIGN); 405 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 406 { 407 case INTEGER_LITERAL : 408 token = jj_consume_token(INTEGER_LITERAL); 409 constNode.setInteger(new Integer (token.image)); 410 break; 411 case FLOATING_POINT_LITERAL : 412 token = jj_consume_token(FLOATING_POINT_LITERAL); 413 constNode.setFloat(new Float (token.image)); 414 break; 415 case CHARACTER_LITERAL : 416 token = jj_consume_token(CHARACTER_LITERAL); 417 constNode.setChar(token.image); 418 break; 419 case STRING_LITERAL : 420 token = jj_consume_token(STRING_LITERAL); 421 constNode.setString(token.image); 422 break; 423 case TRUE : 424 token = jj_consume_token(TRUE); 425 constNode.setBoolean(new Boolean (true)); 426 break; 427 case FALSE : 428 token = jj_consume_token(FALSE); 429 constNode.setBoolean(new Boolean (false)); 430 break; 431 default : 432 jj_la1[3] = jj_gen; 433 jj_consume_token(-1); 434 throw new ParseException(); 435 } 436 jj_consume_token(SEMICOLON); 437 } 438 finally 439 { 440 if (jjtc000) 441 { 442 jjtree.closeNodeScope(jjtn000, true); 443 } 444 } 445 } 446 447 final public void SetStatement() throws ParseException 448 { 449 450 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTSETSTATEMENT); 451 boolean jjtc000 = true; 452 jjtree.openNodeScope(jjtn000); 453 Token token; 454 SetNode setNode = (SetNode) jjtn000; 455 try 456 { 457 token = jj_consume_token(SET); 458 setNode.setLineInfo(token); 459 token = jj_consume_token(IDENTIFIER); 460 setNode.setSetName(token.image); 461 jj_consume_token(ASSIGN); 462 CalculatedExpression(); 463 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 464 { 465 case FILTER : 466 Filter(); 467 break; 468 default : 469 jj_la1[4] = jj_gen; 470 ; 471 } 472 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 473 { 474 case ORDER : 475 OrderBy(); 476 break; 477 default : 478 jj_la1[5] = jj_gen; 479 ; 480 } 481 } 482 catch (Throwable jjte000) 483 { 484 if (jjtc000) 485 { 486 jjtree.clearNodeScope(jjtn000); 487 jjtc000 = false; 488 } 489 else 490 { 491 jjtree.popNode(); 492 } 493 if (jjte000 instanceof RuntimeException ) 494 { 495 { 496 if (true) throw (RuntimeException ) jjte000; 497 } 498 } 499 if (jjte000 instanceof ParseException) 500 { 501 { 502 if (true) throw (ParseException) jjte000; 503 } 504 } 505 { 506 if (true) throw (Error ) jjte000; 507 } 508 } 509 finally 510 { 511 if (jjtc000) 512 { 513 jjtree.closeNodeScope(jjtn000, true); 514 } 515 } 516 } 517 518 final public void ForStatement() throws ParseException 519 { 520 521 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTFORSTATEMENT); 522 boolean jjtc000 = true; 523 jjtree.openNodeScope(jjtn000); 524 Token token, mod = null, sep2 = null; 525 ForNode forNode = (ForNode) jjtn000; 526 try 527 { 528 token = jj_consume_token(FOR); 529 forNode.setLineInfo(token); 530 jj_consume_token(LPAREN); 531 token = jj_consume_token(IDENTIFIER); 532 forNode.setLoopVariable(token.image); 533 jj_consume_token(IN); 534 CalculatedExpression(); 535 label_3 : while (true) 536 { 537 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 538 { 539 case SEPARATOR : 540 case FILTER : 541 case ORDER : 542 case INDENT : 543 ; 544 break; 545 default : 546 jj_la1[6] = jj_gen; 547 break label_3; 548 } 549 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 550 { 551 case FILTER : 552 Filter(); 553 break; 554 case ORDER : 555 OrderBy(); 556 break; 557 case INDENT : 558 Indent(); 559 break; 560 case SEPARATOR : 561 jj_consume_token(SEPARATOR); 562 jj_consume_token(ASSIGN); 563 token = jj_consume_token(STRING_LITERAL); 564 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 565 { 566 case COMMA : 567 jj_consume_token(COMMA); 568 mod = jj_consume_token(INTEGER_LITERAL); 569 jj_consume_token(COMMA); 570 sep2 = jj_consume_token(STRING_LITERAL); 571 break; 572 default : 573 jj_la1[7] = jj_gen; 574 ; 575 } 576 forNode.setSeparator(token.image); 577 if (mod != null) forNode.setModulo(new Integer (mod.image).intValue()); 578 if (sep2 != null) forNode.setModuloSeparator(sep2.image); 579 break; 580 default : 581 jj_la1[8] = jj_gen; 582 jj_consume_token(-1); 583 throw new ParseException(); 584 } 585 } 586 jj_consume_token(RPAREN); 587 Body(); 588 } 589 catch (Throwable jjte000) 590 { 591 if (jjtc000) 592 { 593 jjtree.clearNodeScope(jjtn000); 594 jjtc000 = false; 595 } 596 else 597 { 598 jjtree.popNode(); 599 } 600 if (jjte000 instanceof RuntimeException ) 601 { 602 { 603 if (true) throw (RuntimeException ) jjte000; 604 } 605 } 606 if (jjte000 instanceof ParseException) 607 { 608 { 609 if (true) throw (ParseException) jjte000; 610 } 611 } 612 { 613 if (true) throw (Error ) jjte000; 614 } 615 } 616 finally 617 { 618 if (jjtc000) 619 { 620 jjtree.closeNodeScope(jjtn000, true); 621 } 622 } 623 } 624 625 final public void Filter() throws ParseException 626 { 627 628 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTFILTER); 629 boolean jjtc000 = true; 630 jjtree.openNodeScope(jjtn000); 631 try 632 { 633 jj_consume_token(FILTER); 634 Expression(); 635 } 636 catch (Throwable jjte000) 637 { 638 if (jjtc000) 639 { 640 jjtree.clearNodeScope(jjtn000); 641 jjtc000 = false; 642 } 643 else 644 { 645 jjtree.popNode(); 646 } 647 if (jjte000 instanceof RuntimeException ) 648 { 649 { 650 if (true) throw (RuntimeException ) jjte000; 651 } 652 } 653 if (jjte000 instanceof ParseException) 654 { 655 { 656 if (true) throw (ParseException) jjte000; 657 } 658 } 659 { 660 if (true) throw (Error ) jjte000; 661 } 662 } 663 finally 664 { 665 if (jjtc000) 666 { 667 jjtree.closeNodeScope(jjtn000, true); 668 } 669 } 670 } 671 672 final public void OrderBy() throws ParseException 673 { 674 675 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTORDERBY); 676 boolean jjtc000 = true; 677 jjtree.openNodeScope(jjtn000); 678 Token tok; 679 ArrayList lst = new ArrayList (); 680 OrderByNode orderNode = (OrderByNode) jjtn000; 681 try 682 { 683 tok = jj_consume_token(ORDER); 684 orderNode.setLineInfo(tok); 685 jj_consume_token(BY); 686 tok = jj_consume_token(IDENTIFIER); 687 lst.add(tok.image.toString()); 688 label_4 : while (true) 689 { 690 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 691 { 692 case COMMA : 693 ; 694 break; 695 default : 696 jj_la1[9] = jj_gen; 697 break label_4; 698 } 699 jj_consume_token(COMMA); 700 tok = jj_consume_token(IDENTIFIER); 701 lst.add(tok.image.toString()); 702 } 703 jjtree.closeNodeScope(jjtn000, true); 704 jjtc000 = false; 705 orderNode.setProperties((String []) lst.toArray(new String [0])); 706 } 707 finally 708 { 709 if (jjtc000) 710 { 711 jjtree.closeNodeScope(jjtn000, true); 712 } 713 } 714 } 715 716 final public void Indent() throws ParseException 717 { 718 719 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTINDENT); 720 boolean jjtc000 = true; 721 jjtree.openNodeScope(jjtn000); 722 IndentNode indentNode = (IndentNode) jjtn000; 723 try 724 { 725 jj_consume_token(INDENT); 726 indentNode.setLineInfo(token); 727 jj_consume_token(ASSIGN); 728 CalculatedExpression(); 729 } 730 catch (Throwable jjte000) 731 { 732 if (jjtc000) 733 { 734 jjtree.clearNodeScope(jjtn000); 735 jjtc000 = false; 736 } 737 else 738 { 739 jjtree.popNode(); 740 } 741 if (jjte000 instanceof RuntimeException ) 742 { 743 { 744 if (true) throw (RuntimeException ) jjte000; 745 } 746 } 747 if (jjte000 instanceof ParseException) 748 { 749 { 750 if (true) throw (ParseException) jjte000; 751 } 752 } 753 { 754 if (true) throw (Error ) jjte000; 755 } 756 } 757 finally 758 { 759 if (jjtc000) 760 { 761 jjtree.closeNodeScope(jjtn000, true); 762 } 763 } 764 } 765 766 final public void IfStatement() throws ParseException 767 { 768 769 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTIFSTATEMENT); 770 boolean jjtc000 = true; 771 jjtree.openNodeScope(jjtn000); 772 Token token; 773 IfNode ifNode = (IfNode) jjtn000; 774 try 775 { 776 token = jj_consume_token(IF); 777 ifNode.setLineInfo(token); 778 jj_consume_token(LPAREN); 779 Expression(); 780 jj_consume_token(RPAREN); 781 Body(); 782 } 783 catch (Throwable jjte000) 784 { 785 if (jjtc000) 786 { 787 jjtree.clearNodeScope(jjtn000); 788 jjtc000 = false; 789 } 790 else 791 { 792 jjtree.popNode(); 793 } 794 if (jjte000 instanceof RuntimeException ) 795 { 796 { 797 if (true) throw (RuntimeException ) jjte000; 798 } 799 } 800 if (jjte000 instanceof ParseException) 801 { 802 { 803 if (true) throw (ParseException) jjte000; 804 } 805 } 806 { 807 if (true) throw (Error ) jjte000; 808 } 809 } 810 finally 811 { 812 if (jjtc000) 813 { 814 jjtree.closeNodeScope(jjtn000, true); 815 } 816 } 817 } 818 819 final public void ElseStatement() throws ParseException 820 { 821 822 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTELSESTATEMENT); 823 boolean jjtc000 = true; 824 jjtree.openNodeScope(jjtn000); 825 Token token; 826 ElseNode elseNode = (ElseNode) jjtn000; 827 try 828 { 829 token = jj_consume_token(ELSE); 830 elseNode.setLineInfo(token); 831 Body(); 832 } 833 catch (Throwable jjte000) 834 { 835 if (jjtc000) 836 { 837 jjtree.clearNodeScope(jjtn000); 838 jjtc000 = false; 839 } 840 else 841 { 842 jjtree.popNode(); 843 } 844 if (jjte000 instanceof RuntimeException ) 845 { 846 { 847 if (true) throw (RuntimeException ) jjte000; 848 } 849 } 850 if (jjte000 instanceof ParseException) 851 { 852 { 853 if (true) throw (ParseException) jjte000; 854 } 855 } 856 { 857 if (true) throw (Error ) jjte000; 858 } 859 } 860 finally 861 { 862 if (jjtc000) 863 { 864 jjtree.closeNodeScope(jjtn000, true); 865 } 866 } 867 } 868 869 final public PropertyNode Objectpath() throws ParseException 870 { 871 872 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTOBJECTPATH); 873 boolean jjtc000 = true; 874 jjtree.openNodeScope(jjtn000); 875 Token token; 876 Token not = null; 877 PropertyNode pathNode = (PropertyNode) jjtn000; 878 String rs; 879 try 880 { 881 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 882 { 883 case BANG : 884 not = jj_consume_token(BANG); 885 break; 886 default : 887 jj_la1[10] = jj_gen; 888 ; 889 } 890 token = jj_consume_token(IDENTIFIER); 891 pathNode.setLineInfo(token); 892 rs = token.image; 893 label_5 : while (true) 894 { 895 if (jj_2_3(2)) 896 { 897 ; 898 } 899 else 900 { 901 break label_5; 902 } 903 jj_consume_token(DOT); 904 token = jj_consume_token(IDENTIFIER); 905 rs += "." + token.image; 906 } 907 jjtree.closeNodeScope(jjtn000, true); 908 jjtc000 = false; 909 pathNode.setPath(rs); 910 if (not != null) pathNode.setNegated(true); 911 { 912 if (true) return pathNode; 913 } 914 } 915 finally 916 { 917 if (jjtc000) 918 { 919 jjtree.closeNodeScope(jjtn000, true); 920 } 921 } 922 throw new Error ("Missing return statement in function"); 923 } 924 925 final public ExpressionNode Expression() throws ParseException 926 { 927 928 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTEXPRESSION); 929 boolean jjtc000 = true; 930 jjtree.openNodeScope(jjtn000); 931 ExpressionNode expressionNode = (ExpressionNode) jjtn000; 932 SubExpressionNode subExpressionNode; 933 try 934 { 935 subExpressionNode = SubExpression(); 936 expressionNode.setLineInfo(subExpressionNode); 937 label_6 : while (true) 938 { 939 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 940 { 941 case SC_OR : 942 case SC_AND : 943 ; 944 break; 945 default : 946 jj_la1[11] = jj_gen; 947 break label_6; 948 } 949 AndOr(); 950 SubExpression(); 951 } 952 jjtree.closeNodeScope(jjtn000, true); 953 jjtc000 = false; 954 { 955 if (true) return expressionNode; 956 } 957 } 958 catch (Throwable jjte000) 959 { 960 if (jjtc000) 961 { 962 jjtree.clearNodeScope(jjtn000); 963 jjtc000 = false; 964 } 965 else 966 { 967 jjtree.popNode(); 968 } 969 if (jjte000 instanceof RuntimeException ) 970 { 971 { 972 if (true) throw (RuntimeException ) jjte000; 973 } 974 } 975 if (jjte000 instanceof ParseException) 976 { 977 { 978 if (true) throw (ParseException) jjte000; 979 } 980 } 981 { 982 if (true) throw (Error ) jjte000; 983 } 984 } 985 finally 986 { 987 if (jjtc000) 988 { 989 jjtree.closeNodeScope(jjtn000, true); 990 } 991 } 992 throw new Error ("Missing return statement in function"); 993 } 994 995 final public AndOrNode AndOr() throws ParseException 996 { 997 998 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTANDOR); 999 boolean jjtc000 = true; 1000 jjtree.openNodeScope(jjtn000); 1001 Token token; 1002 AndOrNode node = (AndOrNode) jjtn000; 1003 try 1004 { 1005 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 1006 { 1007 case SC_OR : 1008 token = jj_consume_token(SC_OR); 1009 break; 1010 case SC_AND : 1011 token = jj_consume_token(SC_AND); 1012 break; 1013 default : 1014 jj_la1[12] = jj_gen; 1015 jj_consume_token(-1); 1016 throw new ParseException(); 1017 } 1018 jjtree.closeNodeScope(jjtn000, true); 1019 jjtc000 = false; 1020 node.setOperator(token.image.toString()); 1021 { 1022 if (true) return node; 1023 } 1024 } 1025 finally 1026 { 1027 if (jjtc000) 1028 { 1029 jjtree.closeNodeScope(jjtn000, true); 1030 } 1031 } 1032 throw new Error ("Missing return statement in function"); 1033 } 1034 1035 final public SubExpressionNode SubExpression() throws ParseException 1036 { 1037 1038 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTSUBEXPRESSION); 1039 boolean jjtc000 = true; 1040 jjtree.openNodeScope(jjtn000); 1041 Token token = null; 1042 SubExpressionNode subExpressionNode = (SubExpressionNode) jjtn000; 1043 CalculatedExpressionNode calcNode; 1044 try 1045 { 1046 calcNode = CalculatedExpression(); 1047 subExpressionNode.setLineInfo(calcNode); 1048 label_7 : while (true) 1049 { 1050 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 1051 { 1052 case INSTANCEOF : 1053 case GT : 1054 case LT : 1055 case EQ : 1056 case LE : 1057 case GE : 1058 case NE : 1059 ; 1060 break; 1061 default : 1062 jj_la1[13] = jj_gen; 1063 break label_7; 1064 } 1065 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 1066 { 1067 case EQ : 1068 token = jj_consume_token(EQ); 1069 break; 1070 case NE : 1071 token = jj_consume_token(NE); 1072 break; 1073 case LT : 1074 token = jj_consume_token(LT); 1075 break; 1076 case INSTANCEOF : 1077 token = jj_consume_token(INSTANCEOF); 1078 break; 1079 case GT : 1080 token = jj_consume_token(GT); 1081 break; 1082 case LE : 1083 token = jj_consume_token(LE); 1084 break; 1085 case GE : 1086 token = jj_consume_token(GE); 1087 break; 1088 default : 1089 jj_la1[14] = jj_gen; 1090 jj_consume_token(-1); 1091 throw new ParseException(); 1092 } 1093 CalculatedExpression(); 1094 } 1095 jjtree.closeNodeScope(jjtn000, true); 1096 jjtc000 = false; 1097 if (token != null) subExpressionNode.setOperator(token.image); 1098 { 1099 if (true) return subExpressionNode; 1100 } 1101 } 1102 catch (Throwable jjte000) 1103 { 1104 if (jjtc000) 1105 { 1106 jjtree.clearNodeScope(jjtn000); 1107 jjtc000 = false; 1108 } 1109 else 1110 { 1111 jjtree.popNode(); 1112 } 1113 if (jjte000 instanceof RuntimeException ) 1114 { 1115 { 1116 if (true) throw (RuntimeException ) jjte000; 1117 } 1118 } 1119 if (jjte000 instanceof ParseException) 1120 { 1121 { 1122 if (true) throw (ParseException) jjte000; 1123 } 1124 } 1125 { 1126 if (true) throw (Error ) jjte000; 1127 } 1128 } 1129 finally 1130 { 1131 if (jjtc000) 1132 { 1133 jjtree.closeNodeScope(jjtn000, true); 1134 } 1135 } 1136 throw new Error ("Missing return statement in function"); 1137 } 1138 1139 final public CalculatedExpressionNode CalculatedExpression() throws ParseException 1140 { 1141 1142 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTCALCULATEDEXPRESSION); 1143 boolean jjtc000 = true; 1144 jjtree.openNodeScope(jjtn000); 1145 CalculatedExpressionNode expressionNode = (CalculatedExpressionNode) jjtn000; 1146 SimpleNode primNode; 1147 try 1148 { 1149 primNode = PrimaryExpression(); 1150 expressionNode.setLineInfo(primNode); 1151 label_8 : while (true) 1152 { 1153 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 1154 { 1155 case DOT : 1156 case PLUS : 1157 case MINUS : 1158 case STAR : 1159 case SLASH : 1160 case REM : 1161 ; 1162 break; 1163 default : 1164 jj_la1[15] = jj_gen; 1165 break label_8; 1166 } 1167 Operator(); 1168 PrimaryExpression(); 1169 } 1170 jjtree.closeNodeScope(jjtn000, true); 1171 jjtc000 = false; 1172 { 1173 if (true) return expressionNode; 1174 } 1175 } 1176 catch (Throwable jjte000) 1177 { 1178 if (jjtc000) 1179 { 1180 jjtree.clearNodeScope(jjtn000); 1181 jjtc000 = false; 1182 } 1183 else 1184 { 1185 jjtree.popNode(); 1186 } 1187 if (jjte000 instanceof RuntimeException ) 1188 { 1189 { 1190 if (true) throw (RuntimeException ) jjte000; 1191 } 1192 } 1193 if (jjte000 instanceof ParseException) 1194 { 1195 { 1196 if (true) throw (ParseException) jjte000; 1197 } 1198 } 1199 { 1200 if (true) throw (Error ) jjte000; 1201 } 1202 } 1203 finally 1204 { 1205 if (jjtc000) 1206 { 1207 jjtree.closeNodeScope(jjtn000, true); 1208 } 1209 } 1210 throw new Error ("Missing return statement in function"); 1211 } 1212 1213 final public void Operator() throws ParseException 1214 { 1215 1216 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTOPERATOR); 1217 boolean jjtc000 = true; 1218 jjtree.openNodeScope(jjtn000); 1219 OperatorNode opNode = (OperatorNode) jjtn000; 1220 try 1221 { 1222 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 1223 { 1224 case PLUS : 1225 jj_consume_token(PLUS); 1226 opNode.setOperator("+"); 1227 break; 1228 case MINUS : 1229 jj_consume_token(MINUS); 1230 opNode.setOperator("-"); 1231 break; 1232 case STAR : 1233 jj_consume_token(STAR); 1234 opNode.setOperator("*"); 1235 break; 1236 case SLASH : 1237 jj_consume_token(SLASH); 1238 opNode.setOperator("/"); 1239 break; 1240 case REM : 1241 jj_consume_token(REM); 1242 opNode.setOperator("%"); 1243 break; 1244 case DOT : 1245 jj_consume_token(DOT); 1246 opNode.setOperator("."); 1247 break; 1248 default : 1249 jj_la1[16] = jj_gen; 1250 jj_consume_token(-1); 1251 throw new ParseException(); 1252 } 1253 jjtree.closeNodeScope(jjtn000, true); 1254 jjtc000 = false; 1255 opNode.setLineInfo(token); 1256 } 1257 finally 1258 { 1259 if (jjtc000) 1260 { 1261 jjtree.closeNodeScope(jjtn000, true); 1262 } 1263 } 1264 } 1265 1266 final public SimpleNode PrimaryExpression() throws ParseException 1267 { 1268 SimpleNode subNode; 1269 if (jj_2_5(2)) 1270 { 1271 subNode = boolLiteral(); 1272 } 1273 else 1274 { 1275 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 1276 { 1277 case IDENTIFIER : 1278 case BANG : 1279 subNode = PropertyOrFunction(); 1280 break; 1281 default : 1282 jj_la1[17] = jj_gen; 1283 if (jj_2_6(2)) 1284 { 1285 subNode = integerLiteral(); 1286 } 1287 else 1288 { 1289 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 1290 { 1291 case FLOATING_POINT_LITERAL : 1292 case MINUS : 1293 subNode = floatLiteral(); 1294 break; 1295 case CHARACTER_LITERAL : 1296 subNode = charLiteral(); 1297 break; 1298 case STRING_LITERAL : 1299 subNode = stringLiteral(); 1300 break; 1301 case NULL : 1302 subNode = nullLiteral(); 1303 break; 1304 case LPAREN : 1305 jj_consume_token(LPAREN); 1306 subNode = Expression(); 1307 jj_consume_token(RPAREN); 1308 label_9 : while (true) 1309 { 1310 if (jj_2_4(2)) 1311 { 1312 ; 1313 } 1314 else 1315 { 1316 break label_9; 1317 } 1318 Arguments(); 1319 } 1320 break; 1321 default : 1322 jj_la1[18] = jj_gen; 1323 jj_consume_token(-1); 1324 throw new ParseException(); 1325 } 1326 } 1327 } 1328 } 1329 { 1330 if (true) return subNode; 1331 } 1332 throw new Error ("Missing return statement in function"); 1333 } 1334 1335 final public PropertyOrFunctionNode PropertyOrFunction() throws ParseException 1336 { 1337 1338 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTPROPERTYORFUNCTION); 1339 boolean jjtc000 = true; 1340 jjtree.openNodeScope(jjtn000); 1341 PropertyOrFunctionNode pfnode = (PropertyOrFunctionNode) jjtn000; 1342 SimpleNode path; 1343 try 1344 { 1345 path = Objectpath(); 1346 pfnode.setLineInfo(path); 1347 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 1348 { 1349 case LPAREN : 1350 jj_consume_token(LPAREN); 1351 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 1352 { 1353 case INTEGER_LITERAL : 1354 case FLOATING_POINT_LITERAL : 1355 case CHARACTER_LITERAL : 1356 case STRING_LITERAL : 1357 case TRUE : 1358 case FALSE : 1359 case NULL : 1360 case IDENTIFIER : 1361 case LPAREN : 1362 case BANG : 1363 case MINUS : 1364 Expression(); 1365 label_10 : while (true) 1366 { 1367 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 1368 { 1369 case COMMA : 1370 ; 1371 break; 1372 default : 1373 jj_la1[19] = jj_gen; 1374 break label_10; 1375 } 1376 jj_consume_token(COMMA); 1377 Expression(); 1378 } 1379 break; 1380 default : 1381 jj_la1[20] = jj_gen; 1382 ; 1383 } 1384 jj_consume_token(RPAREN); 1385 pfnode.setFunction(true); 1386 break; 1387 default : 1388 jj_la1[21] = jj_gen; 1389 ; 1390 } 1391 jjtree.closeNodeScope(jjtn000, true); 1392 jjtc000 = false; 1393 { 1394 if (true) return pfnode; 1395 } 1396 } 1397 catch (Throwable jjte000) 1398 { 1399 if (jjtc000) 1400 { 1401 jjtree.clearNodeScope(jjtn000); 1402 jjtc000 = false; 1403 } 1404 else 1405 { 1406 jjtree.popNode(); 1407 } 1408 if (jjte000 instanceof RuntimeException ) 1409 { 1410 { 1411 if (true) throw (RuntimeException ) jjte000; 1412 } 1413 } 1414 if (jjte000 instanceof ParseException) 1415 { 1416 { 1417 if (true) throw (ParseException) jjte000; 1418 } 1419 } 1420 { 1421 if (true) throw (Error ) jjte000; 1422 } 1423 } 1424 finally 1425 { 1426 if (jjtc000) 1427 { 1428 jjtree.closeNodeScope(jjtn000, true); 1429 } 1430 } 1431 throw new Error ("Missing return statement in function"); 1432 } 1433 1434 final public IntegerNode integerLiteral() throws ParseException 1435 { 1436 1437 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTINTEGERLITERAL); 1438 boolean jjtc000 = true; 1439 jjtree.openNodeScope(jjtn000); 1440 Token token = null; 1441 Token sign = null; 1442 IntegerNode node = (IntegerNode) jjtn000; 1443 try 1444 { 1445 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 1446 { 1447 case MINUS : 1448 sign = jj_consume_token(MINUS); 1449 break; 1450 default : 1451 jj_la1[22] = jj_gen; 1452 ; 1453 } 1454 token = jj_consume_token(INTEGER_LITERAL); 1455 node.setLineInfo(token); 1456 try 1457 { 1458 int v = Integer.parseInt(token.image); 1459 if (sign != null) v = -v; 1460 node.setValue(v); 1461 } 1462 catch (Exception x) 1463 { x.printStackTrace(); 1465 } 1466 jjtree.closeNodeScope(jjtn000, true); 1467 jjtc000 = false; 1468 { 1469 if (true) return node; 1470 } 1471 } 1472 finally 1473 { 1474 if (jjtc000) 1475 { 1476 jjtree.closeNodeScope(jjtn000, true); 1477 } 1478 } 1479 throw new Error ("Missing return statement in function"); 1480 } 1481 1482 final public FloatNode floatLiteral() throws ParseException 1483 { 1484 1485 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTFLOATLITERAL); 1486 boolean jjtc000 = true; 1487 jjtree.openNodeScope(jjtn000); 1488 Token token = null; 1489 Token sign = null; 1490 FloatNode node = (FloatNode) jjtn000; 1491 try 1492 { 1493 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 1494 { 1495 case MINUS : 1496 sign = jj_consume_token(MINUS); 1497 break; 1498 default : 1499 jj_la1[23] = jj_gen; 1500 ; 1501 } 1502 token = jj_consume_token(FLOATING_POINT_LITERAL); 1503 node.setLineInfo(token); 1504 try 1505 { 1506 float v = Float.parseFloat(token.image); 1507 if (sign != null) v = -v; 1508 node.setValue(v); 1509 } 1510 catch (Exception x) 1511 { x.printStackTrace(); 1513 } 1514 jjtree.closeNodeScope(jjtn000, true); 1515 jjtc000 = false; 1516 { 1517 if (true) return node; 1518 } 1519 } 1520 finally 1521 { 1522 if (jjtc000) 1523 { 1524 jjtree.closeNodeScope(jjtn000, true); 1525 } 1526 } 1527 throw new Error ("Missing return statement in function"); 1528 } 1529 1530 final public CharNode charLiteral() throws ParseException 1531 { 1532 1533 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTCHARLITERAL); 1534 boolean jjtc000 = true; 1535 jjtree.openNodeScope(jjtn000); 1536 Token token = null; 1537 CharNode node = (CharNode) jjtn000; 1538 try 1539 { 1540 token = jj_consume_token(CHARACTER_LITERAL); 1541 node.setLineInfo(token); 1542 node.setValue(token.image.toString()); 1543 jjtree.closeNodeScope(jjtn000, true); 1544 jjtc000 = false; 1545 { 1546 if (true) return node; 1547 } 1548 } 1549 finally 1550 { 1551 if (jjtc000) 1552 { 1553 jjtree.closeNodeScope(jjtn000, true); 1554 } 1555 } 1556 throw new Error ("Missing return statement in function"); 1557 } 1558 1559 final public StringNode stringLiteral() throws ParseException 1560 { 1561 1562 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTSTRINGLITERAL); 1563 boolean jjtc000 = true; 1564 jjtree.openNodeScope(jjtn000); 1565 Token token = null; 1566 StringNode node = (StringNode) jjtn000; 1567 try 1568 { 1569 token = jj_consume_token(STRING_LITERAL); 1570 node.setLineInfo(token); 1571 node.setValue(token.image.toString()); 1572 jjtree.closeNodeScope(jjtn000, true); 1573 jjtc000 = false; 1574 { 1575 if (true) return node; 1576 } 1577 } 1578 finally 1579 { 1580 if (jjtc000) 1581 { 1582 jjtree.closeNodeScope(jjtn000, true); 1583 } 1584 } 1585 throw new Error ("Missing return statement in function"); 1586 } 1587 1588 final public BoolNode boolLiteral() throws ParseException 1589 { 1590 1591 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTBOOLLITERAL); 1592 boolean jjtc000 = true; 1593 jjtree.openNodeScope(jjtn000); 1594 Token token = null; 1595 Token not = null; 1596 BoolNode node = (BoolNode) jjtn000; 1597 try 1598 { 1599 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 1600 { 1601 case BANG : 1602 not = jj_consume_token(BANG); 1603 break; 1604 default : 1605 jj_la1[24] = jj_gen; 1606 ; 1607 } 1608 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 1609 { 1610 case TRUE : 1611 token = jj_consume_token(TRUE); 1612 break; 1613 case FALSE : 1614 token = jj_consume_token(FALSE); 1615 break; 1616 default : 1617 jj_la1[25] = jj_gen; 1618 jj_consume_token(-1); 1619 throw new ParseException(); 1620 } 1621 jjtree.closeNodeScope(jjtn000, true); 1622 jjtc000 = false; 1623 node.setValue(token.image.equals("true")); 1624 if (not != null) node.setValue(!node.isTrue()); 1625 node.setLineInfo(token); 1626 { 1627 if (true) return node; 1628 } 1629 } 1630 finally 1631 { 1632 if (jjtc000) 1633 { 1634 jjtree.closeNodeScope(jjtn000, true); 1635 } 1636 } 1637 throw new Error ("Missing return statement in function"); 1638 } 1639 1640 final public NullNode nullLiteral() throws ParseException 1641 { 1642 1643 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTNULLLITERAL); 1644 boolean jjtc000 = true; 1645 jjtree.openNodeScope(jjtn000); 1646 Token token = null; 1647 NullNode node = (NullNode) jjtn000; 1648 try 1649 { 1650 token = jj_consume_token(NULL); 1651 jjtree.closeNodeScope(jjtn000, true); 1652 jjtc000 = false; 1653 node.setLineInfo(token); 1654 { 1655 if (true) return node; 1656 } 1657 } 1658 finally 1659 { 1660 if (jjtc000) 1661 { 1662 jjtree.closeNodeScope(jjtn000, true); 1663 } 1664 } 1665 throw new Error ("Missing return statement in function"); 1666 } 1667 1668 final public void Arguments() throws ParseException 1669 { 1670 1671 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTARGUMENTS); 1672 boolean jjtc000 = true; 1673 jjtree.openNodeScope(jjtn000); 1674 try 1675 { 1676 jj_consume_token(LPAREN); 1677 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 1678 { 1679 case INTEGER_LITERAL : 1680 case FLOATING_POINT_LITERAL : 1681 case CHARACTER_LITERAL : 1682 case STRING_LITERAL : 1683 case TRUE : 1684 case FALSE : 1685 case NULL : 1686 case IDENTIFIER : 1687 case LPAREN : 1688 case BANG : 1689 case MINUS : 1690 Expression(); 1691 label_11 : while (true) 1692 { 1693 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) 1694 { 1695 case COMMA : 1696 ; 1697 break; 1698 default : 1699 jj_la1[26] = jj_gen; 1700 break label_11; 1701 } 1702 jj_consume_token(COMMA); 1703 Expression(); 1704 } 1705 break; 1706 default : 1707 jj_la1[27] = jj_gen; 1708 ; 1709 } 1710 jj_consume_token(RPAREN); 1711 } 1712 catch (Throwable jjte000) 1713 { 1714 if (jjtc000) 1715 { 1716 jjtree.clearNodeScope(jjtn000); 1717 jjtc000 = false; 1718 } 1719 else 1720 { 1721 jjtree.popNode(); 1722 } 1723 if (jjte000 instanceof RuntimeException ) 1724 { 1725 { 1726 if (true) throw (RuntimeException ) jjte000; 1727 } 1728 } 1729 if (jjte000 instanceof ParseException) 1730 { 1731 { 1732 if (true) throw (ParseException) jjte000; 1733 } 1734 } 1735 { 1736 if (true) throw (Error ) jjte000; 1737 } 1738 } 1739 finally 1740 { 1741 if (jjtc000) 1742 { 1743 jjtree.closeNodeScope(jjtn000, true); 1744 } 1745 } 1746 } 1747 1748 UnstructuredNode FetchUnstructured() throws ParseException 1749 { 1750 1751 SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTFETCHUNSTRUCTURED); 1752 boolean jjtc000 = true; 1753 jjtree.openNodeScope(jjtn000); 1754 try 1755 { 1756 UnstructuredNode node = (UnstructuredNode) jjtn000; 1757 Token tok; 1758 StringBuffer result = new StringBuffer (); 1759 node.setLineInfo(getToken(1)); 1760 boolean first = true; 1761 while (true) 1762 { 1763 tok = getToken(1); 1764 if (tok.kind == EOF) 1765 { 1766 node.setData(result.toString()); 1767 return node; 1768 } 1769 String specials = getSpecialsToken(tok); 1770 if (first) 1771 { int idx = 0; 1774 while (idx < specials.length() && ("\t\r ".indexOf(specials.charAt(idx)) != -1)) 1775 idx++; 1776 if (idx < specials.length() && specials.charAt(idx) == '\n') 1777 { 1778 specials = specials.substring(idx + 1); 1779 } 1780 Token t = getToken(1); 1781 int line = t.beginLine; 1782 int col = t.beginColumn; 1783 for (int i = 0; i < specials.length(); i++) 1784 if (specials.charAt(i) == '\n') line--; 1785 int i = specials.length() - 1; 1786 while (i >= 0 && " \t".indexOf(specials.charAt(i)) != -1) 1787 { 1788 col--; 1789 i--; 1790 } 1791 node.setLineInfo(line, col); 1792 1793 } 1794 first = false; 1795 result.append(specials); 1796 if (tok.image.equals("[[") || tok.image.equals("]]")) 1797 { 1798 while ((result.length() > 0) && (" \t".indexOf(result.charAt(result.length() - 1)) != -1)) 1799 result.deleteCharAt(result.length() - 1); 1800 1801 node.setData(result.toString()); 1802 return node; 1803 } 1804 result.append(tok.image); 1805 tok = getNextToken(); 1806 } 1807 } 1808 finally 1809 { 1810 if (jjtc000) 1811 { 1812 jjtree.closeNodeScope(jjtn000, true); 1813 } 1814 } 1815 } 1816 1817 void SkipUnstructured() throws ParseException 1818 { 1819 Token tok; 1820 while (true) 1821 { 1822 tok = getToken(1); 1823 if (tok.kind == EOF) 1824 { 1825 return; 1826 } 1827 if (tok.image.equals("[[") || tok.image.equals("]]")) 1828 { 1829 return; 1830 } 1831 tok = getNextToken(); 1832 } 1833 } 1834 1835 final private boolean jj_2_1(int xla) 1836 { 1837 jj_la = xla; 1838 jj_lastpos = jj_scanpos = token; 1839 boolean retval = !jj_3_1(); 1840 jj_save(0, xla); 1841 return retval; 1842 } 1843 1844 final private boolean jj_2_2(int xla) 1845 { 1846 jj_la = xla; 1847 jj_lastpos = jj_scanpos = token; 1848 boolean retval = !jj_3_2(); 1849 jj_save(1, xla); 1850 return retval; 1851 } 1852 1853 final private boolean jj_2_3(int xla) 1854 { 1855 jj_la = xla; 1856 jj_lastpos = jj_scanpos = token; 1857 boolean retval = !jj_3_3(); 1858 jj_save(2, xla); 1859 return retval; 1860 } 1861 1862 final private boolean jj_2_4(int xla) 1863 { 1864 jj_la = xla; 1865 jj_lastpos = jj_scanpos = token; 1866 boolean retval = !jj_3_4(); 1867 jj_save(3, xla); 1868 return retval; 1869 } 1870 1871 final private boolean jj_2_5(int xla) 1872 { 1873 jj_la = xla; 1874 jj_lastpos = jj_scanpos = token; 1875 boolean retval = !jj_3_5(); 1876 jj_save(4, xla); 1877 return retval; 1878 } 1879 1880 final private boolean jj_2_6(int xla) 1881 { 1882 jj_la = xla; 1883 jj_lastpos = jj_scanpos = token; 1884 boolean retval = !jj_3_6(); 1885 jj_save(5, xla); 1886 return retval; 1887 } 1888 1889 final private boolean jj_3R_48() 1890 { 1891 if (jj_scan_token(NULL)) return true; 1892 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1893 return false; 1894 } 1895 1896 final private boolean jj_3_4() 1897 { 1898 if (jj_3R_14()) return true; 1899 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1900 return false; 1901 } 1902 1903 final private boolean jj_3_3() 1904 { 1905 if (jj_scan_token(DOT)) return true; 1906 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1907 if (jj_scan_token(IDENTIFIER)) return true; 1908 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1909 return false; 1910 } 1911 1912 final private boolean jj_3R_43() 1913 { 1914 if (jj_scan_token(LPAREN)) return true; 1915 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1916 return false; 1917 } 1918 1919 final private boolean jj_3R_42() 1920 { 1921 if (jj_3R_48()) return true; 1922 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1923 return false; 1924 } 1925 1926 final private boolean jj_3R_41() 1927 { 1928 if (jj_3R_47()) return true; 1929 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1930 return false; 1931 } 1932 1933 final private boolean jj_3R_40() 1934 { 1935 if (jj_3R_46()) return true; 1936 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1937 return false; 1938 } 1939 1940 final private boolean jj_3R_51() 1941 { 1942 if (jj_scan_token(BANG)) return true; 1943 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1944 return false; 1945 } 1946 1947 final private boolean jj_3R_49() 1948 { 1949 Token xsp; 1950 xsp = jj_scanpos; 1951 if (jj_3R_51()) jj_scanpos = xsp; 1952 else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1953 if (jj_scan_token(IDENTIFIER)) return true; 1954 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1955 return false; 1956 } 1957 1958 final private boolean jj_3R_39() 1959 { 1960 if (jj_3R_45()) return true; 1961 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1962 return false; 1963 } 1964 1965 final private boolean jj_3_6() 1966 { 1967 if (jj_3R_16()) return true; 1968 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1969 return false; 1970 } 1971 1972 final private boolean jj_3R_38() 1973 { 1974 if (jj_3R_44()) return true; 1975 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1976 return false; 1977 } 1978 1979 final private boolean jj_3_5() 1980 { 1981 if (jj_3R_15()) return true; 1982 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1983 return false; 1984 } 1985 1986 final private boolean jj_3R_24() 1987 { 1988 if (jj_scan_token(BANG)) return true; 1989 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1990 return false; 1991 } 1992 1993 final private boolean jj_3R_25() 1994 { 1995 if (jj_scan_token(TRUE)) return true; 1996 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1997 return false; 1998 } 1999 2000 final private boolean jj_3R_15() 2001 { 2002 Token xsp; 2003 xsp = jj_scanpos; 2004 if (jj_3R_24()) jj_scanpos = xsp; 2005 else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2006 xsp = jj_scanpos; 2007 if (jj_3R_25()) 2008 { 2009 jj_scanpos = xsp; 2010 if (jj_3R_26()) return true; 2011 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2012 } 2013 else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2014 return false; 2015 } 2016 2017 final private boolean jj_3R_33() 2018 { 2019 if (jj_scan_token(IDENTIFIER)) return true; 2020 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2021 return false; 2022 } 2023 2024 final private boolean jj_3R_37() 2025 { 2026 Token xsp; 2027 xsp = jj_scanpos; 2028 if (jj_3_5()) 2029 { 2030 jj_scanpos = xsp; 2031 if (jj_3R_38()) 2032 { 2033 jj_scanpos = xsp; 2034 if (jj_3_6()) 2035 { 2036 jj_scanpos = xsp; 2037 if (jj_3R_39()) 2038 { 2039 jj_scanpos = xsp; 2040 if (jj_3R_40()) 2041 { 2042 jj_scanpos = xsp; 2043 if (jj_3R_41()) 2044 { 2045 jj_scanpos = xsp; 2046 if (jj_3R_42()) 2047 { 2048 jj_scanpos = xsp; 2049 if (jj_3R_43()) return true; 2050 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2051 } 2052 else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2053 } 2054 else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2055 } 2056 else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2057 } 2058 else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2059 } 2060 else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2061 } 2062 else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2063 } 2064 else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2065 return false; 2066 } 2067 2068 final private boolean jj_3R_32() 2069 { 2070 if (jj_scan_token(ELSE)) return true; 2071 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2072 return false; 2073 } 2074 2075 final private boolean jj_3R_22() 2076 { 2077 if (jj_3R_33()) return true; 2078 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2079 return false; 2080 } 2081 2082 final private boolean jj_3R_29() 2083 { 2084 if (jj_scan_token(COMMENT)) return true; 2085 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2086 return false; 2087 } 2088 2089 final private boolean jj_3R_47() 2090 { 2091 if (jj_scan_token(STRING_LITERAL)) return true; 2092 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2093 return false; 2094 } 2095 2096 final private boolean jj_3R_31() 2097 { 2098 if (jj_scan_token(IF)) return true; 2099 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2100 return false; 2101 } 2102 2103 final private boolean jj_3R_13() 2104 { 2105 if (jj_scan_token(CONST)) return true; 2106 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2107 Token xsp; 2108 while (true) 2109 { 2110 xsp = jj_scanpos; 2111 if (jj_3R_22()) 2112 { 2113 jj_scanpos = xsp; 2114 break; 2115 } 2116 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2117 } 2118 return false; 2119 } 2120 2121 final private boolean jj_3R_21() 2122 { 2123 if (jj_3R_32()) return true; 2124 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2125 return false; 2126 } 2127 2128 final private boolean jj_3R_20() 2129 { 2130 if (jj_3R_31()) return true; 2131 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2132 return false; 2133 } 2134 2135 final private boolean jj_3R_46() 2136 { 2137 if (jj_scan_token(CHARACTER_LITERAL)) return true; 2138 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2139 return false; 2140 } 2141 2142 final private boolean jj_3R_19() 2143 { 2144 if (jj_3R_30()) return true; 2145 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2146 return false; 2147 } 2148 2149 final private boolean jj_3R_18() 2150 { 2151 if (jj_3R_29()) return true; 2152 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2153 return false; 2154 } 2155 2156 final private boolean jj_3R_17() 2157 { 2158 if (jj_3R_28()) return true; 2159 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2160 return false; 2161 } 2162 2163 final private boolean jj_3R_36() 2164 { 2165 if (jj_3R_37()) return true; 2166 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2167 return false; 2168 } 2169 2170 final private boolean jj_3_2() 2171 { 2172 if (jj_3R_13()) return true; 2173 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2174 return false; 2175 } 2176 2177 final private boolean jj_3R_12() 2178 { 2179 if (jj_scan_token(STARTCONSTRUCT)) return true; 2180 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2181 Token xsp; 2182 xsp = jj_scanpos; 2183 if (jj_3_2()) 2184 { 2185 jj_scanpos = xsp; 2186 if (jj_3R_17()) 2187 { 2188 jj_scanpos = xsp; 2189 if (jj_3R_18()) 2190 { 2191 jj_scanpos = xsp; 2192 if (jj_3R_19()) 2193 { 2194 jj_scanpos = xsp; 2195 if (jj_3R_20()) 2196 { 2197 jj_scanpos = xsp; 2198 if (jj_3R_21()) return true; 2199 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2200 } 2201 else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2202 } 2203 else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2204 } 2205 else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2206 } 2207 else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2208 } 2209 else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2210 return false; 2211 } 2212 2213 final private boolean jj_3R_50() 2214 { 2215 if (jj_scan_token(MINUS)) return true; 2216 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2217 return false; 2218 } 2219 2220 final private boolean jj_3R_45() 2221 { 2222 Token xsp; 2223 xsp = jj_scanpos; 2224 if (jj_3R_50()) jj_scanpos = xsp; 2225 else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2226 if (jj_scan_token(FLOATING_POINT_LITERAL)) return true; 2227 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2228 return false; 2229 } 2230 2231 final private boolean jj_3_1() 2232 { 2233 if (jj_3R_12()) return true; 2234 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2235 return false; 2236 } 2237 2238 final private boolean jj_3R_35() 2239 { 2240 if (jj_3R_36()) return true; 2241 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2242 return false; 2243 } 2244 2245 final private boolean jj_3R_16() 2246 { 2247 Token xsp; 2248 xsp = jj_scanpos; 2249 if (jj_3R_27()) jj_scanpos = xsp; 2250 else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2251 if (jj_scan_token(INTEGER_LITERAL)) return true; 2252 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2253 return false; 2254 } 2255 2256 final private boolean jj_3R_27() 2257 { 2258 if (jj_scan_token(MINUS)) return true; 2259 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2260 return false; 2261 } 2262 2263 final private boolean jj_3R_30() 2264 { 2265 if (jj_scan_token(FOR)) return true; 2266 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2267 return false; 2268 } 2269 2270 final private boolean jj_3R_23() 2271 { 2272 if (jj_3R_34()) return true; 2273 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2274 return false; 2275 } 2276 2277 final private boolean jj_3R_34() 2278 { 2279 if (jj_3R_35()) return true; 2280 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2281 return false; 2282 } 2283 2284 final private boolean jj_3R_14() 2285 { 2286 if (jj_scan_token(LPAREN)) return true; 2287 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2288 Token xsp; 2289 xsp = jj_scanpos; 2290 if (jj_3R_23()) jj_scanpos = xsp; 2291 else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2292 if (jj_scan_token(RPAREN)) return true; 2293 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2294 return false; 2295 } 2296 2297 final private boolean jj_3R_44() 2298 { 2299 if (jj_3R_49()) return true; 2300 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2301 return false; 2302 } 2303 2304 final private boolean jj_3R_28() 2305 { 2306 if (jj_scan_token(SET)) return true; 2307 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2308 return false; 2309 } 2310 2311 final private boolean jj_3R_26() 2312 { 2313 if (jj_scan_token(FALSE)) return true; 2314 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 2315 return false; 2316 } 2317 2318 public DjentelParserEngineTokenManager token_source; 2319 JavaCharStream jj_input_stream; 2320 public Token token, jj_nt; 2321 private int jj_ntk; 2322 private Token jj_scanpos, jj_lastpos; 2323 private int jj_la; 2324 public boolean lookingAhead = false; 2325 private boolean jj_semLA; 2326 private int jj_gen; 2327 final private int[] jj_la1 = new int[28]; 2328 static private int[] jj_la1_0; 2329 static private int[] jj_la1_1; 2330 static private int[] jj_la1_2; 2331 static 2332 { 2333 jj_la1_0(); 2334 jj_la1_1(); 2335 jj_la1_2(); 2336 } 2337 2338 private static void jj_la1_0() 2339 { 2340 jj_la1_0 = new int[]{0x8000, 0xa0940000, 0x0, 0x3440, 0x400000, 0x1000000, 0x9600000, 0x0, 0x9600000, 0x0, 0x0, 2341 0x0, 0x0, 0x40000000, 0x40000000, 0x0, 0x0, 0x0, 0x3400, 0x0, 0x3440, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3440,}; 2342 } 2343 2344 private static void jj_la1_1() 2345 { 2346 jj_la1_1 = new int[]{0x0, 0x0, 0x10, 0x5, 0x0, 0x0, 0x0, 0x4000, 0x0, 0x4000, 0x80000, 0x18000000, 0x18000000, 2347 0x7860000, 0x7860000, 0x80008000, 0x80008000, 0x80010, 0x88, 0x4000, 0x8009d, 0x80, 0x0, 0x0, 0x80000, 0x5, 2348 0x4000, 0x8009d,}; 2349 } 2350 2351 private static void jj_la1_2() 2352 { 2353 jj_la1_2 = new int[]{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x47, 0x47, 0x0, 2354 0x1, 0x0, 0x1, 0x0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x1,}; 2355 } 2356 2357 final private JJCalls[] jj_2_rtns = new JJCalls[6]; 2358 private boolean jj_rescan = false; 2359 private int jj_gc = 0; 2360 2361 public DjentelParserEngine(java.io.InputStream stream) 2362 { 2363 jj_input_stream = new JavaCharStream(stream, 1, 1); 2364 token_source = new DjentelParserEngineTokenManager(jj_input_stream); 2365 token = new Token(); 2366 jj_ntk = -1; 2367 jj_gen = 0; 2368 for (int i = 0; i < 28; i++) 2369 jj_la1[i] = -1; 2370 for (int i = 0; i < jj_2_rtns.length; i++) 2371 jj_2_rtns[i] = new JJCalls(); 2372 } 2373 2374 public void ReInit(java.io.InputStream stream) 2375 { 2376 jj_input_stream.ReInit(stream, 1, 1); 2377 token_source.ReInit(jj_input_stream); 2378 token = new Token(); 2379 jj_ntk = -1; 2380 jjtree.reset(); 2381 jj_gen = 0; 2382 for (int i = 0; i < 28; i++) 2383 jj_la1[i] = -1; 2384 for (int i = 0; i < jj_2_rtns.length; i++) 2385 jj_2_rtns[i] = new JJCalls(); 2386 } 2387 2388 public DjentelParserEngine(java.io.Reader stream) 2389 { 2390 jj_input_stream = new JavaCharStream(stream, 1, 1); 2391 token_source = new DjentelParserEngineTokenManager(jj_input_stream); 2392 token = new Token(); 2393 jj_ntk = -1; 2394 jj_gen = 0; 2395 for (int i = 0; i < 28; i++) 2396 jj_la1[i] = -1; 2397 for (int i = 0; i < jj_2_rtns.length; i++) 2398 jj_2_rtns[i] = new JJCalls(); 2399 } 2400 2401 public void ReInit(java.io.Reader stream) 2402 { 2403 jj_input_stream.ReInit(stream, 1, 1); 2404 token_source.ReInit(jj_input_stream); 2405 token = new Token(); 2406 jj_ntk = -1; 2407 jjtree.reset(); 2408 jj_gen = 0; 2409 for (int i = 0; i < 28; i++) 2410 jj_la1[i] = -1; 2411 for (int i = 0; i < jj_2_rtns.length; i++) 2412 jj_2_rtns[i] = new JJCalls(); 2413 } 2414 2415 public DjentelParserEngine(DjentelParserEngineTokenManager tm) 2416 { 2417 token_source = tm; 2418 token = new Token(); 2419 jj_ntk = -1; 2420 jj_gen = 0; 2421 for (int i = 0; i < 28; i++) 2422 jj_la1[i] = -1; 2423 for (int i = 0; i < jj_2_rtns.length; i++) 2424 jj_2_rtns[i] = new JJCalls(); 2425 } 2426 2427 public void ReInit(DjentelParserEngineTokenManager tm) 2428 { 2429 token_source = tm; 2430 token = new Token(); 2431 jj_ntk = -1; 2432 jjtree.reset(); 2433 jj_gen = 0; 2434 for (int i = 0; i < 28; i++) 2435 jj_la1[i] = -1; 2436 for (int i = 0; i < jj_2_rtns.length; i++) 2437 jj_2_rtns[i] = new JJCalls(); 2438 } 2439 2440 final private Token jj_consume_token(int kind) throws ParseException 2441 { 2442 Token oldToken; 2443 if ((oldToken = token).next != null) token = token.next; 2444 else token = token.next = token_source.getNextToken(); 2445 jj_ntk = -1; 2446 if (token.kind == kind) 2447 { 2448 jj_gen++; 2449 if (++jj_gc > 100) 2450 { 2451 jj_gc = 0; 2452 for (int i = 0; i < jj_2_rtns.length; i++) 2453 { 2454 JJCalls c = jj_2_rtns[i]; 2455 while (c != null) 2456 { 2457 if (c.gen < jj_gen) c.first = null; 2458 c = c.next; 2459 } 2460 } 2461 } 2462 return token; 2463 } 2464 token = oldToken; 2465 jj_kind = kind; 2466 throw generateParseException(); 2467 } 2468 2469 final private boolean jj_scan_token(int kind) 2470 { 2471 if (jj_scanpos == jj_lastpos) 2472 { 2473 jj_la--; 2474 if (jj_scanpos.next == null) 2475 { 2476 jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); 2477 } 2478 else 2479 { 2480 jj_lastpos = jj_scanpos = jj_scanpos.next; 2481 } 2482 } 2483 else 2484 { 2485 jj_scanpos = jj_scanpos.next; 2486 } 2487 if (jj_rescan) 2488 { 2489 int i = 0; 2490 Token tok = token; 2491 while (tok != null && tok != jj_scanpos) 2492 { 2493 i++; 2494 tok = tok.next; 2495 } 2496 if (tok != null) jj_add_error_token(kind, i); 2497 } 2498 return (jj_scanpos.kind != kind); 2499 } 2500 2501 final public Token getNextToken() 2502 { 2503 if (token.next != null) token = token.next; 2504 else token = token.next = token_source.getNextToken(); 2505 jj_ntk = -1; 2506 jj_gen++; 2507 return token; 2508 } 2509 2510 final public Token getToken(int index) 2511 { 2512 Token t = lookingAhead ? jj_scanpos : token; 2513 for (int i = 0; i < index; i++) 2514 { 2515 if (t.next != null) t = t.next; 2516 else t = t.next = token_source.getNextToken(); 2517 } 2518 return t; 2519 } 2520 2521 final private int jj_ntk() 2522 { 2523 if ((jj_nt = token.next) == null) return (jj_ntk = (token.next = token_source.getNextToken()).kind); 2524 else return (jj_ntk = jj_nt.kind); 2525 } 2526 2527 private java.util.Vector jj_expentries = new java.util.Vector (); 2528 private int[] jj_expentry; 2529 private int jj_kind = -1; 2530 private int[] jj_lasttokens = new int[100]; 2531 private int jj_endpos; 2532 2533 private void jj_add_error_token(int kind, int pos) 2534 { 2535 if (pos >= 100) return; 2536 if (pos == jj_endpos + 1) 2537 { 2538 jj_lasttokens[jj_endpos++] = kind; 2539 } 2540 else if (jj_endpos != 0) 2541 { 2542 jj_expentry = new int[jj_endpos]; 2543 for (int i = 0; i < jj_endpos; i++) 2544 { 2545 jj_expentry[i] = jj_lasttokens[i]; 2546 } 2547 boolean exists = false; 2548 for (java.util.Enumeration enum1 = jj_expentries.elements(); enum1.hasMoreElements();) 2549 { 2550 int[] oldentry = (int[]) (enum1.nextElement()); 2551 if (oldentry.length == jj_expentry.length) 2552 { 2553 exists = true; 2554 for (int i = 0; i < jj_expentry.length; i++) 2555 { 2556 if (oldentry[i] != jj_expentry[i]) 2557 { 2558 exists = false; 2559 break; 2560 } 2561 } 2562 if (exists) break; 2563 } 2564 } 2565 if (!exists) jj_expentries.addElement(jj_expentry); 2566 if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; 2567 } 2568 } 2569 2570 public ParseException generateParseException() 2571 { 2572 jj_expentries.removeAllElements(); 2573 boolean[] la1tokens = new boolean[87]; 2574 for (int i = 0; i < 87; i++) 2575 { 2576 la1tokens[i] = false; 2577 } 2578 if (jj_kind >= 0) 2579 { 2580 la1tokens[jj_kind] = true; 2581 jj_kind = -1; 2582 } 2583 for (int i = 0; i < 28; i++) 2584 { 2585 if (jj_la1[i] == jj_gen) 2586 { 2587 for (int j = 0; j < 32; j++) 2588 { 2589 if ((jj_la1_0[i] & (1 << j)) != 0) 2590 { 2591 la1tokens[j] = true; 2592 } 2593 if ((jj_la1_1[i] & (1 << j)) != 0) 2594 { 2595 la1tokens[32 + j] = true; 2596 } 2597 if ((jj_la1_2[i] & (1 << j)) != 0) 2598 { 2599 la1tokens[64 + j] = true; 2600 } 2601 } 2602 } 2603 } 2604 for (int i = 0; i < 87; i++) 2605 { 2606 if (la1tokens[i]) 2607 { 2608 jj_expentry = new int[1]; 2609 jj_expentry[0] = i; 2610 jj_expentries.addElement(jj_expentry); 2611 } 2612 } 2613 jj_endpos = 0; 2614 jj_rescan_token(); 2615 jj_add_error_token(0, 0); 2616 int[][] exptokseq = new int[jj_expentries.size()][]; 2617 for (int i = 0; i < jj_expentries.size(); i++) 2618 { 2619 exptokseq[i] = (int[]) jj_expentries.elementAt(i); 2620 } 2621 return new ParseException(token, exptokseq, tokenImage); 2622 } 2623 2624 final public void enable_tracing() 2625 { 2626 } 2627 2628 final public void disable_tracing() 2629 { 2630 } 2631 2632 final private void jj_rescan_token() 2633 { 2634 jj_rescan = true; 2635 for (int i = 0; i < 6; i++) 2636 { 2637 JJCalls p = jj_2_rtns[i]; 2638 do 2639 { 2640 if (p.gen > jj_gen) 2641 { 2642 jj_la = p.arg; 2643 jj_lastpos = jj_scanpos = p.first; 2644 switch (i) 2645 { 2646 case 0 : 2647 jj_3_1(); 2648 break; 2649 case 1 : 2650 jj_3_2(); 2651 break; 2652 case 2 : 2653 jj_3_3(); 2654 break; 2655 case 3 : 2656 jj_3_4(); 2657 break; 2658 case 4 : 2659 jj_3_5(); 2660 break; 2661 case 5 : 2662 jj_3_6(); 2663 break; 2664 } 2665 } 2666 p = p.next; 2667 } 2668 while (p != null); 2669 } 2670 jj_rescan = false; 2671 } 2672 2673 final private void jj_save(int index, int xla) 2674 { 2675 JJCalls p = jj_2_rtns[index]; 2676 while (p.gen > jj_gen) 2677 { 2678 if (p.next == null) 2679 { 2680 p = p.next = new JJCalls(); 2681 break; 2682 } 2683 p = p.next; 2684 } 2685 p.gen = jj_gen + xla - jj_la; 2686 p.first = token; 2687 p.arg = xla; 2688 } 2689 2690 static final class JJCalls 2691 { 2692 int gen; 2693 Token first; 2694 int arg; 2695 JJCalls next; 2696 } 2697 2698} | Popular Tags |