1/** \file 2 * This OBJC source file was generated by $ANTLR version ${project.version} ${buildNumber} 3 * 4 * - From the grammar source file : Fuzzy.g 5 * - On : 2011-05-06 11:47:46 6 * - for the lexer : FuzzyLexer 7 * 8 * Editing it, at least manually, is not wise. 9 * 10 * ObjC language generator and runtime by Alan Condit, acondit|hereisanat|ipns|dotgoeshere|com. 11 * 12 * 13*/ 14// $ANTLR ${project.version} ${buildNumber} Fuzzy.g 2011-05-06 11:47:46 15 16 17/* ----------------------------------------- 18 * Include the ANTLR3 generated header file. 19 */ 20#import "Fuzzy.h" 21/* ----------------------------------------- */ 22 23 24/* ============================================================================= */ 25/* ============================================================================= 26 * Start of recognizer 27 */ 28 29/** As per Terence: No returns for lexer rules! */ 30@implementation Fuzzy // line 330 31 32+ (void) initialize 33{ 34 [ANTLRBaseRecognizer setGrammarFileName:@"Fuzzy.g"]; 35} 36 37+ (NSString *) tokenNameForType:(NSInteger)aTokenType 38{ 39 return [[self getTokenNames] objectAtIndex:aTokenType]; 40} 41 42+ (Fuzzy *)newFuzzyWithCharStream:(id<ANTLRCharStream>)anInput 43{ 44 return [[Fuzzy alloc] initWithCharStream:anInput]; 45} 46 47- (id) initWithCharStream:(id<ANTLRCharStream>)anInput 48{ 49 self = [super initWithCharStream:anInput State:[[ANTLRRecognizerSharedState newANTLRRecognizerSharedStateWithRuleLen:30+1] retain]]; 50 if ( self != nil ) { 51 SEL synpred9_FuzzySelector = @selector(synpred9_Fuzzy_fragment); 52 53 SEL synpred2_FuzzySelector = @selector(synpred2_Fuzzy_fragment); 54 55 SEL synpred7_FuzzySelector = @selector(synpred7_Fuzzy_fragment); 56 57 SEL synpred4_FuzzySelector = @selector(synpred4_Fuzzy_fragment); 58 59 SEL synpred8_FuzzySelector = @selector(synpred8_Fuzzy_fragment); 60 61 SEL synpred6_FuzzySelector = @selector(synpred6_Fuzzy_fragment); 62 63 SEL synpred5_FuzzySelector = @selector(synpred5_Fuzzy_fragment); 64 65 SEL synpred3_FuzzySelector = @selector(synpred3_Fuzzy_fragment); 66 67 SEL synpred1_FuzzySelector = @selector(synpred1_Fuzzy_fragment); 68 69 } 70 return self; 71} 72 73- (void) dealloc 74{ 75 [super dealloc]; 76} 77 78/* ObjC Start of actions.lexer.methods */ 79/* ObjC end of actions.lexer.methods */ 80/* ObjC start methods() */ 81/* ObjC end methods() */ 82 83- (id<ANTLRToken>) nextToken 84{ 85 while (YES) { 86 if ( [input LA:1] == ANTLRCharStreamEOF ) { 87 return [ANTLRCommonToken eofToken]; 88 } 89 state.token = nil; 90 state.channel = ANTLRTokenChannelDefault; 91 state.tokenStartCharIndex = input.index; 92 state.tokenStartCharPositionInLine = input.charPositionInLine; 93 state.tokenStartLine = input.line; 94 state.text = nil; 95 @try { 96 NSInteger m = [input mark]; 97 state.backtracking = 1; /* means we won't throw slow exception */ 98 state.failed = NO; 99 [self mTokens]; 100 state.backtracking = 0; 101 /* mTokens backtracks with synpred at backtracking==2 102 and we set the synpredgate to allow actions at level 1. */ 103 if ( state.failed ) { 104 [input rewind:m]; 105 [input consume]; /* advance one char and try again */ 106 } else { 107 [self emit]; 108 return state.token; 109 } 110 } 111 @catch (ANTLRRecognitionException *re) { 112 // shouldn't happen in backtracking mode, but... 113 [self reportError:re]; 114 [self recover:re]; 115 } 116 } 117} 118 119- (void)memoize:(id<ANTLRIntStream>)anInput 120 RuleIndex:(NSInteger)ruleIndex 121 StartIndex:(NSInteger)ruleStartIndex 122{ 123 if ( state.backtracking > 1 ) [super memoize:anInput RuleIndex:ruleIndex StartIndex:ruleStartIndex]; 124} 125 126- (BOOL)alreadyParsedRule:(id<ANTLRIntStream>)anInput RuleIndex:(NSInteger)ruleIndex 127{ 128 if ( state.backtracking > 1 ) return [super alreadyParsedRule:anInput RuleIndex:ruleIndex]; 129 return NO; 130} 131/* Start of Rules */ 132// $ANTLR start "IMPORT" 133- (void) mIMPORT 134{ 135 // 136 /* my ruleScopeSetUp */ 137 /* Terence's stuff */ 138 139 @try { 140 NSInteger _type = IMPORT; 141 NSInteger _channel = ANTLRTokenChannelDefault; 142 ANTLRCommonToken *name=nil; 143 144 // Fuzzy.g:5:2: ( 'import' WS name= QIDStar ( WS )? ';' ) // ruleBlockSingleAlt 145 // Fuzzy.g:5:4: 'import' WS name= QIDStar ( WS )? ';' // alt 146 { 147 [self matchString:@"import"]; if ( state.failed ) return ; 148 149 150 151 [self mWS]; if ( state.failed ) return ; 152 153 154 155 NSInteger nameStart31 = input.index; 156 [self mQIDStar]; if ( state.failed ) return ; 157 158 name = [[ANTLRCommonToken newToken:input Type:ANTLRTokenTypeInvalid Channel:ANTLRTokenChannelDefault Start:nameStart31 Stop:input.index-1] retain]; 159 name.line = self.line; 160 161 162 // Fuzzy.g:5:29: ( WS )? // block 163 NSInteger alt1=2; 164 NSInteger LA1_0 = [input LA:1]; 165 166 if ( ((LA1_0 >= '\t' && LA1_0 <= '\n')||LA1_0==' ') ) { 167 alt1=1; 168 } 169 switch (alt1) { 170 case 1 : ; 171 // Fuzzy.g:5:29: WS // alt 172 { 173 [self mWS]; if ( state.failed ) return ; 174 175 176 177 } 178 break; 179 180 } 181 182 183 [self matchChar:';']; if ( state.failed ) return ; 184 185 186 } 187 188 // token+rule list labels 189 190 state.type = _type; 191 state.channel = _channel; 192 } 193 @finally { 194 // 195 /* my stuff */ 196 /* Terence's stuff */ 197 198 } 199 return; 200} 201/* $ANTLR end "IMPORT" */ 202 203// $ANTLR start "RETURN" 204- (void) mRETURN 205{ 206 // 207 /* my ruleScopeSetUp */ 208 /* Terence's stuff */ 209 210 @try { 211 NSInteger _type = RETURN; 212 NSInteger _channel = ANTLRTokenChannelDefault; 213 // Fuzzy.g:10:2: ( 'return' ( options {greedy=false; } : . )* ';' ) // ruleBlockSingleAlt 214 // Fuzzy.g:10:4: 'return' ( options {greedy=false; } : . )* ';' // alt 215 { 216 [self matchString:@"return"]; if ( state.failed ) return ; 217 218 219 220 do { 221 NSInteger alt2=2; 222 NSInteger LA2_0 = [input LA:1]; 223 if ( (LA2_0==';') ) { 224 alt2=2; 225 } 226 else if ( ((LA2_0 >= 0x0000 && LA2_0 <= ':')||(LA2_0 >= '<' && LA2_0 <= 0xFFFF)) ) { 227 alt2=1; 228 } 229 230 231 switch (alt2) { 232 case 1 : ; 233 // Fuzzy.g:10:38: . // alt 234 { 235 [self matchAny]; if ( state.failed ) return ; 236 237 238 } 239 break; 240 241 default : 242 goto loop2; 243 } 244 } while (YES); 245 loop2: ; 246 247 248 [self matchChar:';']; if ( state.failed ) return ; 249 250 251 } 252 253 // token+rule list labels 254 255 state.type = _type; 256 state.channel = _channel; 257 } 258 @finally { 259 // 260 /* my stuff */ 261 /* Terence's stuff */ 262 263 } 264 return; 265} 266/* $ANTLR end "RETURN" */ 267 268// $ANTLR start "CLASS" 269- (void) mCLASS 270{ 271 // 272 /* my ruleScopeSetUp */ 273 /* Terence's stuff */ 274 275 @try { 276 NSInteger _type = CLASS; 277 NSInteger _channel = ANTLRTokenChannelDefault; 278 ANTLRCommonToken *name=nil; 279 280 // Fuzzy.g:14:2: ( 'class' WS name= ID ( WS )? ( 'extends' WS QID ( WS )? )? ( 'implements' WS QID ( WS )? ( ',' ( WS )? QID ( WS )? )* )? '{' ) // ruleBlockSingleAlt 281 // Fuzzy.g:14:4: 'class' WS name= ID ( WS )? ( 'extends' WS QID ( WS )? )? ( 'implements' WS QID ( WS )? ( ',' ( WS )? QID ( WS )? )* )? '{' // alt 282 { 283 [self matchString:@"class"]; if ( state.failed ) return ; 284 285 286 287 [self mWS]; if ( state.failed ) return ; 288 289 290 291 NSInteger nameStart81 = input.index; 292 [self mID]; if ( state.failed ) return ; 293 294 name = [[ANTLRCommonToken newToken:input Type:ANTLRTokenTypeInvalid Channel:ANTLRTokenChannelDefault Start:nameStart81 Stop:input.index-1] retain]; 295 name.line = self.line; 296 297 298 // Fuzzy.g:14:23: ( WS )? // block 299 NSInteger alt3=2; 300 NSInteger LA3_0 = [input LA:1]; 301 302 if ( ((LA3_0 >= '\t' && LA3_0 <= '\n')||LA3_0==' ') ) { 303 alt3=1; 304 } 305 switch (alt3) { 306 case 1 : ; 307 // Fuzzy.g:14:23: WS // alt 308 { 309 [self mWS]; if ( state.failed ) return ; 310 311 312 313 } 314 break; 315 316 } 317 318 319 // Fuzzy.g:14:27: ( 'extends' WS QID ( WS )? )? // block 320 NSInteger alt5=2; 321 NSInteger LA5_0 = [input LA:1]; 322 323 if ( (LA5_0=='e') ) { 324 alt5=1; 325 } 326 switch (alt5) { 327 case 1 : ; 328 // Fuzzy.g:14:28: 'extends' WS QID ( WS )? // alt 329 { 330 [self matchString:@"extends"]; if ( state.failed ) return ; 331 332 333 334 [self mWS]; if ( state.failed ) return ; 335 336 337 338 [self mQID]; if ( state.failed ) return ; 339 340 341 342 // Fuzzy.g:14:45: ( WS )? // block 343 NSInteger alt4=2; 344 NSInteger LA4_0 = [input LA:1]; 345 346 if ( ((LA4_0 >= '\t' && LA4_0 <= '\n')||LA4_0==' ') ) { 347 alt4=1; 348 } 349 switch (alt4) { 350 case 1 : ; 351 // Fuzzy.g:14:45: WS // alt 352 { 353 [self mWS]; if ( state.failed ) return ; 354 355 356 357 } 358 break; 359 360 } 361 362 363 } 364 break; 365 366 } 367 368 369 // Fuzzy.g:15:3: ( 'implements' WS QID ( WS )? ( ',' ( WS )? QID ( WS )? )* )? // block 370 NSInteger alt10=2; 371 NSInteger LA10_0 = [input LA:1]; 372 373 if ( (LA10_0=='i') ) { 374 alt10=1; 375 } 376 switch (alt10) { 377 case 1 : ; 378 // Fuzzy.g:15:4: 'implements' WS QID ( WS )? ( ',' ( WS )? QID ( WS )? )* // alt 379 { 380 [self matchString:@"implements"]; if ( state.failed ) return ; 381 382 383 384 [self mWS]; if ( state.failed ) return ; 385 386 387 388 [self mQID]; if ( state.failed ) return ; 389 390 391 392 // Fuzzy.g:15:24: ( WS )? // block 393 NSInteger alt6=2; 394 NSInteger LA6_0 = [input LA:1]; 395 396 if ( ((LA6_0 >= '\t' && LA6_0 <= '\n')||LA6_0==' ') ) { 397 alt6=1; 398 } 399 switch (alt6) { 400 case 1 : ; 401 // Fuzzy.g:15:24: WS // alt 402 { 403 [self mWS]; if ( state.failed ) return ; 404 405 406 407 } 408 break; 409 410 } 411 412 413 do { 414 NSInteger alt9=2; 415 NSInteger LA9_0 = [input LA:1]; 416 if ( (LA9_0==',') ) { 417 alt9=1; 418 } 419 420 421 switch (alt9) { 422 case 1 : ; 423 // Fuzzy.g:15:29: ',' ( WS )? QID ( WS )? // alt 424 { 425 [self matchChar:',']; if ( state.failed ) return ; 426 427 428 // Fuzzy.g:15:33: ( WS )? // block 429 NSInteger alt7=2; 430 NSInteger LA7_0 = [input LA:1]; 431 432 if ( ((LA7_0 >= '\t' && LA7_0 <= '\n')||LA7_0==' ') ) { 433 alt7=1; 434 } 435 switch (alt7) { 436 case 1 : ; 437 // Fuzzy.g:15:33: WS // alt 438 { 439 [self mWS]; if ( state.failed ) return ; 440 441 442 443 } 444 break; 445 446 } 447 448 449 [self mQID]; if ( state.failed ) return ; 450 451 452 453 // Fuzzy.g:15:41: ( WS )? // block 454 NSInteger alt8=2; 455 NSInteger LA8_0 = [input LA:1]; 456 457 if ( ((LA8_0 >= '\t' && LA8_0 <= '\n')||LA8_0==' ') ) { 458 alt8=1; 459 } 460 switch (alt8) { 461 case 1 : ; 462 // Fuzzy.g:15:41: WS // alt 463 { 464 [self mWS]; if ( state.failed ) return ; 465 466 467 468 } 469 break; 470 471 } 472 473 474 } 475 break; 476 477 default : 478 goto loop9; 479 } 480 } while (YES); 481 loop9: ; 482 483 484 } 485 break; 486 487 } 488 489 490 [self matchChar:'{']; if ( state.failed ) return ; 491 492 493 if ( state.backtracking == 1 ) { 494 NSLog(@"found class %@", (name!=nil?name.text:nil)); 495 } 496 497 498 } 499 500 // token+rule list labels 501 502 state.type = _type; 503 state.channel = _channel; 504 } 505 @finally { 506 // 507 /* my stuff */ 508 /* Terence's stuff */ 509 510 } 511 return; 512} 513/* $ANTLR end "CLASS" */ 514 515// $ANTLR start "METHOD" 516- (void) mMETHOD 517{ 518 // 519 /* my ruleScopeSetUp */ 520 /* Terence's stuff */ 521 522 @try { 523 NSInteger _type = METHOD; 524 NSInteger _channel = ANTLRTokenChannelDefault; 525 ANTLRCommonToken *name=nil; 526 527 // Fuzzy.g:20:5: ( TYPE WS name= ID ( WS )? '(' ( ARG ( WS )? ( ',' ( WS )? ARG ( WS )? )* )? ')' ( WS )? ( 'throws' WS QID ( WS )? ( ',' ( WS )? QID ( WS )? )* )? '{' ) // ruleBlockSingleAlt 528 // Fuzzy.g:20:9: TYPE WS name= ID ( WS )? '(' ( ARG ( WS )? ( ',' ( WS )? ARG ( WS )? )* )? ')' ( WS )? ( 'throws' WS QID ( WS )? ( ',' ( WS )? QID ( WS )? )* )? '{' // alt 529 { 530 [self mTYPE]; if ( state.failed ) return ; 531 532 533 534 [self mWS]; if ( state.failed ) return ; 535 536 537 538 NSInteger nameStart158 = input.index; 539 [self mID]; if ( state.failed ) return ; 540 541 name = [[ANTLRCommonToken newToken:input Type:ANTLRTokenTypeInvalid Channel:ANTLRTokenChannelDefault Start:nameStart158 Stop:input.index-1] retain]; 542 name.line = self.line; 543 544 545 // Fuzzy.g:20:25: ( WS )? // block 546 NSInteger alt11=2; 547 NSInteger LA11_0 = [input LA:1]; 548 549 if ( ((LA11_0 >= '\t' && LA11_0 <= '\n')||LA11_0==' ') ) { 550 alt11=1; 551 } 552 switch (alt11) { 553 case 1 : ; 554 // Fuzzy.g:20:25: WS // alt 555 { 556 [self mWS]; if ( state.failed ) return ; 557 558 559 560 } 561 break; 562 563 } 564 565 566 [self matchChar:'(']; if ( state.failed ) return ; 567 568 569 // Fuzzy.g:20:33: ( ARG ( WS )? ( ',' ( WS )? ARG ( WS )? )* )? // block 570 NSInteger alt16=2; 571 NSInteger LA16_0 = [input LA:1]; 572 573 if ( ((LA16_0 >= 'A' && LA16_0 <= 'Z')||LA16_0=='_'||(LA16_0 >= 'a' && LA16_0 <= 'z')) ) { 574 alt16=1; 575 } 576 switch (alt16) { 577 case 1 : ; 578 // Fuzzy.g:20:35: ARG ( WS )? ( ',' ( WS )? ARG ( WS )? )* // alt 579 { 580 [self mARG]; if ( state.failed ) return ; 581 582 583 584 // Fuzzy.g:20:39: ( WS )? // block 585 NSInteger alt12=2; 586 NSInteger LA12_0 = [input LA:1]; 587 588 if ( ((LA12_0 >= '\t' && LA12_0 <= '\n')||LA12_0==' ') ) { 589 alt12=1; 590 } 591 switch (alt12) { 592 case 1 : ; 593 // Fuzzy.g:20:39: WS // alt 594 { 595 [self mWS]; if ( state.failed ) return ; 596 597 598 599 } 600 break; 601 602 } 603 604 605 do { 606 NSInteger alt15=2; 607 NSInteger LA15_0 = [input LA:1]; 608 if ( (LA15_0==',') ) { 609 alt15=1; 610 } 611 612 613 switch (alt15) { 614 case 1 : ; 615 // Fuzzy.g:20:44: ',' ( WS )? ARG ( WS )? // alt 616 { 617 [self matchChar:',']; if ( state.failed ) return ; 618 619 620 // Fuzzy.g:20:48: ( WS )? // block 621 NSInteger alt13=2; 622 NSInteger LA13_0 = [input LA:1]; 623 624 if ( ((LA13_0 >= '\t' && LA13_0 <= '\n')||LA13_0==' ') ) { 625 alt13=1; 626 } 627 switch (alt13) { 628 case 1 : ; 629 // Fuzzy.g:20:48: WS // alt 630 { 631 [self mWS]; if ( state.failed ) return ; 632 633 634 635 } 636 break; 637 638 } 639 640 641 [self mARG]; if ( state.failed ) return ; 642 643 644 645 // Fuzzy.g:20:56: ( WS )? // block 646 NSInteger alt14=2; 647 NSInteger LA14_0 = [input LA:1]; 648 649 if ( ((LA14_0 >= '\t' && LA14_0 <= '\n')||LA14_0==' ') ) { 650 alt14=1; 651 } 652 switch (alt14) { 653 case 1 : ; 654 // Fuzzy.g:20:56: WS // alt 655 { 656 [self mWS]; if ( state.failed ) return ; 657 658 659 660 } 661 break; 662 663 } 664 665 666 } 667 break; 668 669 default : 670 goto loop15; 671 } 672 } while (YES); 673 loop15: ; 674 675 676 } 677 break; 678 679 } 680 681 682 [self matchChar:')']; if ( state.failed ) return ; 683 684 685 // Fuzzy.g:20:69: ( WS )? // block 686 NSInteger alt17=2; 687 NSInteger LA17_0 = [input LA:1]; 688 689 if ( ((LA17_0 >= '\t' && LA17_0 <= '\n')||LA17_0==' ') ) { 690 alt17=1; 691 } 692 switch (alt17) { 693 case 1 : ; 694 // Fuzzy.g:20:69: WS // alt 695 { 696 [self mWS]; if ( state.failed ) return ; 697 698 699 700 } 701 break; 702 703 } 704 705 706 // Fuzzy.g:21:8: ( 'throws' WS QID ( WS )? ( ',' ( WS )? QID ( WS )? )* )? // block 707 NSInteger alt22=2; 708 NSInteger LA22_0 = [input LA:1]; 709 710 if ( (LA22_0=='t') ) { 711 alt22=1; 712 } 713 switch (alt22) { 714 case 1 : ; 715 // Fuzzy.g:21:9: 'throws' WS QID ( WS )? ( ',' ( WS )? QID ( WS )? )* // alt 716 { 717 [self matchString:@"throws"]; if ( state.failed ) return ; 718 719 720 721 [self mWS]; if ( state.failed ) return ; 722 723 724 725 [self mQID]; if ( state.failed ) return ; 726 727 728 729 // Fuzzy.g:21:25: ( WS )? // block 730 NSInteger alt18=2; 731 NSInteger LA18_0 = [input LA:1]; 732 733 if ( ((LA18_0 >= '\t' && LA18_0 <= '\n')||LA18_0==' ') ) { 734 alt18=1; 735 } 736 switch (alt18) { 737 case 1 : ; 738 // Fuzzy.g:21:25: WS // alt 739 { 740 [self mWS]; if ( state.failed ) return ; 741 742 743 744 } 745 break; 746 747 } 748 749 750 do { 751 NSInteger alt21=2; 752 NSInteger LA21_0 = [input LA:1]; 753 if ( (LA21_0==',') ) { 754 alt21=1; 755 } 756 757 758 switch (alt21) { 759 case 1 : ; 760 // Fuzzy.g:21:30: ',' ( WS )? QID ( WS )? // alt 761 { 762 [self matchChar:',']; if ( state.failed ) return ; 763 764 765 // Fuzzy.g:21:34: ( WS )? // block 766 NSInteger alt19=2; 767 NSInteger LA19_0 = [input LA:1]; 768 769 if ( ((LA19_0 >= '\t' && LA19_0 <= '\n')||LA19_0==' ') ) { 770 alt19=1; 771 } 772 switch (alt19) { 773 case 1 : ; 774 // Fuzzy.g:21:34: WS // alt 775 { 776 [self mWS]; if ( state.failed ) return ; 777 778 779 780 } 781 break; 782 783 } 784 785 786 [self mQID]; if ( state.failed ) return ; 787 788 789 790 // Fuzzy.g:21:42: ( WS )? // block 791 NSInteger alt20=2; 792 NSInteger LA20_0 = [input LA:1]; 793 794 if ( ((LA20_0 >= '\t' && LA20_0 <= '\n')||LA20_0==' ') ) { 795 alt20=1; 796 } 797 switch (alt20) { 798 case 1 : ; 799 // Fuzzy.g:21:42: WS // alt 800 { 801 [self mWS]; if ( state.failed ) return ; 802 803 804 805 } 806 break; 807 808 } 809 810 811 } 812 break; 813 814 default : 815 goto loop21; 816 } 817 } while (YES); 818 loop21: ; 819 820 821 } 822 break; 823 824 } 825 826 827 [self matchChar:'{']; if ( state.failed ) return ; 828 829 830 if ( state.backtracking == 1 ) { 831 NSLog(@"found method %@", (name!=nil?name.text:nil)); 832 } 833 834 835 } 836 837 // token+rule list labels 838 839 state.type = _type; 840 state.channel = _channel; 841 } 842 @finally { 843 // 844 /* my stuff */ 845 /* Terence's stuff */ 846 847 } 848 return; 849} 850/* $ANTLR end "METHOD" */ 851 852// $ANTLR start "FIELD" 853- (void) mFIELD 854{ 855 // 856 /* my ruleScopeSetUp */ 857 /* Terence's stuff */ 858 859 @try { 860 NSInteger _type = FIELD; 861 NSInteger _channel = ANTLRTokenChannelDefault; 862 ANTLRCommonToken *name=nil; 863 864 // Fuzzy.g:26:5: ( TYPE WS name= ID ( '[]' )? ( WS )? ( ';' | '=' ) ) // ruleBlockSingleAlt 865 // Fuzzy.g:26:9: TYPE WS name= ID ( '[]' )? ( WS )? ( ';' | '=' ) // alt 866 { 867 [self mTYPE]; if ( state.failed ) return ; 868 869 870 871 [self mWS]; if ( state.failed ) return ; 872 873 874 875 NSInteger nameStart261 = input.index; 876 [self mID]; if ( state.failed ) return ; 877 878 name = [[ANTLRCommonToken newToken:input Type:ANTLRTokenTypeInvalid Channel:ANTLRTokenChannelDefault Start:nameStart261 Stop:input.index-1] retain]; 879 name.line = self.line; 880 881 882 // Fuzzy.g:26:25: ( '[]' )? // block 883 NSInteger alt23=2; 884 NSInteger LA23_0 = [input LA:1]; 885 886 if ( (LA23_0=='[') ) { 887 alt23=1; 888 } 889 switch (alt23) { 890 case 1 : ; 891 // Fuzzy.g:26:25: '[]' // alt 892 { 893 [self matchString:@"[]"]; if ( state.failed ) return ; 894 895 896 897 } 898 break; 899 900 } 901 902 903 // Fuzzy.g:26:31: ( WS )? // block 904 NSInteger alt24=2; 905 NSInteger LA24_0 = [input LA:1]; 906 907 if ( ((LA24_0 >= '\t' && LA24_0 <= '\n')||LA24_0==' ') ) { 908 alt24=1; 909 } 910 switch (alt24) { 911 case 1 : ; 912 // Fuzzy.g:26:31: WS // alt 913 { 914 [self mWS]; if ( state.failed ) return ; 915 916 917 918 } 919 break; 920 921 } 922 923 924 if ([input LA:1] == ';'||[input LA:1] == '=') { 925 [input consume]; 926 state.failed = NO; 927 928 } else { 929 if ( state.backtracking > 0 ) { state.failed = YES; return ; } 930 931 ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException newException:nil stream:input]; 932 [self recover:mse]; 933 @throw mse; 934 } 935 936 937 if ( state.backtracking == 1 ) { 938 NSLog(@"found var %@", (name!=nil?name.text:nil)); 939 } 940 941 942 } 943 944 // token+rule list labels 945 946 state.type = _type; 947 state.channel = _channel; 948 } 949 @finally { 950 // 951 /* my stuff */ 952 /* Terence's stuff */ 953 954 } 955 return; 956} 957/* $ANTLR end "FIELD" */ 958 959// $ANTLR start "STAT" 960- (void) mSTAT 961{ 962 // 963 /* my ruleScopeSetUp */ 964 /* Terence's stuff */ 965 966 @try { 967 NSInteger _type = STAT; 968 NSInteger _channel = ANTLRTokenChannelDefault; 969 // Fuzzy.g:30:5: ( ( 'if' | 'while' | 'switch' | 'for' ) ( WS )? '(' ) // ruleBlockSingleAlt 970 // Fuzzy.g:30:7: ( 'if' | 'while' | 'switch' | 'for' ) ( WS )? '(' // alt 971 { 972 // Fuzzy.g:30:7: ( 'if' | 'while' | 'switch' | 'for' ) // block 973 NSInteger alt25=4; 974 unichar charLA25 = [input LA:1]; 975 switch (charLA25) { 976 case 'i': ; 977 { 978 alt25=1; 979 } 980 break; 981 case 'w': ; 982 { 983 alt25=2; 984 } 985 break; 986 case 's': ; 987 { 988 alt25=3; 989 } 990 break; 991 case 'f': ; 992 { 993 alt25=4; 994 } 995 break; 996 997 default: ; 998 if ( state.backtracking > 0 ) { state.failed = YES; return ; } 999 1000 ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:25 state:0 stream:input]; 1001 nvae.c = charLA25; 1002 @throw nvae; 1003 1004 } 1005 1006 switch (alt25) { 1007 case 1 : ; 1008 // Fuzzy.g:30:8: 'if' // alt 1009 { 1010 [self matchString:@"if"]; if ( state.failed ) return ; 1011 1012 1013 1014 } 1015 break; 1016 case 2 : ; 1017 // Fuzzy.g:30:13: 'while' // alt 1018 { 1019 [self matchString:@"while"]; if ( state.failed ) return ; 1020 1021 1022 1023 } 1024 break; 1025 case 3 : ; 1026 // Fuzzy.g:30:21: 'switch' // alt 1027 { 1028 [self matchString:@"switch"]; if ( state.failed ) return ; 1029 1030 1031 1032 } 1033 break; 1034 case 4 : ; 1035 // Fuzzy.g:30:30: 'for' // alt 1036 { 1037 [self matchString:@"for"]; if ( state.failed ) return ; 1038 1039 1040 1041 } 1042 break; 1043 1044 } 1045 1046 1047 // Fuzzy.g:30:37: ( WS )? // block 1048 NSInteger alt26=2; 1049 NSInteger LA26_0 = [input LA:1]; 1050 1051 if ( ((LA26_0 >= '\t' && LA26_0 <= '\n')||LA26_0==' ') ) { 1052 alt26=1; 1053 } 1054 switch (alt26) { 1055 case 1 : ; 1056 // Fuzzy.g:30:37: WS // alt 1057 { 1058 [self mWS]; if ( state.failed ) return ; 1059 1060 1061 1062 } 1063 break; 1064 1065 } 1066 1067 1068 [self matchChar:'(']; if ( state.failed ) return ; 1069 1070 1071 } 1072 1073 // token+rule list labels 1074 1075 state.type = _type; 1076 state.channel = _channel; 1077 } 1078 @finally { 1079 // 1080 /* my stuff */ 1081 /* Terence's stuff */ 1082 1083 } 1084 return; 1085} 1086/* $ANTLR end "STAT" */ 1087 1088// $ANTLR start "CALL" 1089- (void) mCALL 1090{ 1091 // 1092 /* my ruleScopeSetUp */ 1093 /* Terence's stuff */ 1094 1095 @try { 1096 NSInteger _type = CALL; 1097 NSInteger _channel = ANTLRTokenChannelDefault; 1098 ANTLRCommonToken *name=nil; 1099 1100 // Fuzzy.g:33:5: (name= QID ( WS )? '(' ) // ruleBlockSingleAlt 1101 // Fuzzy.g:33:9: name= QID ( WS )? '(' // alt 1102 { 1103 NSInteger nameStart326 = input.index; 1104 [self mQID]; if ( state.failed ) return ; 1105 1106 name = [[ANTLRCommonToken newToken:input Type:ANTLRTokenTypeInvalid Channel:ANTLRTokenChannelDefault Start:nameStart326 Stop:input.index-1] retain]; 1107 name.line = self.line; 1108 1109 1110 // Fuzzy.g:33:18: ( WS )? // block 1111 NSInteger alt27=2; 1112 NSInteger LA27_0 = [input LA:1]; 1113 1114 if ( ((LA27_0 >= '\t' && LA27_0 <= '\n')||LA27_0==' ') ) { 1115 alt27=1; 1116 } 1117 switch (alt27) { 1118 case 1 : ; 1119 // Fuzzy.g:33:18: WS // alt 1120 { 1121 [self mWS]; if ( state.failed ) return ; 1122 1123 1124 1125 } 1126 break; 1127 1128 } 1129 1130 1131 [self matchChar:'(']; if ( state.failed ) return ; 1132 1133 1134 if ( state.backtracking == 1 ) { 1135 /*ignore if this/super */ NSLog(@"found call %@",(name!=nil?name.text:nil)); 1136 } 1137 1138 1139 } 1140 1141 // token+rule list labels 1142 1143 state.type = _type; 1144 state.channel = _channel; 1145 } 1146 @finally { 1147 // 1148 /* my stuff */ 1149 /* Terence's stuff */ 1150 1151 } 1152 return; 1153} 1154/* $ANTLR end "CALL" */ 1155 1156// $ANTLR start "COMMENT" 1157- (void) mCOMMENT 1158{ 1159 // 1160 /* my ruleScopeSetUp */ 1161 /* Terence's stuff */ 1162 1163 @try { 1164 NSInteger _type = COMMENT; 1165 NSInteger _channel = ANTLRTokenChannelDefault; 1166 // Fuzzy.g:38:5: ( '/*' ( options {greedy=false; } : . )* '*/' ) // ruleBlockSingleAlt 1167 // Fuzzy.g:38:9: '/*' ( options {greedy=false; } : . )* '*/' // alt 1168 { 1169 [self matchString:@"/*"]; if ( state.failed ) return ; 1170 1171 1172 1173 do { 1174 NSInteger alt28=2; 1175 NSInteger LA28_0 = [input LA:1]; 1176 if ( (LA28_0=='*') ) { 1177 NSInteger LA28_1 = [input LA:2]; 1178 if ( (LA28_1=='/') ) { 1179 alt28=2; 1180 } 1181 else if ( ((LA28_1 >= 0x0000 && LA28_1 <= '.')||(LA28_1 >= '0' && LA28_1 <= 0xFFFF)) ) { 1182 alt28=1; 1183 } 1184 1185 1186 } 1187 else if ( ((LA28_0 >= 0x0000 && LA28_0 <= ')')||(LA28_0 >= '+' && LA28_0 <= 0xFFFF)) ) { 1188 alt28=1; 1189 } 1190 1191 1192 switch (alt28) { 1193 case 1 : ; 1194 // Fuzzy.g:38:41: . // alt 1195 { 1196 [self matchAny]; if ( state.failed ) return ; 1197 1198 1199 } 1200 break; 1201 1202 default : 1203 goto loop28; 1204 } 1205 } while (YES); 1206 loop28: ; 1207 1208 1209 [self matchString:@"*/"]; if ( state.failed ) return ; 1210 1211 1212 1213 if ( state.backtracking == 1 ) { 1214 NSLog(@"found comment %@", [self text]); 1215 } 1216 1217 1218 } 1219 1220 // token+rule list labels 1221 1222 state.type = _type; 1223 state.channel = _channel; 1224 } 1225 @finally { 1226 // 1227 /* my stuff */ 1228 /* Terence's stuff */ 1229 1230 } 1231 return; 1232} 1233/* $ANTLR end "COMMENT" */ 1234 1235// $ANTLR start "SL_COMMENT" 1236- (void) mSL_COMMENT 1237{ 1238 // 1239 /* my ruleScopeSetUp */ 1240 /* Terence's stuff */ 1241 1242 @try { 1243 NSInteger _type = SL_COMMENT; 1244 NSInteger _channel = ANTLRTokenChannelDefault; 1245 // Fuzzy.g:43:5: ( '//' ( options {greedy=false; } : . )* '\\n' ) // ruleBlockSingleAlt 1246 // Fuzzy.g:43:9: '//' ( options {greedy=false; } : . )* '\\n' // alt 1247 { 1248 [self matchString:@"//"]; if ( state.failed ) return ; 1249 1250 1251 1252 do { 1253 NSInteger alt29=2; 1254 NSInteger LA29_0 = [input LA:1]; 1255 if ( (LA29_0=='\n') ) { 1256 alt29=2; 1257 } 1258 else if ( ((LA29_0 >= 0x0000 && LA29_0 <= '\t')||(LA29_0 >= 0x000B && LA29_0 <= 0xFFFF)) ) { 1259 alt29=1; 1260 } 1261 1262 1263 switch (alt29) { 1264 case 1 : ; 1265 // Fuzzy.g:43:41: . // alt 1266 { 1267 [self matchAny]; if ( state.failed ) return ; 1268 1269 1270 } 1271 break; 1272 1273 default : 1274 goto loop29; 1275 } 1276 } while (YES); 1277 loop29: ; 1278 1279 1280 [self matchChar:'\n']; if ( state.failed ) return ; 1281 1282 1283 if ( state.backtracking == 1 ) { 1284 NSLog(@"found // comment %@", [self text]); 1285 } 1286 1287 1288 } 1289 1290 // token+rule list labels 1291 1292 state.type = _type; 1293 state.channel = _channel; 1294 } 1295 @finally { 1296 // 1297 /* my stuff */ 1298 /* Terence's stuff */ 1299 1300 } 1301 return; 1302} 1303/* $ANTLR end "SL_COMMENT" */ 1304 1305// $ANTLR start "STRING" 1306- (void) mSTRING 1307{ 1308 // 1309 /* my ruleScopeSetUp */ 1310 /* Terence's stuff */ 1311 1312 @try { 1313 NSInteger _type = STRING; 1314 NSInteger _channel = ANTLRTokenChannelDefault; 1315 // Fuzzy.g:48:2: ( '\"' ( options {greedy=false; } : ESC | . )* '\"' ) // ruleBlockSingleAlt 1316 // Fuzzy.g:48:4: '\"' ( options {greedy=false; } : ESC | . )* '\"' // alt 1317 { 1318 [self matchChar:'"']; if ( state.failed ) return ; 1319 1320 1321 do { 1322 NSInteger alt30=3; 1323 NSInteger LA30_0 = [input LA:1]; 1324 if ( (LA30_0=='"') ) { 1325 alt30=3; 1326 } 1327 else if ( (LA30_0=='\\') ) { 1328 NSInteger LA30_2 = [input LA:2]; 1329 if ( (LA30_2=='"') ) { 1330 alt30=1; 1331 } 1332 else if ( (LA30_2=='\\') ) { 1333 alt30=1; 1334 } 1335 else if ( (LA30_2=='\'') ) { 1336 alt30=1; 1337 } 1338 else if ( ((LA30_2 >= 0x0000 && LA30_2 <= '!')||(LA30_2 >= '#' && LA30_2 <= '&')||(LA30_2 >= '(' && LA30_2 <= '[')||(LA30_2 >= ']' && LA30_2 <= 0xFFFF)) ) { 1339 alt30=2; 1340 } 1341 1342 1343 } 1344 else if ( ((LA30_0 >= 0x0000 && LA30_0 <= '!')||(LA30_0 >= '#' && LA30_0 <= '[')||(LA30_0 >= ']' && LA30_0 <= 0xFFFF)) ) { 1345 alt30=2; 1346 } 1347 1348 1349 switch (alt30) { 1350 case 1 : ; 1351 // Fuzzy.g:48:34: ESC // alt 1352 { 1353 [self mESC]; if ( state.failed ) return ; 1354 1355 1356 1357 } 1358 break; 1359 case 2 : ; 1360 // Fuzzy.g:48:40: . // alt 1361 { 1362 [self matchAny]; if ( state.failed ) return ; 1363 1364 1365 } 1366 break; 1367 1368 default : 1369 goto loop30; 1370 } 1371 } while (YES); 1372 loop30: ; 1373 1374 1375 [self matchChar:'"']; if ( state.failed ) return ; 1376 1377 1378 } 1379 1380 // token+rule list labels 1381 1382 state.type = _type; 1383 state.channel = _channel; 1384 } 1385 @finally { 1386 // 1387 /* my stuff */ 1388 /* Terence's stuff */ 1389 1390 } 1391 return; 1392} 1393/* $ANTLR end "STRING" */ 1394 1395// $ANTLR start "CHAR" 1396- (void) mCHAR 1397{ 1398 // 1399 /* my ruleScopeSetUp */ 1400 /* Terence's stuff */ 1401 1402 @try { 1403 NSInteger _type = CHAR; 1404 NSInteger _channel = ANTLRTokenChannelDefault; 1405 // Fuzzy.g:52:2: ( '\\'' ( options {greedy=false; } : ESC | . )* '\\'' ) // ruleBlockSingleAlt 1406 // Fuzzy.g:52:4: '\\'' ( options {greedy=false; } : ESC | . )* '\\'' // alt 1407 { 1408 [self matchChar:'\'']; if ( state.failed ) return ; 1409 1410 1411 do { 1412 NSInteger alt31=3; 1413 NSInteger LA31_0 = [input LA:1]; 1414 if ( (LA31_0=='\'') ) { 1415 alt31=3; 1416 } 1417 else if ( (LA31_0=='\\') ) { 1418 NSInteger LA31_2 = [input LA:2]; 1419 if ( (LA31_2=='\'') ) { 1420 alt31=1; 1421 } 1422 else if ( (LA31_2=='\\') ) { 1423 alt31=1; 1424 } 1425 else if ( (LA31_2=='"') ) { 1426 alt31=1; 1427 } 1428 else if ( ((LA31_2 >= 0x0000 && LA31_2 <= '!')||(LA31_2 >= '#' && LA31_2 <= '&')||(LA31_2 >= '(' && LA31_2 <= '[')||(LA31_2 >= ']' && LA31_2 <= 0xFFFF)) ) { 1429 alt31=2; 1430 } 1431 1432 1433 } 1434 else if ( ((LA31_0 >= 0x0000 && LA31_0 <= '&')||(LA31_0 >= '(' && LA31_0 <= '[')||(LA31_0 >= ']' && LA31_0 <= 0xFFFF)) ) { 1435 alt31=2; 1436 } 1437 1438 1439 switch (alt31) { 1440 case 1 : ; 1441 // Fuzzy.g:52:35: ESC // alt 1442 { 1443 [self mESC]; if ( state.failed ) return ; 1444 1445 1446 1447 } 1448 break; 1449 case 2 : ; 1450 // Fuzzy.g:52:41: . // alt 1451 { 1452 [self matchAny]; if ( state.failed ) return ; 1453 1454 1455 } 1456 break; 1457 1458 default : 1459 goto loop31; 1460 } 1461 } while (YES); 1462 loop31: ; 1463 1464 1465 [self matchChar:'\'']; if ( state.failed ) return ; 1466 1467 1468 } 1469 1470 // token+rule list labels 1471 1472 state.type = _type; 1473 state.channel = _channel; 1474 } 1475 @finally { 1476 // 1477 /* my stuff */ 1478 /* Terence's stuff */ 1479 1480 } 1481 return; 1482} 1483/* $ANTLR end "CHAR" */ 1484 1485// $ANTLR start "WS" 1486- (void) mWS 1487{ 1488 // 1489 /* my ruleScopeSetUp */ 1490 /* Terence's stuff */ 1491 1492 @try { 1493 NSInteger _type = WS; 1494 NSInteger _channel = ANTLRTokenChannelDefault; 1495 // Fuzzy.g:55:5: ( ( ' ' | '\\t' | '\\n' )+ ) // ruleBlockSingleAlt 1496 // Fuzzy.g:55:9: ( ' ' | '\\t' | '\\n' )+ // alt 1497 { 1498 // Fuzzy.g:55:9: ( ' ' | '\\t' | '\\n' )+ // positiveClosureBlock 1499 NSInteger cnt32 = 0; 1500 do { 1501 NSInteger alt32 = 2; 1502 NSInteger LA32_0 = [input LA:1]; 1503 if ( ((LA32_0 >= '\t' && LA32_0 <= '\n')||LA32_0==' ') ) { 1504 alt32=1; 1505 } 1506 1507 1508 switch (alt32) { 1509 case 1 : ; 1510 // Fuzzy.g: // alt 1511 { 1512 if ((([input LA:1] >= '\t') && ([input LA:1] <= '\n'))||[input LA:1] == ' ') { 1513 [input consume]; 1514 state.failed = NO; 1515 1516 } else { 1517 if ( state.backtracking > 0 ) { state.failed = YES; return ; } 1518 1519 ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException newException:nil stream:input]; 1520 [self recover:mse]; 1521 @throw mse; 1522 } 1523 1524 1525 } 1526 break; 1527 1528 default : 1529 if ( cnt32 >= 1 ) 1530 goto loop32; 1531 if ( state.backtracking > 0 ) { state.failed = YES; return ; } 1532 1533 ANTLREarlyExitException *eee = 1534 [ANTLREarlyExitException newException:input decisionNumber:32]; 1535 @throw eee; 1536 } 1537 cnt32++; 1538 } while (YES); 1539 loop32: ; 1540 1541 1542 } 1543 1544 // token+rule list labels 1545 1546 state.type = _type; 1547 state.channel = _channel; 1548 } 1549 @finally { 1550 // 1551 /* my stuff */ 1552 /* Terence's stuff */ 1553 1554 } 1555 return; 1556} 1557/* $ANTLR end "WS" */ 1558 1559// $ANTLR start "QID" 1560- (void) mQID 1561{ 1562 // 1563 /* my ruleScopeSetUp */ 1564 /* Terence's stuff */ 1565 1566 @try { 1567 // Fuzzy.g:59:5: ( ID ( '.' ID )* ) // ruleBlockSingleAlt 1568 // Fuzzy.g:59:7: ID ( '.' ID )* // alt 1569 { 1570 [self mID]; if ( state.failed ) return ; 1571 1572 1573 1574 do { 1575 NSInteger alt33=2; 1576 NSInteger LA33_0 = [input LA:1]; 1577 if ( (LA33_0=='.') ) { 1578 alt33=1; 1579 } 1580 1581 1582 switch (alt33) { 1583 case 1 : ; 1584 // Fuzzy.g:59:11: '.' ID // alt 1585 { 1586 [self matchChar:'.']; if ( state.failed ) return ; 1587 1588 1589 [self mID]; if ( state.failed ) return ; 1590 1591 1592 1593 } 1594 break; 1595 1596 default : 1597 goto loop33; 1598 } 1599 } while (YES); 1600 loop33: ; 1601 1602 1603 } 1604 1605 1606 } 1607 @finally { 1608 // 1609 /* my stuff */ 1610 /* Terence's stuff */ 1611 1612 } 1613 return; 1614} 1615/* $ANTLR end "QID" */ 1616 1617// $ANTLR start "QIDStar" 1618- (void) mQIDStar 1619{ 1620 // 1621 /* my ruleScopeSetUp */ 1622 /* Terence's stuff */ 1623 1624 @try { 1625 // Fuzzy.g:68:2: ( ID ( '.' ID )* ( '.*' )? ) // ruleBlockSingleAlt 1626 // Fuzzy.g:68:4: ID ( '.' ID )* ( '.*' )? // alt 1627 { 1628 [self mID]; if ( state.failed ) return ; 1629 1630 1631 1632 do { 1633 NSInteger alt34=2; 1634 NSInteger LA34_0 = [input LA:1]; 1635 if ( (LA34_0=='.') ) { 1636 NSInteger LA34_1 = [input LA:2]; 1637 if ( ((LA34_1 >= 'A' && LA34_1 <= 'Z')||LA34_1=='_'||(LA34_1 >= 'a' && LA34_1 <= 'z')) ) { 1638 alt34=1; 1639 } 1640 1641 1642 } 1643 1644 1645 switch (alt34) { 1646 case 1 : ; 1647 // Fuzzy.g:68:8: '.' ID // alt 1648 { 1649 [self matchChar:'.']; if ( state.failed ) return ; 1650 1651 1652 [self mID]; if ( state.failed ) return ; 1653 1654 1655 1656 } 1657 break; 1658 1659 default : 1660 goto loop34; 1661 } 1662 } while (YES); 1663 loop34: ; 1664 1665 1666 // Fuzzy.g:68:17: ( '.*' )? // block 1667 NSInteger alt35=2; 1668 NSInteger LA35_0 = [input LA:1]; 1669 1670 if ( (LA35_0=='.') ) { 1671 alt35=1; 1672 } 1673 switch (alt35) { 1674 case 1 : ; 1675 // Fuzzy.g:68:17: '.*' // alt 1676 { 1677 [self matchString:@".*"]; if ( state.failed ) return ; 1678 1679 1680 1681 } 1682 break; 1683 1684 } 1685 1686 1687 } 1688 1689 1690 } 1691 @finally { 1692 // 1693 /* my stuff */ 1694 /* Terence's stuff */ 1695 1696 } 1697 return; 1698} 1699/* $ANTLR end "QIDStar" */ 1700 1701// $ANTLR start "TYPE" 1702- (void) mTYPE 1703{ 1704 // 1705 /* my ruleScopeSetUp */ 1706 /* Terence's stuff */ 1707 1708 @try { 1709 // Fuzzy.g:72:5: ( QID ( '[]' )? ) // ruleBlockSingleAlt 1710 // Fuzzy.g:72:9: QID ( '[]' )? // alt 1711 { 1712 [self mQID]; if ( state.failed ) return ; 1713 1714 1715 1716 // Fuzzy.g:72:13: ( '[]' )? // block 1717 NSInteger alt36=2; 1718 NSInteger LA36_0 = [input LA:1]; 1719 1720 if ( (LA36_0=='[') ) { 1721 alt36=1; 1722 } 1723 switch (alt36) { 1724 case 1 : ; 1725 // Fuzzy.g:72:13: '[]' // alt 1726 { 1727 [self matchString:@"[]"]; if ( state.failed ) return ; 1728 1729 1730 1731 } 1732 break; 1733 1734 } 1735 1736 1737 } 1738 1739 1740 } 1741 @finally { 1742 // 1743 /* my stuff */ 1744 /* Terence's stuff */ 1745 1746 } 1747 return; 1748} 1749/* $ANTLR end "TYPE" */ 1750 1751// $ANTLR start "ARG" 1752- (void) mARG 1753{ 1754 // 1755 /* my ruleScopeSetUp */ 1756 /* Terence's stuff */ 1757 1758 @try { 1759 // Fuzzy.g:76:5: ( TYPE WS ID ) // ruleBlockSingleAlt 1760 // Fuzzy.g:76:9: TYPE WS ID // alt 1761 { 1762 [self mTYPE]; if ( state.failed ) return ; 1763 1764 1765 1766 [self mWS]; if ( state.failed ) return ; 1767 1768 1769 1770 [self mID]; if ( state.failed ) return ; 1771 1772 1773 1774 } 1775 1776 1777 } 1778 @finally { 1779 // 1780 /* my stuff */ 1781 /* Terence's stuff */ 1782 1783 } 1784 return; 1785} 1786/* $ANTLR end "ARG" */ 1787 1788// $ANTLR start "ID" 1789- (void) mID 1790{ 1791 // 1792 /* my ruleScopeSetUp */ 1793 /* Terence's stuff */ 1794 1795 @try { 1796 // Fuzzy.g:80:5: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* ) // ruleBlockSingleAlt 1797 // Fuzzy.g:80:9: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* // alt 1798 { 1799 if ((([input LA:1] >= 'A') && ([input LA:1] <= 'Z'))||[input LA:1] == '_'||(([input LA:1] >= 'a') && ([input LA:1] <= 'z'))) { 1800 [input consume]; 1801 state.failed = NO; 1802 1803 } else { 1804 if ( state.backtracking > 0 ) { state.failed = YES; return ; } 1805 1806 ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException newException:nil stream:input]; 1807 [self recover:mse]; 1808 @throw mse; 1809 } 1810 1811 1812 do { 1813 NSInteger alt37=2; 1814 NSInteger LA37_0 = [input LA:1]; 1815 if ( ((LA37_0 >= '0' && LA37_0 <= '9')||(LA37_0 >= 'A' && LA37_0 <= 'Z')||LA37_0=='_'||(LA37_0 >= 'a' && LA37_0 <= 'z')) ) { 1816 alt37=1; 1817 } 1818 1819 1820 switch (alt37) { 1821 case 1 : ; 1822 // Fuzzy.g: // alt 1823 { 1824 if ((([input LA:1] >= '0') && ([input LA:1] <= '9'))||(([input LA:1] >= 'A') && ([input LA:1] <= 'Z'))||[input LA:1] == '_'||(([input LA:1] >= 'a') && ([input LA:1] <= 'z'))) { 1825 [input consume]; 1826 state.failed = NO; 1827 1828 } else { 1829 if ( state.backtracking > 0 ) { state.failed = YES; return ; } 1830 1831 ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException newException:nil stream:input]; 1832 [self recover:mse]; 1833 @throw mse; 1834 } 1835 1836 1837 } 1838 break; 1839 1840 default : 1841 goto loop37; 1842 } 1843 } while (YES); 1844 loop37: ; 1845 1846 1847 } 1848 1849 1850 } 1851 @finally { 1852 // 1853 /* my stuff */ 1854 /* Terence's stuff */ 1855 1856 } 1857 return; 1858} 1859/* $ANTLR end "ID" */ 1860 1861// $ANTLR start "ESC" 1862- (void) mESC 1863{ 1864 // 1865 /* my ruleScopeSetUp */ 1866 /* Terence's stuff */ 1867 1868 @try { 1869 // Fuzzy.g:84:5: ( '\\\\' ( '\"' | '\\'' | '\\\\' ) ) // ruleBlockSingleAlt 1870 // Fuzzy.g:84:7: '\\\\' ( '\"' | '\\'' | '\\\\' ) // alt 1871 { 1872 [self matchChar:'\\']; if ( state.failed ) return ; 1873 1874 1875 if ([input LA:1] == '"'||[input LA:1] == '\''||[input LA:1] == '\\') { 1876 [input consume]; 1877 state.failed = NO; 1878 1879 } else { 1880 if ( state.backtracking > 0 ) { state.failed = YES; return ; } 1881 1882 ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException newException:nil stream:input]; 1883 [self recover:mse]; 1884 @throw mse; 1885 } 1886 1887 1888 } 1889 1890 1891 } 1892 @finally { 1893 // 1894 /* my stuff */ 1895 /* Terence's stuff */ 1896 1897 } 1898 return; 1899} 1900/* $ANTLR end "ESC" */ 1901 1902- (void) mTokens 1903{ 1904 // Fuzzy.g:1:39: ( IMPORT | RETURN | CLASS | METHOD | FIELD | STAT | CALL | COMMENT | SL_COMMENT | STRING | CHAR | WS ) //ruleblock 1905 NSInteger alt38=12; 1906 unichar charLA38 = [input LA:1]; 1907 switch (charLA38) { 1908 case 'i': ; 1909 { 1910 NSInteger LA38_1 = [input LA:2]; 1911 1912 if ( ([self evaluateSyntacticPredicate:@selector(synpred1_Fuzzy_fragment)]) ) { 1913 alt38=1; 1914 } 1915 else if ( ([self evaluateSyntacticPredicate:@selector(synpred4_Fuzzy_fragment)]) ) { 1916 alt38=4; 1917 } 1918 else if ( ([self evaluateSyntacticPredicate:@selector(synpred5_Fuzzy_fragment)]) ) { 1919 alt38=5; 1920 } 1921 else if ( ([self evaluateSyntacticPredicate:@selector(synpred6_Fuzzy_fragment)]) ) { 1922 alt38=6; 1923 } 1924 else if ( ([self evaluateSyntacticPredicate:@selector(synpred7_Fuzzy_fragment)]) ) { 1925 alt38=7; 1926 } 1927 else { 1928 if ( state.backtracking > 0 ) { state.failed = YES; return ; } 1929 1930 ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:38 state:1 stream:input]; 1931 nvae.c = LA38_1; 1932 @throw nvae; 1933 1934 } 1935 } 1936 break; 1937 case 'r': ; 1938 { 1939 NSInteger LA38_7 = [input LA:2]; 1940 1941 if ( ([self evaluateSyntacticPredicate:@selector(synpred2_Fuzzy_fragment)]) ) { 1942 alt38=2; 1943 } 1944 else if ( ([self evaluateSyntacticPredicate:@selector(synpred4_Fuzzy_fragment)]) ) { 1945 alt38=4; 1946 } 1947 else if ( ([self evaluateSyntacticPredicate:@selector(synpred5_Fuzzy_fragment)]) ) { 1948 alt38=5; 1949 } 1950 else if ( ([self evaluateSyntacticPredicate:@selector(synpred7_Fuzzy_fragment)]) ) { 1951 alt38=7; 1952 } 1953 else { 1954 if ( state.backtracking > 0 ) { state.failed = YES; return ; } 1955 1956 ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:38 state:7 stream:input]; 1957 nvae.c = LA38_7; 1958 @throw nvae; 1959 1960 } 1961 } 1962 break; 1963 case 'c': ; 1964 { 1965 NSInteger LA38_9 = [input LA:2]; 1966 1967 if ( ([self evaluateSyntacticPredicate:@selector(synpred3_Fuzzy_fragment)]) ) { 1968 alt38=3; 1969 } 1970 else if ( ([self evaluateSyntacticPredicate:@selector(synpred4_Fuzzy_fragment)]) ) { 1971 alt38=4; 1972 } 1973 else if ( ([self evaluateSyntacticPredicate:@selector(synpred5_Fuzzy_fragment)]) ) { 1974 alt38=5; 1975 } 1976 else if ( ([self evaluateSyntacticPredicate:@selector(synpred7_Fuzzy_fragment)]) ) { 1977 alt38=7; 1978 } 1979 else { 1980 if ( state.backtracking > 0 ) { state.failed = YES; return ; } 1981 1982 ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:38 state:9 stream:input]; 1983 nvae.c = LA38_9; 1984 @throw nvae; 1985 1986 } 1987 } 1988 break; 1989 case 'f': ; 1990 case 's': ; 1991 case 'w': ; 1992 { 1993 NSInteger LA38_11 = [input LA:2]; 1994 1995 if ( ([self evaluateSyntacticPredicate:@selector(synpred4_Fuzzy_fragment)]) ) { 1996 alt38=4; 1997 } 1998 else if ( ([self evaluateSyntacticPredicate:@selector(synpred5_Fuzzy_fragment)]) ) { 1999 alt38=5; 2000 } 2001 else if ( ([self evaluateSyntacticPredicate:@selector(synpred6_Fuzzy_fragment)]) ) { 2002 alt38=6; 2003 } 2004 else if ( ([self evaluateSyntacticPredicate:@selector(synpred7_Fuzzy_fragment)]) ) { 2005 alt38=7; 2006 } 2007 else { 2008 if ( state.backtracking > 0 ) { state.failed = YES; return ; } 2009 2010 ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:38 state:11 stream:input]; 2011 nvae.c = LA38_11; 2012 @throw nvae; 2013 2014 } 2015 } 2016 break; 2017 case 'A': ; 2018 case 'B': ; 2019 case 'C': ; 2020 case 'D': ; 2021 case 'E': ; 2022 case 'F': ; 2023 case 'G': ; 2024 case 'H': ; 2025 case 'I': ; 2026 case 'J': ; 2027 case 'K': ; 2028 case 'L': ; 2029 case 'M': ; 2030 case 'N': ; 2031 case 'O': ; 2032 case 'P': ; 2033 case 'Q': ; 2034 case 'R': ; 2035 case 'S': ; 2036 case 'T': ; 2037 case 'U': ; 2038 case 'V': ; 2039 case 'W': ; 2040 case 'X': ; 2041 case 'Y': ; 2042 case 'Z': ; 2043 case '_': ; 2044 case 'a': ; 2045 case 'b': ; 2046 case 'd': ; 2047 case 'e': ; 2048 case 'g': ; 2049 case 'h': ; 2050 case 'j': ; 2051 case 'k': ; 2052 case 'l': ; 2053 case 'm': ; 2054 case 'n': ; 2055 case 'o': ; 2056 case 'p': ; 2057 case 'q': ; 2058 case 't': ; 2059 case 'u': ; 2060 case 'v': ; 2061 case 'x': ; 2062 case 'y': ; 2063 case 'z': ; 2064 { 2065 NSInteger LA38_12 = [input LA:2]; 2066 2067 if ( ([self evaluateSyntacticPredicate:@selector(synpred4_Fuzzy_fragment)]) ) { 2068 alt38=4; 2069 } 2070 else if ( ([self evaluateSyntacticPredicate:@selector(synpred5_Fuzzy_fragment)]) ) { 2071 alt38=5; 2072 } 2073 else if ( ([self evaluateSyntacticPredicate:@selector(synpred7_Fuzzy_fragment)]) ) { 2074 alt38=7; 2075 } 2076 else { 2077 if ( state.backtracking > 0 ) { state.failed = YES; return ; } 2078 2079 ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:38 state:12 stream:input]; 2080 nvae.c = LA38_12; 2081 @throw nvae; 2082 2083 } 2084 } 2085 break; 2086 case '/': ; 2087 { 2088 NSInteger LA38_13 = [input LA:2]; 2089 2090 if ( ([self evaluateSyntacticPredicate:@selector(synpred8_Fuzzy_fragment)]) ) { 2091 alt38=8; 2092 } 2093 else if ( ([self evaluateSyntacticPredicate:@selector(synpred9_Fuzzy_fragment)]) ) { 2094 alt38=9; 2095 } 2096 else { 2097 if ( state.backtracking > 0 ) { state.failed = YES; return ; } 2098 2099 ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:38 state:13 stream:input]; 2100 nvae.c = LA38_13; 2101 @throw nvae; 2102 2103 } 2104 } 2105 break; 2106 case '"': ; 2107 { 2108 alt38=10; 2109 } 2110 break; 2111 case '\'': ; 2112 { 2113 alt38=11; 2114 } 2115 break; 2116 case '\t': ; 2117 case '\n': ; 2118 case ' ': ; 2119 { 2120 alt38=12; 2121 } 2122 break; 2123 2124 default: ; 2125 if ( state.backtracking > 0 ) { state.failed = YES; return ; } 2126 2127 ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:38 state:0 stream:input]; 2128 nvae.c = charLA38; 2129 @throw nvae; 2130 2131 } 2132 2133 switch (alt38) { 2134 case 1 : ; 2135 // Fuzzy.g:1:41: IMPORT // alt 2136 { 2137 [self mIMPORT]; if ( state.failed ) return ; 2138 2139 2140 2141 } 2142 break; 2143 case 2 : ; 2144 // Fuzzy.g:1:48: RETURN // alt 2145 { 2146 [self mRETURN]; if ( state.failed ) return ; 2147 2148 2149 2150 } 2151 break; 2152 case 3 : ; 2153 // Fuzzy.g:1:55: CLASS // alt 2154 { 2155 [self mCLASS]; if ( state.failed ) return ; 2156 2157 2158 2159 } 2160 break; 2161 case 4 : ; 2162 // Fuzzy.g:1:61: METHOD // alt 2163 { 2164 [self mMETHOD]; if ( state.failed ) return ; 2165 2166 2167 2168 } 2169 break; 2170 case 5 : ; 2171 // Fuzzy.g:1:68: FIELD // alt 2172 { 2173 [self mFIELD]; if ( state.failed ) return ; 2174 2175 2176 2177 } 2178 break; 2179 case 6 : ; 2180 // Fuzzy.g:1:74: STAT // alt 2181 { 2182 [self mSTAT]; if ( state.failed ) return ; 2183 2184 2185 2186 } 2187 break; 2188 case 7 : ; 2189 // Fuzzy.g:1:79: CALL // alt 2190 { 2191 [self mCALL]; if ( state.failed ) return ; 2192 2193 2194 2195 } 2196 break; 2197 case 8 : ; 2198 // Fuzzy.g:1:84: COMMENT // alt 2199 { 2200 [self mCOMMENT]; if ( state.failed ) return ; 2201 2202 2203 2204 } 2205 break; 2206 case 9 : ; 2207 // Fuzzy.g:1:92: SL_COMMENT // alt 2208 { 2209 [self mSL_COMMENT]; if ( state.failed ) return ; 2210 2211 2212 2213 } 2214 break; 2215 case 10 : ; 2216 // Fuzzy.g:1:103: STRING // alt 2217 { 2218 [self mSTRING]; if ( state.failed ) return ; 2219 2220 2221 2222 } 2223 break; 2224 case 11 : ; 2225 // Fuzzy.g:1:110: CHAR // alt 2226 { 2227 [self mCHAR]; if ( state.failed ) return ; 2228 2229 2230 2231 } 2232 break; 2233 case 12 : ; 2234 // Fuzzy.g:1:115: WS // alt 2235 { 2236 [self mWS]; if ( state.failed ) return ; 2237 2238 2239 2240 } 2241 break; 2242 2243 } 2244 2245} 2246 2247// $ANTLR start synpred1_Fuzzy_fragment 2248- (void) synpred1_Fuzzy_fragment 2249{ 2250 // Fuzzy.g:1:41: ( IMPORT ) // ruleBlockSingleAlt 2251 // Fuzzy.g:1:41: IMPORT // alt 2252 { 2253 [self mIMPORT]; if ( state.failed ) return ; 2254 2255 2256 2257 } 2258 2259} // $ANTLR end synpred1_Fuzzy_fragment 2260 2261// $ANTLR start synpred2_Fuzzy_fragment 2262- (void) synpred2_Fuzzy_fragment 2263{ 2264 // Fuzzy.g:1:48: ( RETURN ) // ruleBlockSingleAlt 2265 // Fuzzy.g:1:48: RETURN // alt 2266 { 2267 [self mRETURN]; if ( state.failed ) return ; 2268 2269 2270 2271 } 2272 2273} // $ANTLR end synpred2_Fuzzy_fragment 2274 2275// $ANTLR start synpred3_Fuzzy_fragment 2276- (void) synpred3_Fuzzy_fragment 2277{ 2278 // Fuzzy.g:1:55: ( CLASS ) // ruleBlockSingleAlt 2279 // Fuzzy.g:1:55: CLASS // alt 2280 { 2281 [self mCLASS]; if ( state.failed ) return ; 2282 2283 2284 2285 } 2286 2287} // $ANTLR end synpred3_Fuzzy_fragment 2288 2289// $ANTLR start synpred4_Fuzzy_fragment 2290- (void) synpred4_Fuzzy_fragment 2291{ 2292 // Fuzzy.g:1:61: ( METHOD ) // ruleBlockSingleAlt 2293 // Fuzzy.g:1:61: METHOD // alt 2294 { 2295 [self mMETHOD]; if ( state.failed ) return ; 2296 2297 2298 2299 } 2300 2301} // $ANTLR end synpred4_Fuzzy_fragment 2302 2303// $ANTLR start synpred5_Fuzzy_fragment 2304- (void) synpred5_Fuzzy_fragment 2305{ 2306 // Fuzzy.g:1:68: ( FIELD ) // ruleBlockSingleAlt 2307 // Fuzzy.g:1:68: FIELD // alt 2308 { 2309 [self mFIELD]; if ( state.failed ) return ; 2310 2311 2312 2313 } 2314 2315} // $ANTLR end synpred5_Fuzzy_fragment 2316 2317// $ANTLR start synpred6_Fuzzy_fragment 2318- (void) synpred6_Fuzzy_fragment 2319{ 2320 // Fuzzy.g:1:74: ( STAT ) // ruleBlockSingleAlt 2321 // Fuzzy.g:1:74: STAT // alt 2322 { 2323 [self mSTAT]; if ( state.failed ) return ; 2324 2325 2326 2327 } 2328 2329} // $ANTLR end synpred6_Fuzzy_fragment 2330 2331// $ANTLR start synpred7_Fuzzy_fragment 2332- (void) synpred7_Fuzzy_fragment 2333{ 2334 // Fuzzy.g:1:79: ( CALL ) // ruleBlockSingleAlt 2335 // Fuzzy.g:1:79: CALL // alt 2336 { 2337 [self mCALL]; if ( state.failed ) return ; 2338 2339 2340 2341 } 2342 2343} // $ANTLR end synpred7_Fuzzy_fragment 2344 2345// $ANTLR start synpred8_Fuzzy_fragment 2346- (void) synpred8_Fuzzy_fragment 2347{ 2348 // Fuzzy.g:1:84: ( COMMENT ) // ruleBlockSingleAlt 2349 // Fuzzy.g:1:84: COMMENT // alt 2350 { 2351 [self mCOMMENT]; if ( state.failed ) return ; 2352 2353 2354 2355 } 2356 2357} // $ANTLR end synpred8_Fuzzy_fragment 2358 2359// $ANTLR start synpred9_Fuzzy_fragment 2360- (void) synpred9_Fuzzy_fragment 2361{ 2362 // Fuzzy.g:1:92: ( SL_COMMENT ) // ruleBlockSingleAlt 2363 // Fuzzy.g:1:92: SL_COMMENT // alt 2364 { 2365 [self mSL_COMMENT]; if ( state.failed ) return ; 2366 2367 2368 2369 } 2370 2371} // $ANTLR end synpred9_Fuzzy_fragment 2372 2373@end /* end of Fuzzy implementation line 397 */