1 package org.objectweb.modfact.qvt.syntaxe; 3 4 import antlr.TokenBuffer; 5 import antlr.TokenStreamException; 6 import antlr.TokenStreamIOException; 7 import antlr.ANTLRException; 8 import antlr.LLkParser; 9 import antlr.Token; 10 import antlr.TokenStream; 11 import antlr.RecognitionException; 12 import antlr.NoViableAltException; 13 import antlr.MismatchedTokenException; 14 import antlr.SemanticException; 15 import antlr.ParserSharedInputState; 16 import antlr.collections.impl.BitSet; 17 import java.util.*; 18 import java.util.logging.Logger ; 19 public class STRLParser extends antlr.LLkParser implements STRLParserTokenTypes 20 { 21 Vector ValAssExpVec, RuleElemVec; Vector ifVect=new Vector(); Vector ifElse=new Vector(); Hashtable RulesTab; String CurrentRule=null; simpletrl.RulesUnit unit; simpletrl.PropertyAssignExp pAssExp; simpletrl.IfStatementExp iFSE; simpletrl.SimpleTRLPackage rulesModel; private Logger logger; 33 public void setRuleModel(simpletrl.SimpleTRLPackage rulesModel) { 34 this.rulesModel = rulesModel; 35 } 36 37 public Logger getLogger() { 38 return logger; 39 } 40 41 public void setLogger(Logger logger) { 42 this.logger = logger; 43 } 44 45 protected STRLParser(TokenBuffer tokenBuf, int k) { 46 super(tokenBuf,k); 47 tokenNames = _tokenNames; 48 } 49 50 public STRLParser(TokenBuffer tokenBuf) { 51 this(tokenBuf,3); 52 } 53 54 protected STRLParser(TokenStream lexer, int k) { 55 super(lexer,k); 56 tokenNames = _tokenNames; 57 } 58 59 public STRLParser(TokenStream lexer) { 60 this(lexer,3); 61 } 62 63 public STRLParser(ParserSharedInputState state) { 64 super(state,3); 65 tokenNames = _tokenNames; 66 } 67 68 public final void file() throws RecognitionException, TokenStreamException { 69 70 Token n = null; 71 Token s = null; 72 Token t = null; 73 logger.fine("File Rule Called"); 74 RulesTab=new Hashtable(); 75 76 77 try { { 79 match(LITERAL_RulesUnit); 80 { 81 int _cnt260=0; 82 _loop260: 83 do { 84 if ((LA(1)==WS)) { 85 match(WS); 86 } 87 else { 88 if ( _cnt260>=1 ) { break _loop260; } else {throw new NoViableAltException(LT(1), getFilename());} 89 } 90 91 _cnt260++; 92 } while (true); 93 } 94 n = LT(1); 95 match(NAME); 96 { 97 int _cnt262=0; 98 _loop262: 99 do { 100 if ((LA(1)==WS)) { 101 match(WS); 102 } 103 else { 104 if ( _cnt262>=1 ) { break _loop262; } else {throw new NoViableAltException(LT(1), getFilename());} 105 } 106 107 _cnt262++; 108 } while (true); 109 } 110 match(SOURCE); 111 { 112 int _cnt264=0; 113 _loop264: 114 do { 115 if ((LA(1)==WS)) { 116 match(WS); 117 } 118 else { 119 if ( _cnt264>=1 ) { break _loop264; } else {throw new NoViableAltException(LT(1), getFilename());} 120 } 121 122 _cnt264++; 123 } while (true); 124 } 125 s = LT(1); 126 match(NAME); 127 { 128 int _cnt266=0; 129 _loop266: 130 do { 131 if ((LA(1)==WS)) { 132 match(WS); 133 } 134 else { 135 if ( _cnt266>=1 ) { break _loop266; } else {throw new NoViableAltException(LT(1), getFilename());} 136 } 137 138 _cnt266++; 139 } while (true); 140 } 141 match(TARGET); 142 { 143 int _cnt268=0; 144 _loop268: 145 do { 146 if ((LA(1)==WS)) { 147 match(WS); 148 } 149 else { 150 if ( _cnt268>=1 ) { break _loop268; } else {throw new NoViableAltException(LT(1), getFilename());} 151 } 152 153 _cnt268++; 154 } while (true); 155 } 156 t = LT(1); 157 match(NAME); 158 { 159 int _cnt270=0; 160 _loop270: 161 do { 162 if ((LA(1)==WS)) { 163 match(WS); 164 } 165 else { 166 if ( _cnt270>=1 ) { break _loop270; } else {throw new NoViableAltException(LT(1), getFilename());} 167 } 168 169 _cnt270++; 170 } while (true); 171 } 172 match(OPENBRACKET); 173 { 174 switch ( LA(1)) { 175 case NEWLINE: 176 { 177 match(NEWLINE); 178 break; 179 } 180 case WS: 181 case LITERAL_EntryPointRule: 182 case LITERAL_Rule: 183 { 184 break; 185 } 186 default: 187 { 188 throw new NoViableAltException(LT(1), getFilename()); 189 } 190 } 191 } 192 unit = rulesModel.getRulesUnit().createRulesUnit(n.getText(),s.getText(),t.getText()); 193 { 194 _loop273: 195 do { 196 if ((LA(1)==WS)) { 197 match(WS); 198 } 199 else { 200 break _loop273; 201 } 202 203 } while (true); 204 } 205 { 206 int _cnt275=0; 207 _loop275: 208 do { 209 if ((LA(1)==LITERAL_EntryPointRule||LA(1)==LITERAL_Rule)) { 210 rule(); 211 match(NEWLINE); 212 } 213 else { 214 if ( _cnt275>=1 ) { break _loop275; } else {throw new NoViableAltException(LT(1), getFilename());} 215 } 216 217 _cnt275++; 218 } while (true); 219 } 220 match(CLOSEBRACKET); 221 { 222 switch ( LA(1)) { 223 case NEWLINE: 224 { 225 match(NEWLINE); 226 break; 227 } 228 case EOF: 229 { 230 break; 231 } 232 default: 233 { 234 throw new NoViableAltException(LT(1), getFilename()); 235 } 236 } 237 } 238 } 239 logger.fine("name =" + n.getText()); 240 logger.fine("Source =" + s.getText()); 241 logger.fine("Target =" + t.getText()); 242 logger.fine("Recognition Succed"); 243 244 } 245 catch (RecognitionException ex) { 246 reportError(ex); 247 consume(); 248 consumeUntil(_tokenSet_0); 249 } 250 } 251 252 public final void rule() throws RecognitionException, TokenStreamException { 253 254 255 try { { 257 switch ( LA(1)) { 258 case LITERAL_EntryPointRule: 259 { 260 erp(); 261 break; 262 } 263 case LITERAL_Rule: 264 { 265 cr(); 266 break; 267 } 268 default: 269 { 270 throw new NoViableAltException(LT(1), getFilename()); 271 } 272 } 273 } 274 logger.fine("rule"); 275 } 276 catch (RecognitionException ex) { 277 reportError(ex); 278 consume(); 279 consumeUntil(_tokenSet_1); 280 } 281 } 282 283 public final void erp() throws RecognitionException, TokenStreamException { 284 285 Token n = null; 286 Token elementcontext = null; 287 String resultElement=null; simpletrl.EntryPointRule epr; 288 289 try { { 291 match(LITERAL_EntryPointRule); 292 { 293 int _cnt282=0; 294 _loop282: 295 do { 296 if ((LA(1)==WS)) { 297 match(WS); 298 } 299 else { 300 if ( _cnt282>=1 ) { break _loop282; } else {throw new NoViableAltException(LT(1), getFilename());} 301 } 302 303 _cnt282++; 304 } while (true); 305 } 306 n = LT(1); 307 match(NAME); 308 match(NEWLINE); 309 { 310 _loop284: 311 do { 312 if ((LA(1)==WS)) { 313 match(WS); 314 } 315 else { 316 break _loop284; 317 } 318 319 } while (true); 320 } 321 match(LITERAL_context); 322 { 323 int _cnt286=0; 324 _loop286: 325 do { 326 if ((LA(1)==WS)) { 327 match(WS); 328 } 329 else { 330 if ( _cnt286>=1 ) { break _loop286; } else {throw new NoViableAltException(LT(1), getFilename());} 331 } 332 333 _cnt286++; 334 } while (true); 335 } 336 elementcontext = LT(1); 337 match(NAME); 338 match(NEWLINE); 339 { 340 switch ( LA(1)) { 341 case LITERAL_creates: 342 { 343 resultElement=createclose(); 344 break; 345 } 346 case WS: 347 case NEWLINE: 348 case OPENCROCHET: 349 { 350 break; 351 } 352 default: 353 { 354 throw new NoViableAltException(LT(1), getFilename()); 355 } 356 } 357 } 358 logger.fine("EntryPointRule Called"); 359 epr = rulesModel.getEntryPointRule().createEntryPointRule(n.getText(),"","",elementcontext.getText()); 360 361 if (resultElement!=null) 363 epr.setResultType(resultElement); 364 else 365 epr.setResultType(""); 366 CurrentRule=n.getText(); 368 RulesTab.put(n.getText(),epr); 370 371 { 372 _loop289: 373 do { 374 if ((LA(1)==WS)) { 375 match(WS); 376 } 377 else { 378 break _loop289; 379 } 380 381 } while (true); 382 } 383 { 384 switch ( LA(1)) { 385 case OPENCROCHET: 386 { 387 body(); 388 break; 389 } 390 case NEWLINE: 391 { 392 break; 393 } 394 default: 395 { 396 throw new NoViableAltException(LT(1), getFilename()); 397 } 398 } 399 } 400 } 401 } 402 catch (RecognitionException ex) { 403 reportError(ex); 404 consume(); 405 consumeUntil(_tokenSet_1); 406 } 407 } 408 409 public final void cr() throws RecognitionException, TokenStreamException { 410 411 Token n = null; 412 simpletrl.CalledRule cr=null; simpletrl.ValueExp vExp=null; 413 String resultElement=null; java.util.Vector Parameters=new java.util.Vector (); boolean exist=true; 414 415 416 try { { 418 match(LITERAL_Rule); 419 { 420 int _cnt294=0; 421 _loop294: 422 do { 423 if ((LA(1)==WS)) { 424 match(WS); 425 } 426 else { 427 if ( _cnt294>=1 ) { break _loop294; } else {throw new NoViableAltException(LT(1), getFilename());} 428 } 429 430 _cnt294++; 431 } while (true); 432 } 433 n = LT(1); 434 match(NAME); 435 { 436 Parameters=signRule(); 437 } 438 exist=(RulesTab.containsKey(n.getText())); 439 CurrentRule=n.getText(); 440 441 match(NEWLINE); 442 { 443 _loop297: 444 do { 445 if ((LA(1)==WS)) { 446 match(WS); 447 } 448 else { 449 break _loop297; 450 } 451 452 } while (true); 453 } 454 { 455 switch ( LA(1)) { 456 case LITERAL_creates: 457 { 458 resultElement=createclose(); 459 break; 460 } 461 case NEWLINE: 462 case OPENCROCHET: 463 case LITERAL_return: 464 { 465 break; 466 } 467 default: 468 { 469 throw new NoViableAltException(LT(1), getFilename()); 470 } 471 } 472 } 473 { 474 switch ( LA(1)) { 475 case LITERAL_return: 476 { 477 vExp=returnclose(); 478 break; 479 } 480 case NEWLINE: 481 case OPENCROCHET: 482 { 483 break; 484 } 485 default: 486 { 487 throw new NoViableAltException(LT(1), getFilename()); 488 } 489 } 490 } 491 logger.fine("CalledRule Called"); 492 493 if (!(exist)){ 495 cr=rulesModel.getCalledRule().createCalledRule(); 496 cr.setName(n.getText()); 497 498 if (resultElement!=null) 499 cr.setResultType(resultElement); 500 else 501 cr.setResultType(""); 502 for (int i=0; i<Parameters.size(); i++){ 504 simpletrl.ParameterExp Param=rulesModel.getParameterExp().createParameterExp(((simpletrl.ParameterExp)Parameters.elementAt(i)).getName()); 505 cr.getParams().add(Param); 506 } 507 508 if (vExp!=null) 509 cr.setReturnVal(vExp); 510 511 RulesTab.put(cr.getName(),cr); 512 513 } 514 else{ 515 cr=((simpletrl.CalledRule)RulesTab.get(n.getText())); 516 517 if (resultElement!=null) 518 cr.setResultType(resultElement); 519 else 520 cr.setResultType(""); 521 522 for (int i=0; i<Parameters.size(); i++){ 523 simpletrl.ParameterExp Param=rulesModel.getParameterExp().createParameterExp(((simpletrl.ParameterExp)Parameters.elementAt(i)).getName()); 524 cr.getParams().add(Param); 525 } 526 if (vExp!=null) 527 cr.setReturnVal(vExp); 528 529 } 530 531 logger.fine("CR Position, la Règle courante est :" + CurrentRule); 532 533 { 534 switch ( LA(1)) { 535 case OPENCROCHET: 536 { 537 body(); 538 break; 539 } 540 case NEWLINE: 541 { 542 break; 543 } 544 default: 545 { 546 throw new NoViableAltException(LT(1), getFilename()); 547 } 548 } 549 } 550 } 551 } 552 catch (RecognitionException ex) { 553 reportError(ex); 554 consume(); 555 consumeUntil(_tokenSet_1); 556 } 557 } 558 559 public final String createclose() throws RecognitionException, TokenStreamException { 560 String resultElement= new String (); 561 562 Token n = null; 563 564 try { match(LITERAL_creates); 566 { 567 int _cnt324=0; 568 _loop324: 569 do { 570 if ((LA(1)==WS)) { 571 match(WS); 572 } 573 else { 574 if ( _cnt324>=1 ) { break _loop324; } else {throw new NoViableAltException(LT(1), getFilename());} 575 } 576 577 _cnt324++; 578 } while (true); 579 } 580 n = LT(1); 581 match(NAME); 582 match(NEWLINE); 583 resultElement=n.getText(); 584 } 585 catch (RecognitionException ex) { 586 reportError(ex); 587 consume(); 588 consumeUntil(_tokenSet_2); 589 } 590 return resultElement; 591 } 592 593 public final void body() throws RecognitionException, TokenStreamException { 594 595 596 try { match(OPENCROCHET); 598 { 599 switch ( LA(1)) { 600 case NEWLINE: 601 { 602 match(NEWLINE); 603 break; 604 } 605 case WS: 606 case NAME: 607 case CLOSECROCHET: 608 case DIEZ: 609 case POINTEXCLAM: 610 case POINT: 611 case LITERAL_allOfType: 612 case LITERAL_add: 613 case LITERAL_remove: 614 case LITERAL_isOfType: 615 case LITERAL_equals: 616 case INTERO: 617 case LITERAL_if: 618 case BOOLEAN: 619 case INTEGER: 620 case DOUBLE: 621 case LITERAL_enum: 622 case GUILL: 623 { 624 break; 625 } 626 default: 627 { 628 throw new NoViableAltException(LT(1), getFilename()); 629 } 630 } 631 } 632 { 633 _loop304: 634 do { 635 if ((LA(1)==WS)) { 636 match(WS); 637 } 638 else { 639 break _loop304; 640 } 641 642 } while (true); 643 } 644 { 645 _loop306: 646 do { 647 if ((_tokenSet_3.member(LA(1)))) { 648 statementExp(); 649 } 650 else { 651 break _loop306; 652 } 653 654 } while (true); 655 } 656 match(CLOSECROCHET); 657 unit.getRules().add((simpletrl.Rule)RulesTab.get(CurrentRule)); 658 } 659 catch (RecognitionException ex) { 660 reportError(ex); 661 consume(); 662 consumeUntil(_tokenSet_1); 663 } 664 } 665 666 public final java.util.Vector signRule() throws RecognitionException, TokenStreamException { 667 java.util.Vector Parameters=new java.util.Vector (); 668 669 670 try { { 672 match(OPENPARENT); 673 { 674 switch ( LA(1)) { 675 case WS: 676 case DIEZ: 677 { 678 Parameters=params(); 679 break; 680 } 681 case CLOSEPARENT: 682 { 683 break; 684 } 685 default: 686 { 687 throw new NoViableAltException(LT(1), getFilename()); 688 } 689 } 690 } 691 match(CLOSEPARENT); 692 } 693 } 694 catch (RecognitionException ex) { 695 reportError(ex); 696 consume(); 697 consumeUntil(_tokenSet_1); 698 } 699 return Parameters; 700 } 701 702 public final simpletrl.ValueExp returnclose() throws RecognitionException, TokenStreamException { 703 simpletrl.ValueExp vExp=null; 704 705 706 try { match(LITERAL_return); 708 { 709 int _cnt327=0; 710 _loop327: 711 do { 712 if ((LA(1)==WS)) { 713 match(WS); 714 } 715 else { 716 if ( _cnt327>=1 ) { break _loop327; } else {throw new NoViableAltException(LT(1), getFilename());} 717 } 718 719 _cnt327++; 720 } while (true); 721 } 722 { 723 int _cnt329=0; 724 _loop329: 725 do { 726 if ((_tokenSet_4.member(LA(1)))) { 727 vExp=valueExp(); 728 } 729 else { 730 if ( _cnt329>=1 ) { break _loop329; } else {throw new NoViableAltException(LT(1), getFilename());} 731 } 732 733 _cnt329++; 734 } while (true); 735 } 736 match(NEWLINE); 737 } 738 catch (RecognitionException ex) { 739 reportError(ex); 740 consume(); 741 consumeUntil(_tokenSet_5); 742 } 743 return vExp; 744 } 745 746 public final void statementExp() throws RecognitionException, TokenStreamException { 747 748 logger.fine("je suis dans Statement"); 749 RuleElemVec=new Vector(); 750 simpletrl.RuleCallExp rCE; 751 simpletrl.CollectionExp CE; 752 simpletrl.IfStatementExp ifs; 753 754 755 try { { 757 { 758 switch ( LA(1)) { 759 case NAME: 760 case DIEZ: 761 case POINTEXCLAM: 762 case POINT: 763 case LITERAL_allOfType: 764 case LITERAL_add: 765 case LITERAL_remove: 766 case LITERAL_isOfType: 767 case LITERAL_equals: 768 case INTERO: 769 case BOOLEAN: 770 case INTEGER: 771 case DOUBLE: 772 case LITERAL_enum: 773 case GUILL: 774 { 775 { 776 context(); 777 { 778 if ((LA(1)==NAME) && (LA(2)==OPENPARENT)) { 779 { 780 rCE=ruleCallExp(); 781 } 782 783 784 if (ifElse.isEmpty()) 785 ((simpletrl.Rule)RulesTab.get(CurrentRule)).getStatements().add(rCE); 786 else { 787 if (((Integer )ifElse.get(ifElse.size()-1)).intValue()==1){ 788 iFSE.getThenStatements().add(rCE); 789 } 790 if (((Integer )ifElse.get(ifElse.size()-1)).intValue()==0){ 791 iFSE.getElseStatements().add(rCE); 792 } 793 } 794 795 796 } 797 else if ((LA(1)==NAME) && (LA(2)==EQUAL)) { 798 propertyAssignExp(); 799 value(); 800 801 802 if (ifElse.isEmpty()) { 803 ((simpletrl.Rule)RulesTab.get(CurrentRule)).getStatements().add(pAssExp); 804 } 805 else { 806 if (((Integer )ifElse.get(ifElse.size()-1)).intValue()==1){ 807 iFSE.getThenStatements().add(pAssExp); 808 } 809 if (((Integer )ifElse.get(ifElse.size()-1)).intValue()==0){ 810 iFSE.getElseStatements().add(pAssExp); 811 } 812 } 813 814 815 } 816 else if ((LA(1)==LITERAL_add||LA(1)==LITERAL_remove)) { 817 { 818 CE=collectionExp(); 819 } 820 821 822 if (ifElse.isEmpty()) 823 ((simpletrl.Rule)RulesTab.get(CurrentRule)).getStatements().add(CE); 824 else { 825 if (((Integer )ifElse.get(ifElse.size()-1)).intValue()==1){ 826 iFSE.getThenStatements().add(CE); 827 } 828 if (((Integer )ifElse.get(ifElse.size()-1)).intValue()==0){ 829 iFSE.getElseStatements().add(CE); 830 } 831 } 832 833 834 } 835 else { 836 throw new NoViableAltException(LT(1), getFilename()); 837 } 838 839 } 840 } 841 break; 842 } 843 case LITERAL_if: 844 { 845 { 846 ifs=ifStatementExp(); 847 } 848 849 if (ifVect.size()==1){ 850 ((simpletrl.Rule)RulesTab.get(CurrentRule)).getStatements().add(ifs); 851 ifElse.clear(); 852 ifVect.clear(); 853 } 854 855 if (ifVect.size()>=2){ 856 857 ifElse.removeElementAt(ifElse.size()-1); 858 ifElse.removeElementAt(ifElse.size()-1); 859 860 if (((Integer )ifElse.get(ifElse.size()-1)).intValue()==0){ 861 ((simpletrl.IfStatementExp)ifVect.elementAt(ifVect.size()-2)).getElseStatements().add(ifs); 862 } 863 else { 864 ((simpletrl.IfStatementExp)ifVect.elementAt(ifVect.size()-2)).getThenStatements().add(ifs); 865 } 866 867 ifVect.removeElementAt(ifVect.size()-1); 868 iFSE=((simpletrl.IfStatementExp)ifVect.elementAt(ifVect.size()-1)); 869 } 870 871 872 break; 873 } 874 default: 875 { 876 throw new NoViableAltException(LT(1), getFilename()); 877 } 878 } 879 } 880 RuleElemVec.removeAllElements(); 881 match(NEWLINE); 882 { 883 _loop339: 884 do { 885 if ((LA(1)==WS)) { 886 match(WS); 887 } 888 else { 889 break _loop339; 890 } 891 892 } while (true); 893 } 894 } 895 } 896 catch (RecognitionException ex) { 897 reportError(ex); 898 consume(); 899 consumeUntil(_tokenSet_6); 900 } 901 } 902 903 public final java.util.Vector params() throws RecognitionException, TokenStreamException { 904 java.util.Vector Parameters=new java.util.Vector (); 905 906 simpletrl.ParameterExp p=rulesModel.getParameterExp().createParameterExp(); 907 908 try { { 910 { 911 _loop313: 912 do { 913 if ((LA(1)==WS)) { 914 match(WS); 915 } 916 else { 917 break _loop313; 918 } 919 920 } while (true); 921 } 922 p=parameterExp(); 923 { 924 _loop315: 925 do { 926 if ((LA(1)==WS)) { 927 match(WS); 928 } 929 else { 930 break _loop315; 931 } 932 933 } while (true); 934 } 935 Parameters.addElement(p); 936 { 937 _loop319: 938 do { 939 if ((LA(1)==COMMA)) { 940 match(COMMA); 941 { 942 _loop318: 943 do { 944 if ((LA(1)==WS)) { 945 match(WS); 946 } 947 else { 948 break _loop318; 949 } 950 951 } while (true); 952 } 953 p=parameterExp(); 954 Parameters.addElement(p); 955 } 956 else { 957 break _loop319; 958 } 959 960 } while (true); 961 } 962 } 963 } 964 catch (RecognitionException ex) { 965 reportError(ex); 966 consume(); 967 consumeUntil(_tokenSet_7); 968 } 969 return Parameters; 970 } 971 972 public final simpletrl.ParameterExp parameterExp() throws RecognitionException, TokenStreamException { 973 simpletrl.ParameterExp ParamExp=rulesModel.getParameterExp().createParameterExp(); 974 975 Token n = null; 976 Token c = null; 977 Token r = null; 978 979 try { { 981 if ((LA(1)==DIEZ) && (LA(2)==NAME)) { 982 match(DIEZ); 983 n = LT(1); 984 match(NAME); 985 ParamExp.setName(n.getText()); 986 } 987 else if ((LA(1)==DIEZ) && (LA(2)==LITERAL_context)) { 988 match(DIEZ); 989 c = LT(1); 990 match(LITERAL_context); 991 ParamExp.setName(c.getText()); 992 } 993 else if ((LA(1)==DIEZ) && (LA(2)==LITERAL_result)) { 994 match(DIEZ); 995 r = LT(1); 996 match(LITERAL_result); 997 ParamExp.setName(r.getText()); 998 } 999 else { 1000 throw new NoViableAltException(LT(1), getFilename()); 1001 } 1002 1003 } 1004 RuleElemVec.addElement(ParamExp); 1005 } 1006 catch (RecognitionException ex) { 1007 reportError(ex); 1008 consume(); 1009 consumeUntil(_tokenSet_8); 1010 } 1011 return ParamExp; 1012 } 1013 1014 public final simpletrl.ValueExp valueExp() throws RecognitionException, TokenStreamException { 1015 simpletrl.ValueExp ValExp=null; 1016 1017 1018 try { { 1020 switch ( LA(1)) { 1021 case DIEZ: 1022 { 1023 { 1024 ValExp=parameterExp(); 1025 } 1026 break; 1027 } 1028 case LITERAL_allOfType: 1029 { 1030 { 1031 ValExp=modelReferenceExp(); 1032 } 1033 break; 1034 } 1035 case LITERAL_isOfType: 1036 { 1037 { 1038 ValExp=isOfTypeExp(); 1039 } 1040 break; 1041 } 1042 case LITERAL_equals: 1043 { 1044 { 1045 ValExp=compareExp(); 1046 } 1047 break; 1048 } 1049 case INTERO: 1050 { 1051 { 1052 ValExp=ifValueExp(); 1053 } 1054 break; 1055 } 1056 case BOOLEAN: 1057 case INTEGER: 1058 case DOUBLE: 1059 case LITERAL_enum: 1060 case GUILL: 1061 { 1062 { 1063 ValExp=literalExp(); 1064 } 1065 break; 1066 } 1067 case LITERAL_add: 1068 case LITERAL_remove: 1069 { 1070 { 1071 ValExp=collectionExp(); 1072 } 1073 break; 1074 } 1075 case POINT: 1076 { 1077 match(POINT); 1078 break; 1079 } 1080 default: 1081 if ((LA(1)==NAME) && (_tokenSet_8.member(LA(2)))) { 1082 { 1083 ValExp=propretyCallExp(); 1084 } 1085 } 1086 else if ((LA(1)==NAME) && (LA(2)==OPENPARENT)) { 1087 { 1088 ValExp=ruleCallExp(); 1089 } 1090 } 1091 else if ((LA(1)==NAME) && (LA(2)==EQUAL)) { 1092 propertyAssignExp(); 1093 } 1094 else { 1095 throw new NoViableAltException(LT(1), getFilename()); 1096 } 1097 } 1098 } 1099 } 1100 catch (RecognitionException ex) { 1101 reportError(ex); 1102 consume(); 1103 consumeUntil(_tokenSet_8); 1104 } 1105 return ValExp; 1106 } 1107 1108 public final void context() throws RecognitionException, TokenStreamException { 1109 1110 1111 try { { 1113 _loop342: 1114 do { 1115 if ((_tokenSet_4.member(LA(1)))) { 1116 valueExp(); 1117 } 1118 else { 1119 break _loop342; 1120 } 1121 1122 } while (true); 1123 } 1124 match(POINTEXCLAM); 1125 } 1126 catch (RecognitionException ex) { 1127 reportError(ex); 1128 consume(); 1129 consumeUntil(_tokenSet_9); 1130 } 1131 } 1132 1133 public final simpletrl.RuleCallExp ruleCallExp() throws RecognitionException, TokenStreamException { 1134 simpletrl.RuleCallExp rCall = rulesModel.getRuleCallExp().createRuleCallExp(); 1135 1136 Token n = null; 1137 logger.fine("je suis dans ruleCallExp"); 1138 simpletrl.ValueExp vExp1=null; 1139 simpletrl.ValueExp vExp2=null; 1140 Vector paramVec=new Vector(); 1141 boolean exist; 1142 1143 1144 try { { 1146 n = LT(1); 1147 match(NAME); 1148 match(OPENPARENT); 1149 rCall.setContext((simpletrl.ValueExp)RuleElemVec.elementAt(RuleElemVec.size()-1)); 1150 { 1151 { 1152 _loop364: 1153 do { 1154 if ((LA(1)==WS)) { 1155 match(WS); 1156 } 1157 else { 1158 break _loop364; 1159 } 1160 1161 } while (true); 1162 } 1163 { 1164 _loop366: 1165 do { 1166 if ((_tokenSet_4.member(LA(1)))) { 1167 vExp1=valueExp(); 1168 } 1169 else { 1170 break _loop366; 1171 } 1172 1173 } while (true); 1174 } 1175 if (vExp1!=null) paramVec.addElement(vExp1); 1176 { 1177 _loop372: 1178 do { 1179 if ((LA(1)==COMMA)) { 1180 match(COMMA); 1181 { 1182 _loop369: 1183 do { 1184 if ((LA(1)==WS)) { 1185 match(WS); 1186 } 1187 else { 1188 break _loop369; 1189 } 1190 1191 } while (true); 1192 } 1193 { 1194 _loop371: 1195 do { 1196 if ((_tokenSet_4.member(LA(1)))) { 1197 vExp2=valueExp(); 1198 } 1199 else { 1200 break _loop371; 1201 } 1202 1203 } while (true); 1204 } 1205 if (vExp2!=null) paramVec.addElement(vExp2); 1206 } 1207 else { 1208 break _loop372; 1209 } 1210 1211 } while (true); 1212 } 1213 } 1214 match(CLOSEPARENT); 1215 } 1216 exist=(RulesTab.containsKey(n.getText())); 1217 if (!exist){ 1218 simpletrl.CalledRule cr=rulesModel.getCalledRule().createCalledRule(n.getText(),"",""); 1219 RulesTab.put(cr.getName(), cr); 1220 logger.fine("je suis dans ruleCallExp et le nom de la règle rajoutée est =" + cr.getName()); 1221 rCall.setRule(cr); 1222 1223 } 1224 else { 1225 rCall.setRule((simpletrl.CalledRule)RulesTab.get(n.getText())); 1226 } 1227 1228 for (int i=0; i<paramVec.size(); i++){ 1230 rCall.getArgs().add((simpletrl.ValueExp)paramVec.elementAt(i)); 1231 } 1232 1233 RuleElemVec.addElement(rCall); 1234 1235 } 1236 catch (RecognitionException ex) { 1237 reportError(ex); 1238 consume(); 1239 consumeUntil(_tokenSet_8); 1240 } 1241 return rCall; 1242 } 1243 1244 public final void propertyAssignExp() throws RecognitionException, TokenStreamException { 1245 1246 Token p = null; 1247 logger.fine("je suis dans propertyAssignExp"); 1248 1249 try { p = LT(1); 1251 match(NAME); 1252 match(EQUAL); 1253 pAssExp=rulesModel.getPropertyAssignExp().createPropertyAssignExp(p.getText()); 1254 pAssExp.setContext((simpletrl.ValueExp)RuleElemVec.elementAt(RuleElemVec.size()-1)); 1255 1256 } 1257 catch (RecognitionException ex) { 1258 reportError(ex); 1259 consume(); 1260 consumeUntil(_tokenSet_8); 1261 } 1262 } 1263 1264 public final void value() throws RecognitionException, TokenStreamException { 1265 1266 1267 try { { 1269 _loop451: 1270 do { 1271 if ((_tokenSet_4.member(LA(1)))) { 1272 valueExp(); 1273 } 1274 else { 1275 break _loop451; 1276 } 1277 1278 } while (true); 1279 } 1280 pAssExp.setValue((simpletrl.ValueExp)RuleElemVec.elementAt(RuleElemVec.size()-1)); 1281 RuleElemVec.addElement(pAssExp); 1282 1283 } 1284 catch (RecognitionException ex) { 1285 reportError(ex); 1286 consume(); 1287 consumeUntil(_tokenSet_1); 1288 } 1289 } 1290 1291 public final simpletrl.CollectionExp collectionExp() throws RecognitionException, TokenStreamException { 1292 simpletrl.CollectionExp cE=null; 1293 1294 1295 try { { 1297 switch ( LA(1)) { 1298 case LITERAL_add: 1299 { 1300 { 1301 cE=addCollectionExp(); 1302 } 1303 break; 1304 } 1305 case LITERAL_remove: 1306 { 1307 { 1308 cE=removeCollectionExp(); 1309 } 1310 break; 1311 } 1312 default: 1313 { 1314 throw new NoViableAltException(LT(1), getFilename()); 1315 } 1316 } 1317 } 1318 } 1319 catch (RecognitionException ex) { 1320 reportError(ex); 1321 consume(); 1322 consumeUntil(_tokenSet_8); 1323 } 1324 return cE; 1325 } 1326 1327 public final simpletrl.IfStatementExp ifStatementExp() throws RecognitionException, TokenStreamException { 1328 simpletrl.IfStatementExp iFPointeur=null; 1329 1330 simpletrl.ValueExp vExp=null; 1331 1332 try { match(LITERAL_if); 1334 { 1335 _loop434: 1336 do { 1337 if ((LA(1)==WS)) { 1338 match(WS); 1339 } 1340 else { 1341 break _loop434; 1342 } 1343 1344 } while (true); 1345 } 1346 iFSE=rulesModel.getIfStatementExp().createIfStatementExp(); 1347 match(OPENPARENT); 1348 { 1349 int _cnt436=0; 1350 _loop436: 1351 do { 1352 if ((_tokenSet_4.member(LA(1)))) { 1353 vExp=valueExp(); 1354 } 1355 else { 1356 if ( _cnt436>=1 ) { break _loop436; } else {throw new NoViableAltException(LT(1), getFilename());} 1357 } 1358 1359 _cnt436++; 1360 } while (true); 1361 } 1362 iFSE.setCond(vExp); 1363 ifVect.addElement(iFSE); 1364 1365 match(CLOSEPARENT); 1366 { 1367 switch ( LA(1)) { 1368 case NEWLINE: 1369 { 1370 match(NEWLINE); 1371 break; 1372 } 1373 case OPENBRACKET: 1374 { 1375 break; 1376 } 1377 default: 1378 { 1379 throw new NoViableAltException(LT(1), getFilename()); 1380 } 1381 } 1382 } 1383 match(OPENBRACKET); 1384 { 1385 switch ( LA(1)) { 1386 case NEWLINE: 1387 { 1388 match(NEWLINE); 1389 break; 1390 } 1391 case NAME: 1392 case CLOSEBRACKET: 1393 case DIEZ: 1394 case POINTEXCLAM: 1395 case POINT: 1396 case LITERAL_allOfType: 1397 case LITERAL_add: 1398 case LITERAL_remove: 1399 case LITERAL_isOfType: 1400 case LITERAL_equals: 1401 case INTERO: 1402 case LITERAL_if: 1403 case BOOLEAN: 1404 case INTEGER: 1405 case DOUBLE: 1406 case LITERAL_enum: 1407 case GUILL: 1408 { 1409 break; 1410 } 1411 default: 1412 { 1413 throw new NoViableAltException(LT(1), getFilename()); 1414 } 1415 } 1416 } 1417 ifElse.addElement(new Integer (1)); 1418 { 1419 _loop440: 1420 do { 1421 if ((_tokenSet_3.member(LA(1)))) { 1422 statementExp(); 1423 } 1424 else { 1425 break _loop440; 1426 } 1427 1428 } while (true); 1429 } 1430 match(CLOSEBRACKET); 1431 { 1432 switch ( LA(1)) { 1433 case NEWLINE: 1434 { 1435 match(NEWLINE); 1436 break; 1437 } 1438 case LITERAL_else: 1439 { 1440 break; 1441 } 1442 default: 1443 { 1444 throw new NoViableAltException(LT(1), getFilename()); 1445 } 1446 } 1447 } 1448 match(LITERAL_else); 1449 { 1450 switch ( LA(1)) { 1451 case NEWLINE: 1452 { 1453 match(NEWLINE); 1454 break; 1455 } 1456 case WS: 1457 case OPENBRACKET: 1458 { 1459 break; 1460 } 1461 default: 1462 { 1463 throw new NoViableAltException(LT(1), getFilename()); 1464 } 1465 } 1466 } 1467 { 1468 _loop444: 1469 do { 1470 if ((LA(1)==WS)) { 1471 match(WS); 1472 } 1473 else { 1474 break _loop444; 1475 } 1476 1477 } while (true); 1478 } 1479 match(OPENBRACKET); 1480 { 1481 switch ( LA(1)) { 1482 case NEWLINE: 1483 { 1484 match(NEWLINE); 1485 break; 1486 } 1487 case NAME: 1488 case CLOSEBRACKET: 1489 case DIEZ: 1490 case POINTEXCLAM: 1491 case POINT: 1492 case LITERAL_allOfType: 1493 case LITERAL_add: 1494 case LITERAL_remove: 1495 case LITERAL_isOfType: 1496 case LITERAL_equals: 1497 case INTERO: 1498 case LITERAL_if: 1499 case BOOLEAN: 1500 case INTEGER: 1501 case DOUBLE: 1502 case LITERAL_enum: 1503 case GUILL: 1504 { 1505 break; 1506 } 1507 default: 1508 { 1509 throw new NoViableAltException(LT(1), getFilename()); 1510 } 1511 } 1512 } 1513 ifElse.addElement(new Integer (0)); 1514 { 1515 _loop447: 1516 do { 1517 if ((_tokenSet_3.member(LA(1)))) { 1518 statementExp(); 1519 } 1520 else { 1521 break _loop447; 1522 } 1523 1524 } while (true); 1525 } 1526 match(CLOSEBRACKET); 1527 iFPointeur=iFSE; 1528 } 1529 catch (RecognitionException ex) { 1530 reportError(ex); 1531 consume(); 1532 consumeUntil(_tokenSet_1); 1533 } 1534 return iFPointeur; 1535 } 1536 1537 public final simpletrl.ModelReferenceExp modelReferenceExp() throws RecognitionException, TokenStreamException { 1538 simpletrl.ModelReferenceExp mRef=rulesModel.getModelReferenceExp().createModelReferenceExp(); 1539 1540 Token n = null; 1541 logger.fine("je suis dans modelReferenceExp"); 1542 1543 try { { 1545 match(LITERAL_allOfType); 1546 match(OPENPARENT); 1547 { 1548 _loop357: 1549 do { 1550 if ((LA(1)==WS)) { 1551 match(WS); 1552 } 1553 else { 1554 break _loop357; 1555 } 1556 1557 } while (true); 1558 } 1559 n = LT(1); 1560 match(NAME); 1561 { 1562 _loop359: 1563 do { 1564 if ((LA(1)==WS)) { 1565 match(WS); 1566 } 1567 else { 1568 break _loop359; 1569 } 1570 1571 } while (true); 1572 } 1573 match(CLOSEPARENT); 1574 } 1575 mRef.setConceptName(n.getText()); 1576 RuleElemVec.addElement(mRef); 1577 1578 } 1579 catch (RecognitionException ex) { 1580 reportError(ex); 1581 consume(); 1582 consumeUntil(_tokenSet_8); 1583 } 1584 return mRef; 1585 } 1586 1587 public final simpletrl.PropertyCallExp propretyCallExp() throws RecognitionException, TokenStreamException { 1588 simpletrl.PropertyCallExp pCallExp=null; 1589 1590 Token n = null; 1591 1592 try { n = LT(1); 1594 match(NAME); 1595 1596 logger.fine("je suis dans propertyCallExp et PCE=" + n.getText()); 1597 pCallExp = rulesModel.getPropertyCallExp().createPropertyCallExp(n.getText()); 1598 pCallExp.setContext((simpletrl.ValueExp)RuleElemVec.elementAt(RuleElemVec.size()-1)); 1599 RuleElemVec.addElement(pCallExp); 1600 1601 } 1602 catch (RecognitionException ex) { 1603 reportError(ex); 1604 consume(); 1605 consumeUntil(_tokenSet_8); 1606 } 1607 return pCallExp; 1608 } 1609 1610 public final simpletrl.IsOfTypeExp isOfTypeExp() throws RecognitionException, TokenStreamException { 1611 simpletrl.IsOfTypeExp isOT=rulesModel.getIsOfTypeExp().createIsOfTypeExp(); 1612 1613 Token t = null; 1614 logger.fine("je suis dans isOfTypeExp"); 1615 1616 try { { 1618 match(LITERAL_isOfType); 1619 match(OPENPARENT); 1620 { 1621 _loop397: 1622 do { 1623 if ((LA(1)==WS)) { 1624 match(WS); 1625 } 1626 else { 1627 break _loop397; 1628 } 1629 1630 } while (true); 1631 } 1632 t = LT(1); 1633 match(NAME); 1634 { 1635 _loop399: 1636 do { 1637 if ((LA(1)==WS)) { 1638 match(WS); 1639 } 1640 else { 1641 break _loop399; 1642 } 1643 1644 } while (true); 1645 } 1646 match(CLOSEPARENT); 1647 } 1648 isOT.setType(t.getText()); 1649 isOT.setContext((simpletrl.ValueExp)RuleElemVec.elementAt(RuleElemVec.size()-1)); 1650 RuleElemVec.addElement(isOT); 1651 1652 } 1653 catch (RecognitionException ex) { 1654 reportError(ex); 1655 consume(); 1656 consumeUntil(_tokenSet_8); 1657 } 1658 return isOT; 1659 } 1660 1661 public final simpletrl.CompareExp compareExp() throws RecognitionException, TokenStreamException { 1662 simpletrl.CompareExp CompExp=rulesModel.getCompareExp().createCompareExp(); 1663 1664 logger.fine("je suis dans compareExp"); 1665 simpletrl.ValueExp ValExPointeur=null; 1666 1667 1668 try { { 1670 match(LITERAL_equals); 1671 match(OPENPARENT); 1672 { 1673 _loop403: 1674 do { 1675 if ((LA(1)==WS)) { 1676 match(WS); 1677 } 1678 else { 1679 break _loop403; 1680 } 1681 1682 } while (true); 1683 } 1684 CompExp.setContext((simpletrl.ValueExp)RuleElemVec.elementAt(RuleElemVec.size()-1)); 1685 { 1686 int _cnt405=0; 1687 _loop405: 1688 do { 1689 if ((_tokenSet_4.member(LA(1)))) { 1690 ValExPointeur=valueExp(); 1691 } 1692 else { 1693 if ( _cnt405>=1 ) { break _loop405; } else {throw new NoViableAltException(LT(1), getFilename());} 1694 } 1695 1696 _cnt405++; 1697 } while (true); 1698 } 1699 { 1700 _loop407: 1701 do { 1702 if ((LA(1)==WS)) { 1703 match(WS); 1704 } 1705 else { 1706 break _loop407; 1707 } 1708 1709 } while (true); 1710 } 1711 match(CLOSEPARENT); 1712 } 1713 1714 CompExp.setCompareVal(ValExPointeur); 1716 RuleElemVec.addElement(CompExp); 1717 1718 } 1719 catch (RecognitionException ex) { 1720 reportError(ex); 1721 consume(); 1722 consumeUntil(_tokenSet_8); 1723 } 1724 return CompExp; 1725 } 1726 1727 public final simpletrl.IfValueExp ifValueExp() throws RecognitionException, TokenStreamException { 1728 simpletrl.IfValueExp ifValExp=rulesModel.getIfValueExp().createIfValueExp(); 1729 1730 logger.fine("je suis dans ifValueExp"); 1731 simpletrl.ValueExp condValExp=null; 1732 simpletrl.ValueExp thenValExp=null; 1733 simpletrl.ValueExp elseValExp=null; 1734 1735 1736 try { match(INTERO); 1738 match(OPENPARENT); 1739 { 1740 int _cnt410=0; 1741 _loop410: 1742 do { 1743 if ((_tokenSet_4.member(LA(1)))) { 1744 condValExp=valueExp(); 1745 } 1746 else { 1747 if ( _cnt410>=1 ) { break _loop410; } else {throw new NoViableAltException(LT(1), getFilename());} 1748 } 1749 1750 _cnt410++; 1751 } while (true); 1752 } 1753 ifValExp.setCond(condValExp); 1754 match(CLOSEPARENT); 1755 match(INTERO); 1756 { 1757 switch ( LA(1)) { 1758 case NEWLINE: 1759 { 1760 match(NEWLINE); 1761 break; 1762 } 1763 case WS: 1764 case OPENBRACKET: 1765 { 1766 break; 1767 } 1768 default: 1769 { 1770 throw new NoViableAltException(LT(1), getFilename()); 1771 } 1772 } 1773 } 1774 { 1775 _loop413: 1776 do { 1777 if ((LA(1)==WS)) { 1778 match(WS); 1779 } 1780 else { 1781 break _loop413; 1782 } 1783 1784 } while (true); 1785 } 1786 match(OPENBRACKET); 1787 { 1788 switch ( LA(1)) { 1789 case NEWLINE: 1790 { 1791 match(NEWLINE); 1792 break; 1793 } 1794 case WS: 1795 case NAME: 1796 case DIEZ: 1797 case POINT: 1798 case LITERAL_allOfType: 1799 case LITERAL_add: 1800 case LITERAL_remove: 1801 case LITERAL_isOfType: 1802 case LITERAL_equals: 1803 case INTERO: 1804 case BOOLEAN: 1805 case INTEGER: 1806 case DOUBLE: 1807 case LITERAL_enum: 1808 case GUILL: 1809 { 1810 break; 1811 } 1812 default: 1813 { 1814 throw new NoViableAltException(LT(1), getFilename()); 1815 } 1816 } 1817 } 1818 { 1819 _loop416: 1820 do { 1821 if ((LA(1)==WS)) { 1822 match(WS); 1823 } 1824 else { 1825 break _loop416; 1826 } 1827 1828 } while (true); 1829 } 1830 { 1831 int _cnt418=0; 1832 _loop418: 1833 do { 1834 if ((_tokenSet_4.member(LA(1)))) { 1835 thenValExp=valueExp(); 1836 } 1837 else { 1838 if ( _cnt418>=1 ) { break _loop418; } else {throw new NoViableAltException(LT(1), getFilename());} 1839 } 1840 1841 _cnt418++; 1842 } while (true); 1843 } 1844 ifValExp.setThenExp(thenValExp); 1845 { 1846 switch ( LA(1)) { 1847 case NEWLINE: 1848 { 1849 match(NEWLINE); 1850 break; 1851 } 1852 case WS: 1853 case CLOSEBRACKET: 1854 { 1855 break; 1856 } 1857 default: 1858 { 1859 throw new NoViableAltException(LT(1), getFilename()); 1860 } 1861 } 1862 } 1863 { 1864 _loop421: 1865 do { 1866 if ((LA(1)==WS)) { 1867 match(WS); 1868 } 1869 else { 1870 break _loop421; 1871 } 1872 1873 } while (true); 1874 } 1875 match(CLOSEBRACKET); 1876 { 1877 _loop423: 1878 do { 1879 if ((LA(1)==WS)) { 1880 match(WS); 1881 } 1882 else { 1883 break _loop423; 1884 } 1885 1886 } while (true); 1887 } 1888 match(TOWPOINT); 1889 { 1890 _loop425: 1891 do { 1892 if ((LA(1)==WS)) { 1893 match(WS); 1894 } 1895 else { 1896 break _loop425; 1897 } 1898 1899 } while (true); 1900 } 1901 { 1902 switch ( LA(1)) { 1903 case NEWLINE: 1904 { 1905 match(NEWLINE); 1906 break; 1907 } 1908 case OPENBRACKET: 1909 { 1910 break; 1911 } 1912 default: 1913 { 1914 throw new NoViableAltException(LT(1), getFilename()); 1915 } 1916 } 1917 } 1918 match(OPENBRACKET); 1919 { 1920 _loop428: 1921 do { 1922 if ((_tokenSet_4.member(LA(1)))) { 1923 elseValExp=valueExp(); 1924 } 1925 else { 1926 break _loop428; 1927 } 1928 1929 } while (true); 1930 } 1931 ifValExp.setElseExp(elseValExp); 1932 { 1933 switch ( LA(1)) { 1934 case NEWLINE: 1935 { 1936 match(NEWLINE); 1937 break; 1938 } 1939 case WS: 1940 case CLOSEBRACKET: 1941 { 1942 break; 1943 } 1944 default: 1945 { 1946 throw new NoViableAltException(LT(1), getFilename()); 1947 } 1948 } 1949 } 1950 { 1951 _loop431: 1952 do { 1953 if ((LA(1)==WS)) { 1954 match(WS); 1955 } 1956 else { 1957 break _loop431; 1958 } 1959 1960 } while (true); 1961 } 1962 match(CLOSEBRACKET); 1963 RuleElemVec.addElement(ifValExp); 1964 1965 } 1966 catch (RecognitionException ex) { 1967 reportError(ex); 1968 consume(); 1969 consumeUntil(_tokenSet_8); 1970 } 1971 return ifValExp; 1972 } 1973 1974 public final simpletrl.LiteralExp literalExp() throws RecognitionException, TokenStreamException { 1975 simpletrl.LiteralExp litExp=null; 1976 1977 Token bool = null; 1978 Token integer = null; 1979 Token doubleL = null; 1980 1981 try { { 1983 switch ( LA(1)) { 1984 case BOOLEAN: 1985 { 1986 bool = LT(1); 1987 match(BOOLEAN); 1988 boolean trueOfalse; 1989 if (bool.getText().equalsIgnoreCase("1T")) 1990 trueOfalse=true; 1991 else 1992 trueOfalse=false; 1993 1994 litExp=rulesModel.getBooleanLiteral().createBooleanLiteral(trueOfalse); 1995 break; 1996 } 1997 case INTEGER: 1998 { 1999 { 2000 integer = LT(1); 2001 match(INTEGER); 2002 } 2003 litExp=rulesModel.getIntegerLiteral().createIntegerLiteral(Integer.parseInt(integer.getText())); 2004 break; 2005 } 2006 case LITERAL_enum: 2007 { 2008 { 2009 litExp=enumExp(); 2010 } 2011 break; 2012 } 2013 case GUILL: 2014 { 2015 { 2016 litExp=string(); 2017 } 2018 break; 2019 } 2020 case DOUBLE: 2021 { 2022 { 2023 doubleL = LT(1); 2024 match(DOUBLE); 2025 } 2026 litExp=rulesModel.getDoubleLiteral().createDoubleLiteral(Double.parseDouble(doubleL.getText())); 2027 break; 2028 } 2029 default: 2030 { 2031 throw new NoViableAltException(LT(1), getFilename()); 2032 } 2033 } 2034 } 2035 if(litExp!=null) RuleElemVec.addElement(litExp); 2036 } 2037 catch (RecognitionException ex) { 2038 reportError(ex); 2039 consume(); 2040 consumeUntil(_tokenSet_8); 2041 } 2042 return litExp; 2043 } 2044 2045 public final simpletrl.AddCollectionExp addCollectionExp() throws RecognitionException, TokenStreamException { 2046 simpletrl.AddCollectionExp aCE=rulesModel.getAddCollectionExp().createAddCollectionExp(); 2047 2048 simpletrl.ValueExp member=null; 2049 2050 try { { 2052 match(LITERAL_add); 2053 match(OPENPARENT); 2054 { 2055 _loop380: 2056 do { 2057 if ((LA(1)==WS)) { 2058 match(WS); 2059 } 2060 else { 2061 break _loop380; 2062 } 2063 2064 } while (true); 2065 } 2066 aCE.setContext((simpletrl.ValueExp)RuleElemVec.elementAt(RuleElemVec.size()-1)); 2067 { 2068 int _cnt382=0; 2069 _loop382: 2070 do { 2071 if ((_tokenSet_4.member(LA(1)))) { 2072 member=valueExp(); 2073 } 2074 else { 2075 if ( _cnt382>=1 ) { break _loop382; } else {throw new NoViableAltException(LT(1), getFilename());} 2076 } 2077 2078 _cnt382++; 2079 } while (true); 2080 } 2081 { 2082 _loop384: 2083 do { 2084 if ((LA(1)==WS)) { 2085 match(WS); 2086 } 2087 else { 2088 break _loop384; 2089 } 2090 2091 } while (true); 2092 } 2093 match(CLOSEPARENT); 2094 } 2095 aCE.setMember(member); 2096 RuleElemVec.addElement(aCE); 2097 2098 } 2099 catch (RecognitionException ex) { 2100 reportError(ex); 2101 consume(); 2102 consumeUntil(_tokenSet_8); 2103 } 2104 return aCE; 2105 } 2106 2107 public final simpletrl.RemoveCollectionExp removeCollectionExp() throws RecognitionException, TokenStreamException { 2108 simpletrl.RemoveCollectionExp rCE=rulesModel.getRemoveCollectionExp().createRemoveCollectionExp(); 2109 2110 simpletrl.ValueExp member=null; 2111 2112 try { { 2114 match(LITERAL_remove); 2115 match(OPENPARENT); 2116 { 2117 _loop388: 2118 do { 2119 if ((LA(1)==WS)) { 2120 match(WS); 2121 } 2122 else { 2123 break _loop388; 2124 } 2125 2126 } while (true); 2127 } 2128 rCE.setContext((simpletrl.ValueExp)RuleElemVec.elementAt(RuleElemVec.size()-1)); 2129 { 2130 int _cnt390=0; 2131 _loop390: 2132 do { 2133 if ((_tokenSet_4.member(LA(1)))) { 2134 member=valueExp(); 2135 } 2136 else { 2137 if ( _cnt390>=1 ) { break _loop390; } else {throw new NoViableAltException(LT(1), getFilename());} 2138 } 2139 2140 _cnt390++; 2141 } while (true); 2142 } 2143 { 2144 _loop392: 2145 do { 2146 if ((LA(1)==WS)) { 2147 match(WS); 2148 } 2149 else { 2150 break _loop392; 2151 } 2152 2153 } while (true); 2154 } 2155 match(CLOSEPARENT); 2156 } 2157 rCE.setMember(member); 2158 RuleElemVec.addElement(rCE); 2159 2160 } 2161 catch (RecognitionException ex) { 2162 reportError(ex); 2163 consume(); 2164 consumeUntil(_tokenSet_8); 2165 } 2166 return rCE; 2167 } 2168 2169 public final simpletrl.EnumLiteral enumExp() throws RecognitionException, TokenStreamException { 2170 simpletrl.EnumLiteral enumLit=null; 2171 2172 Token val = null; 2173 Token srcOtrg = null; 2174 Token type = null; 2175 2176 try { match(LITERAL_enum); 2178 { 2179 _loop460: 2180 do { 2181 if ((LA(1)==WS)) { 2182 match(WS); 2183 } 2184 else { 2185 break _loop460; 2186 } 2187 2188 } while (true); 2189 } 2190 match(OPENPARENT); 2191 { 2192 _loop462: 2193 do { 2194 if ((LA(1)==WS)) { 2195 match(WS); 2196 } 2197 else { 2198 break _loop462; 2199 } 2200 2201 } while (true); 2202 } 2203 val = LT(1); 2204 match(NAME); 2205 { 2206 _loop464: 2207 do { 2208 if ((LA(1)==WS)) { 2209 match(WS); 2210 } 2211 else { 2212 break _loop464; 2213 } 2214 2215 } while (true); 2216 } 2217 match(TOWPOINT); 2218 { 2219 _loop466: 2220 do { 2221 if ((LA(1)==WS)) { 2222 match(WS); 2223 } 2224 else { 2225 break _loop466; 2226 } 2227 2228 } while (true); 2229 } 2230 srcOtrg = LT(1); 2231 match(NAME); 2232 { 2233 _loop468: 2234 do { 2235 if ((LA(1)==WS)) { 2236 match(WS); 2237 } 2238 else { 2239 break _loop468; 2240 } 2241 2242 } while (true); 2243 } 2244 match(COMMA); 2245 { 2246 _loop470: 2247 do { 2248 if ((LA(1)==WS)) { 2249 match(WS); 2250 } 2251 else { 2252 break _loop470; 2253 } 2254 2255 } while (true); 2256 } 2257 type = LT(1); 2258 match(NAME); 2259 { 2260 _loop472: 2261 do { 2262 if ((LA(1)==WS)) { 2263 match(WS); 2264 } 2265 else { 2266 break _loop472; 2267 } 2268 2269 } while (true); 2270 } 2271 match(CLOSEPARENT); 2272 boolean sOt; 2273 if (srcOtrg.getText().equalsIgnoreCase("src")) 2274 sOt=true; 2275 else 2276 sOt=false; 2277 enumLit=rulesModel.getEnumLiteral().createEnumLiteral(val.getText(),type.getText(),sOt); 2278 2279 } 2280 catch (RecognitionException ex) { 2281 reportError(ex); 2282 consume(); 2283 consumeUntil(_tokenSet_8); 2284 } 2285 return enumLit; 2286 } 2287 2288 public final simpletrl.StringLiteral string() throws RecognitionException, TokenStreamException { 2289 simpletrl.StringLiteral stringLit=null; 2290 2291 Token String = null; 2292 2293 try { match(GUILL); 2295 String = LT(1); 2296 match(NAME); 2297 match(GUILL); 2298 stringLit=rulesModel.getStringLiteral().createStringLiteral(String.getText()); 2299 2300 } 2301 catch (RecognitionException ex) { 2302 reportError(ex); 2303 consume(); 2304 consumeUntil(_tokenSet_8); 2305 } 2306 return stringLit; 2307 } 2308 2309 2310 public static final String [] _tokenNames = { 2311 "<0>", 2312 "EOF", 2313 "<2>", 2314 "NULL_TREE_LOOKAHEAD", 2315 "\"RulesUnit\"", 2316 "WS", 2317 "NAME", 2318 "SOURCE", 2319 "TARGET", 2320 "OPENBRACKET", 2321 "NEWLINE", 2322 "CLOSEBRACKET", 2323 "\"EntryPointRule\"", 2324 "\"context\"", 2325 "\"Rule\"", 2326 "OPENCROCHET", 2327 "CLOSECROCHET", 2328 "OPENPARENT", 2329 "CLOSEPARENT", 2330 "COMMA", 2331 "DIEZ", 2332 "\"result\"", 2333 "\"creates\"", 2334 "\"return\"", 2335 "POINTEXCLAM", 2336 "POINT", 2337 "\"allOfType\"", 2338 "\"add\"", 2339 "\"remove\"", 2340 "\"isOfType\"", 2341 "\"equals\"", 2342 "INTERO", 2343 "TOWPOINT", 2344 "\"if\"", 2345 "\"else\"", 2346 "EQUAL", 2347 "BOOLEAN", 2348 "INTEGER", 2349 "DOUBLE", 2350 "\"enum\"", 2351 "GUILL" 2352 }; 2353 2354 private static final long[] mk_tokenSet_0() { 2355 long[] data = { 2L, 0L}; 2356 return data; 2357 } 2358 public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0()); 2359 private static final long[] mk_tokenSet_1() { 2360 long[] data = { 1024L, 0L}; 2361 return data; 2362 } 2363 public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1()); 2364 private static final long[] mk_tokenSet_2() { 2365 long[] data = { 8422432L, 0L}; 2366 return data; 2367 } 2368 public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2()); 2369 private static final long[] mk_tokenSet_3() { 2370 long[] data = { 2143172952128L, 0L}; 2371 return data; 2372 } 2373 public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3()); 2374 private static final long[] mk_tokenSet_4() { 2375 long[] data = { 2134566240320L, 0L}; 2376 return data; 2377 } 2378 public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4()); 2379 private static final long[] mk_tokenSet_5() { 2380 long[] data = { 33792L, 0L}; 2381 return data; 2382 } 2383 public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5()); 2384 private static final long[] mk_tokenSet_6() { 2385 long[] data = { 2143173019712L, 0L}; 2386 return data; 2387 } 2388 public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6()); 2389 private static final long[] mk_tokenSet_7() { 2390 long[] data = { 262144L, 0L}; 2391 return data; 2392 } 2393 public static final BitSet _tokenSet_7 = new BitSet(mk_tokenSet_7()); 2394 private static final long[] mk_tokenSet_8() { 2395 long[] data = { 2134583807072L, 0L}; 2396 return data; 2397 } 2398 public static final BitSet _tokenSet_8 = new BitSet(mk_tokenSet_8()); 2399 private static final long[] mk_tokenSet_9() { 2400 long[] data = { 402653248L, 0L}; 2401 return data; 2402 } 2403 public static final BitSet _tokenSet_9 = new BitSet(mk_tokenSet_9()); 2404 2405 } 2406 | Popular Tags |