1/** \file 2 * This OBJC source file was generated by $ANTLR version ${project.version} ${buildNumber} 3 * 4 * - From the grammar source file : SymbolTable.g 5 * - On : 2011-05-06 15:04:43 6 * - for the lexer : SymbolTableLexerLexer 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} SymbolTable.g 2011-05-06 15:04:43 15 16 17/* ----------------------------------------- 18 * Include the ANTLR3 generated header file. 19 */ 20#import "SymbolTableLexer.h" 21/* ----------------------------------------- */ 22 23 24/* ============================================================================= */ 25/* ============================================================================= 26 * Start of recognizer 27 */ 28 29/** As per Terence: No returns for lexer rules! */ 30@implementation SymbolTableLexer // line 330 31 32+ (void) initialize 33{ 34 [ANTLRBaseRecognizer setGrammarFileName:@"SymbolTable.g"]; 35} 36 37+ (NSString *) tokenNameForType:(NSInteger)aTokenType 38{ 39 return [[self getTokenNames] objectAtIndex:aTokenType]; 40} 41 42+ (SymbolTableLexer *)newSymbolTableLexerWithCharStream:(id<ANTLRCharStream>)anInput 43{ 44 return [[SymbolTableLexer alloc] initWithCharStream:anInput]; 45} 46 47- (id) initWithCharStream:(id<ANTLRCharStream>)anInput 48{ 49 self = [super initWithCharStream:anInput State:[[ANTLRRecognizerSharedState newANTLRRecognizerSharedStateWithRuleLen:12+1] retain]]; 50 if ( self != nil ) { 51 } 52 return self; 53} 54 55- (void) dealloc 56{ 57 [super dealloc]; 58} 59 60/* ObjC Start of actions.lexer.methods */ 61/* ObjC end of actions.lexer.methods */ 62/* ObjC start methods() */ 63/* ObjC end methods() */ 64 65/* Start of Rules */ 66// $ANTLR start "T__7" 67- (void) mT__7 68{ 69 // 70 /* my ruleScopeSetUp */ 71 /* Terence's stuff */ 72 73 @try { 74 NSInteger _type = T__7; 75 NSInteger _channel = ANTLRTokenChannelDefault; 76 // SymbolTable.g:7:6: ( '(' ) // ruleBlockSingleAlt 77 // SymbolTable.g:7:8: '(' // alt 78 { 79 [self matchChar:'(']; 80 81 82 } 83 84 // token+rule list labels 85 86 state.type = _type; 87 state.channel = _channel; 88 } 89 @finally { 90 // 91 /* Terence's stuff */ 92 93 } 94 return; 95} 96/* $ANTLR end "T__7" */ 97 98// $ANTLR start "T__8" 99- (void) mT__8 100{ 101 // 102 /* my ruleScopeSetUp */ 103 /* Terence's stuff */ 104 105 @try { 106 NSInteger _type = T__8; 107 NSInteger _channel = ANTLRTokenChannelDefault; 108 // SymbolTable.g:8:6: ( ')' ) // ruleBlockSingleAlt 109 // SymbolTable.g:8:8: ')' // alt 110 { 111 [self matchChar:')']; 112 113 114 } 115 116 // token+rule list labels 117 118 state.type = _type; 119 state.channel = _channel; 120 } 121 @finally { 122 // 123 /* Terence's stuff */ 124 125 } 126 return; 127} 128/* $ANTLR end "T__8" */ 129 130// $ANTLR start "T__9" 131- (void) mT__9 132{ 133 // 134 /* my ruleScopeSetUp */ 135 /* Terence's stuff */ 136 137 @try { 138 NSInteger _type = T__9; 139 NSInteger _channel = ANTLRTokenChannelDefault; 140 // SymbolTable.g:9:6: ( ';' ) // ruleBlockSingleAlt 141 // SymbolTable.g:9:8: ';' // alt 142 { 143 [self matchChar:';']; 144 145 146 } 147 148 // token+rule list labels 149 150 state.type = _type; 151 state.channel = _channel; 152 } 153 @finally { 154 // 155 /* Terence's stuff */ 156 157 } 158 return; 159} 160/* $ANTLR end "T__9" */ 161 162// $ANTLR start "T__10" 163- (void) mT__10 164{ 165 // 166 /* my ruleScopeSetUp */ 167 /* Terence's stuff */ 168 169 @try { 170 NSInteger _type = T__10; 171 NSInteger _channel = ANTLRTokenChannelDefault; 172 // SymbolTable.g:10:7: ( '=' ) // ruleBlockSingleAlt 173 // SymbolTable.g:10:9: '=' // alt 174 { 175 [self matchChar:'=']; 176 177 178 } 179 180 // token+rule list labels 181 182 state.type = _type; 183 state.channel = _channel; 184 } 185 @finally { 186 // 187 /* Terence's stuff */ 188 189 } 190 return; 191} 192/* $ANTLR end "T__10" */ 193 194// $ANTLR start "T__11" 195- (void) mT__11 196{ 197 // 198 /* my ruleScopeSetUp */ 199 /* Terence's stuff */ 200 201 @try { 202 NSInteger _type = T__11; 203 NSInteger _channel = ANTLRTokenChannelDefault; 204 // SymbolTable.g:11:7: ( 'int' ) // ruleBlockSingleAlt 205 // SymbolTable.g:11:9: 'int' // alt 206 { 207 [self matchString:@"int"]; 208 209 210 211 } 212 213 // token+rule list labels 214 215 state.type = _type; 216 state.channel = _channel; 217 } 218 @finally { 219 // 220 /* Terence's stuff */ 221 222 } 223 return; 224} 225/* $ANTLR end "T__11" */ 226 227// $ANTLR start "T__12" 228- (void) mT__12 229{ 230 // 231 /* my ruleScopeSetUp */ 232 /* Terence's stuff */ 233 234 @try { 235 NSInteger _type = T__12; 236 NSInteger _channel = ANTLRTokenChannelDefault; 237 // SymbolTable.g:12:7: ( 'method' ) // ruleBlockSingleAlt 238 // SymbolTable.g:12:9: 'method' // alt 239 { 240 [self matchString:@"method"]; 241 242 243 244 } 245 246 // token+rule list labels 247 248 state.type = _type; 249 state.channel = _channel; 250 } 251 @finally { 252 // 253 /* Terence's stuff */ 254 255 } 256 return; 257} 258/* $ANTLR end "T__12" */ 259 260// $ANTLR start "T__13" 261- (void) mT__13 262{ 263 // 264 /* my ruleScopeSetUp */ 265 /* Terence's stuff */ 266 267 @try { 268 NSInteger _type = T__13; 269 NSInteger _channel = ANTLRTokenChannelDefault; 270 // SymbolTable.g:13:7: ( '{' ) // ruleBlockSingleAlt 271 // SymbolTable.g:13:9: '{' // alt 272 { 273 [self matchChar:'{']; 274 275 276 } 277 278 // token+rule list labels 279 280 state.type = _type; 281 state.channel = _channel; 282 } 283 @finally { 284 // 285 /* Terence's stuff */ 286 287 } 288 return; 289} 290/* $ANTLR end "T__13" */ 291 292// $ANTLR start "T__14" 293- (void) mT__14 294{ 295 // 296 /* my ruleScopeSetUp */ 297 /* Terence's stuff */ 298 299 @try { 300 NSInteger _type = T__14; 301 NSInteger _channel = ANTLRTokenChannelDefault; 302 // SymbolTable.g:14:7: ( '}' ) // ruleBlockSingleAlt 303 // SymbolTable.g:14:9: '}' // alt 304 { 305 [self matchChar:'}']; 306 307 308 } 309 310 // token+rule list labels 311 312 state.type = _type; 313 state.channel = _channel; 314 } 315 @finally { 316 // 317 /* Terence's stuff */ 318 319 } 320 return; 321} 322/* $ANTLR end "T__14" */ 323 324// $ANTLR start "ID" 325- (void) mID 326{ 327 // 328 /* my ruleScopeSetUp */ 329 /* Terence's stuff */ 330 331 @try { 332 NSInteger _type = ID; 333 NSInteger _channel = ANTLRTokenChannelDefault; 334 // SymbolTable.g:68:5: ( ( 'a' .. 'z' )+ ) // ruleBlockSingleAlt 335 // SymbolTable.g:68:9: ( 'a' .. 'z' )+ // alt 336 { 337 // SymbolTable.g:68:9: ( 'a' .. 'z' )+ // positiveClosureBlock 338 NSInteger cnt1 = 0; 339 do { 340 NSInteger alt1 = 2; 341 NSInteger LA1_0 = [input LA:1]; 342 if ( ((LA1_0 >= 'a' && LA1_0 <= 'z')) ) { 343 alt1=1; 344 } 345 346 347 switch (alt1) { 348 case 1 : ; 349 // SymbolTable.g: // alt 350 { 351 if ((([input LA:1] >= 'a') && ([input LA:1] <= 'z'))) { 352 [input consume]; 353 } else { 354 ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException newException:nil stream:input]; 355 [self recover:mse]; 356 @throw mse; 357 } 358 359 360 } 361 break; 362 363 default : 364 if ( cnt1 >= 1 ) 365 goto loop1; 366 ANTLREarlyExitException *eee = 367 [ANTLREarlyExitException newException:input decisionNumber:1]; 368 @throw eee; 369 } 370 cnt1++; 371 } while (YES); 372 loop1: ; 373 374 375 } 376 377 // token+rule list labels 378 379 state.type = _type; 380 state.channel = _channel; 381 } 382 @finally { 383 // 384 /* Terence's stuff */ 385 386 } 387 return; 388} 389/* $ANTLR end "ID" */ 390 391// $ANTLR start "INT" 392- (void) mINT 393{ 394 // 395 /* my ruleScopeSetUp */ 396 /* Terence's stuff */ 397 398 @try { 399 NSInteger _type = INT; 400 NSInteger _channel = ANTLRTokenChannelDefault; 401 // SymbolTable.g:71:5: ( ( '0' .. '9' )+ ) // ruleBlockSingleAlt 402 // SymbolTable.g:71:9: ( '0' .. '9' )+ // alt 403 { 404 // SymbolTable.g:71:9: ( '0' .. '9' )+ // positiveClosureBlock 405 NSInteger cnt2 = 0; 406 do { 407 NSInteger alt2 = 2; 408 NSInteger LA2_0 = [input LA:1]; 409 if ( ((LA2_0 >= '0' && LA2_0 <= '9')) ) { 410 alt2=1; 411 } 412 413 414 switch (alt2) { 415 case 1 : ; 416 // SymbolTable.g: // alt 417 { 418 if ((([input LA:1] >= '0') && ([input LA:1] <= '9'))) { 419 [input consume]; 420 } else { 421 ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException newException:nil stream:input]; 422 [self recover:mse]; 423 @throw mse; 424 } 425 426 427 } 428 break; 429 430 default : 431 if ( cnt2 >= 1 ) 432 goto loop2; 433 ANTLREarlyExitException *eee = 434 [ANTLREarlyExitException newException:input decisionNumber:2]; 435 @throw eee; 436 } 437 cnt2++; 438 } while (YES); 439 loop2: ; 440 441 442 } 443 444 // token+rule list labels 445 446 state.type = _type; 447 state.channel = _channel; 448 } 449 @finally { 450 // 451 /* Terence's stuff */ 452 453 } 454 return; 455} 456/* $ANTLR end "INT" */ 457 458// $ANTLR start "WS" 459- (void) mWS 460{ 461 // 462 /* my ruleScopeSetUp */ 463 /* Terence's stuff */ 464 465 @try { 466 NSInteger _type = WS; 467 NSInteger _channel = ANTLRTokenChannelDefault; 468 // SymbolTable.g:74:5: ( ( ' ' | '\\n' | '\\r' )+ ) // ruleBlockSingleAlt 469 // SymbolTable.g:74:9: ( ' ' | '\\n' | '\\r' )+ // alt 470 { 471 // SymbolTable.g:74:9: ( ' ' | '\\n' | '\\r' )+ // positiveClosureBlock 472 NSInteger cnt3 = 0; 473 do { 474 NSInteger alt3 = 2; 475 NSInteger LA3_0 = [input LA:1]; 476 if ( (LA3_0=='\n'||LA3_0=='\r'||LA3_0==' ') ) { 477 alt3=1; 478 } 479 480 481 switch (alt3) { 482 case 1 : ; 483 // SymbolTable.g: // alt 484 { 485 if ([input LA:1] == '\n'||[input LA:1] == '\r'||[input LA:1] == ' ') { 486 [input consume]; 487 } else { 488 ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException newException:nil stream:input]; 489 [self recover:mse]; 490 @throw mse; 491 } 492 493 494 } 495 break; 496 497 default : 498 if ( cnt3 >= 1 ) 499 goto loop3; 500 ANTLREarlyExitException *eee = 501 [ANTLREarlyExitException newException:input decisionNumber:3]; 502 @throw eee; 503 } 504 cnt3++; 505 } while (YES); 506 loop3: ; 507 508 509 _channel=HIDDEN; 510 511 512 } 513 514 // token+rule list labels 515 516 state.type = _type; 517 state.channel = _channel; 518 } 519 @finally { 520 // 521 /* Terence's stuff */ 522 523 } 524 return; 525} 526/* $ANTLR end "WS" */ 527 528- (void) mTokens 529{ 530 // SymbolTable.g:1:8: ( T__7 | T__8 | T__9 | T__10 | T__11 | T__12 | T__13 | T__14 | ID | INT | WS ) //ruleblock 531 NSInteger alt4=11; 532 unichar charLA4 = [input LA:1]; 533 switch (charLA4) { 534 case '(': ; 535 { 536 alt4=1; 537 } 538 break; 539 case ')': ; 540 { 541 alt4=2; 542 } 543 break; 544 case ';': ; 545 { 546 alt4=3; 547 } 548 break; 549 case '=': ; 550 { 551 alt4=4; 552 } 553 break; 554 case 'i': ; 555 { 556 NSInteger LA4_5 = [input LA:2]; 557 558 if ( (LA4_5=='n') ) { 559 NSInteger LA4_12 = [input LA:3]; 560 561 if ( (LA4_12=='t') ) { 562 NSInteger LA4_14 = [input LA:4]; 563 564 if ( ((LA4_14 >= 'a' && LA4_14 <= 'z')) ) { 565 alt4=9; 566 } 567 else { 568 alt4 = 5; 569 } 570 } 571 else { 572 alt4 = 9; 573 } 574 } 575 else { 576 alt4 = 9; 577 } 578 } 579 break; 580 case 'm': ; 581 { 582 NSInteger LA4_6 = [input LA:2]; 583 584 if ( (LA4_6=='e') ) { 585 NSInteger LA4_13 = [input LA:3]; 586 587 if ( (LA4_13=='t') ) { 588 NSInteger LA4_15 = [input LA:4]; 589 590 if ( (LA4_15=='h') ) { 591 NSInteger LA4_17 = [input LA:5]; 592 593 if ( (LA4_17=='o') ) { 594 NSInteger LA4_18 = [input LA:6]; 595 596 if ( (LA4_18=='d') ) { 597 NSInteger LA4_19 = [input LA:7]; 598 599 if ( ((LA4_19 >= 'a' && LA4_19 <= 'z')) ) { 600 alt4=9; 601 } 602 else { 603 alt4 = 6; 604 } 605 } 606 else { 607 alt4 = 9; 608 } 609 } 610 else { 611 alt4 = 9; 612 } 613 } 614 else { 615 alt4 = 9; 616 } 617 } 618 else { 619 alt4 = 9; 620 } 621 } 622 else { 623 alt4 = 9; 624 } 625 } 626 break; 627 case '{': ; 628 { 629 alt4=7; 630 } 631 break; 632 case '}': ; 633 { 634 alt4=8; 635 } 636 break; 637 case 'a': ; 638 case 'b': ; 639 case 'c': ; 640 case 'd': ; 641 case 'e': ; 642 case 'f': ; 643 case 'g': ; 644 case 'h': ; 645 case 'j': ; 646 case 'k': ; 647 case 'l': ; 648 case 'n': ; 649 case 'o': ; 650 case 'p': ; 651 case 'q': ; 652 case 'r': ; 653 case 's': ; 654 case 't': ; 655 case 'u': ; 656 case 'v': ; 657 case 'w': ; 658 case 'x': ; 659 case 'y': ; 660 case 'z': ; 661 { 662 alt4=9; 663 } 664 break; 665 case '0': ; 666 case '1': ; 667 case '2': ; 668 case '3': ; 669 case '4': ; 670 case '5': ; 671 case '6': ; 672 case '7': ; 673 case '8': ; 674 case '9': ; 675 { 676 alt4=10; 677 } 678 break; 679 case '\n': ; 680 case '\r': ; 681 case ' ': ; 682 { 683 alt4=11; 684 } 685 break; 686 687 default: ; 688 ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:4 state:0 stream:input]; 689 nvae.c = charLA4; 690 @throw nvae; 691 692 } 693 694 switch (alt4) { 695 case 1 : ; 696 // SymbolTable.g:1:10: T__7 // alt 697 { 698 [self mT__7]; 699 700 701 702 } 703 break; 704 case 2 : ; 705 // SymbolTable.g:1:15: T__8 // alt 706 { 707 [self mT__8]; 708 709 710 711 } 712 break; 713 case 3 : ; 714 // SymbolTable.g:1:20: T__9 // alt 715 { 716 [self mT__9]; 717 718 719 720 } 721 break; 722 case 4 : ; 723 // SymbolTable.g:1:25: T__10 // alt 724 { 725 [self mT__10]; 726 727 728 729 } 730 break; 731 case 5 : ; 732 // SymbolTable.g:1:31: T__11 // alt 733 { 734 [self mT__11]; 735 736 737 738 } 739 break; 740 case 6 : ; 741 // SymbolTable.g:1:37: T__12 // alt 742 { 743 [self mT__12]; 744 745 746 747 } 748 break; 749 case 7 : ; 750 // SymbolTable.g:1:43: T__13 // alt 751 { 752 [self mT__13]; 753 754 755 756 } 757 break; 758 case 8 : ; 759 // SymbolTable.g:1:49: T__14 // alt 760 { 761 [self mT__14]; 762 763 764 765 } 766 break; 767 case 9 : ; 768 // SymbolTable.g:1:55: ID // alt 769 { 770 [self mID]; 771 772 773 774 } 775 break; 776 case 10 : ; 777 // SymbolTable.g:1:58: INT // alt 778 { 779 [self mINT]; 780 781 782 783 } 784 break; 785 case 11 : ; 786 // SymbolTable.g:1:62: WS // alt 787 { 788 [self mWS]; 789 790 791 792 } 793 break; 794 795 } 796 797} 798 799@end /* end of SymbolTableLexer implementation line 397 */