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