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/combined/Combined.g
5 *     -                            On : 2012-02-16 17:33:49
6 *     -                 for the lexer : CombinedLexerLexer
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/combined/Combined.g 2012-02-16 17:33:49
15
16
17/* -----------------------------------------
18 * Include the ANTLR3 generated header file.
19 */
20#import "CombinedLexer.h"
21/* ----------------------------------------- */
22
23
24/* ============================================================================= */
25/* =============================================================================
26 * Start of recognizer
27 */
28
29/** As per Terence: No returns for lexer rules! */
30@implementation CombinedLexer // line 330
31
32+ (void) initialize
33{
34    [BaseRecognizer setGrammarFileName:@"/Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/combined/Combined.g"];
35}
36
37+ (NSString *) tokenNameForType:(NSInteger)aTokenType
38{
39    return [[self getTokenNames] objectAtIndex:aTokenType];
40}
41
42+ (CombinedLexer *)newCombinedLexerWithCharStream:(id<CharStream>)anInput
43{
44    return [[CombinedLexer alloc] initWithCharStream:anInput];
45}
46
47- (id) initWithCharStream:(id<CharStream>)anInput
48{
49    self = [super initWithCharStream:anInput State:[RecognizerSharedState newRecognizerSharedStateWithRuleLen:4+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 "ID"
67- (void) mID
68{
69    //
70    /* ruleScopeSetUp */
71
72    /* ruleDeclarations */
73
74    @try {
75        NSInteger _type = ID;
76        NSInteger _channel = TokenChannelDefault;
77        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/combined/Combined.g:14:5: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )* ) // ruleBlockSingleAlt
78        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/combined/Combined.g:14:9: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )* // alt
79        {
80
81        if ((([input LA:1] >= 'A') && ([input LA:1] <= 'Z'))||[input LA:1] == '_'||(([input LA:1] >= 'a') && ([input LA:1] <= 'z'))) {
82            [input consume];
83        } else {
84            MismatchedSetException *mse = [MismatchedSetException newException:nil stream:input];
85            [self recover:mse];
86            @throw mse;
87        }
88
89
90
91        do {
92            NSInteger alt1=2;
93            NSInteger LA1_0 = [input LA:1];
94            if ( ((LA1_0 >= '0' && LA1_0 <= '9')||(LA1_0 >= 'A' && LA1_0 <= 'Z')||LA1_0=='_'||(LA1_0 >= 'a' && LA1_0 <= 'z')) ) {
95                alt1=1;
96            }
97
98
99            switch (alt1) {
100                case 1 : ;
101                    // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/combined/Combined.g: // alt
102                    {
103
104                    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'))) {
105                        [input consume];
106                    } else {
107                        MismatchedSetException *mse = [MismatchedSetException newException:nil stream:input];
108                        [self recover:mse];
109                        @throw mse;
110                    }
111
112
113                    }
114                    break;
115
116                default :
117                    goto loop1;
118            }
119        } while (YES);
120        loop1: ;
121
122
123        }
124
125        /* token+rule list labels */
126
127        state.type = _type;
128        state.channel = _channel;
129    }
130    @finally {
131        //
132        /* ruleScopeCleanUp */
133
134    }
135    return;
136}
137/* $ANTLR end "ID" */
138// $ANTLR start "INT"
139- (void) mINT
140{
141    //
142    /* ruleScopeSetUp */
143
144    /* ruleDeclarations */
145
146    @try {
147        NSInteger _type = INT;
148        NSInteger _channel = TokenChannelDefault;
149        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/combined/Combined.g:17:5: ( ( '0' .. '9' )+ ) // ruleBlockSingleAlt
150        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/combined/Combined.g:17:9: ( '0' .. '9' )+ // alt
151        {
152
153        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/combined/Combined.g:17:9: ( '0' .. '9' )+ // positiveClosureBlock
154        NSInteger cnt2 = 0;
155        do {
156            NSInteger alt2 = 2;
157            NSInteger LA2_0 = [input LA:1];
158            if ( ((LA2_0 >= '0' && LA2_0 <= '9')) ) {
159                alt2=1;
160            }
161
162
163            switch (alt2) {
164                case 1 : ;
165                    // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/combined/Combined.g: // alt
166                    {
167
168                    if ((([input LA:1] >= '0') && ([input LA:1] <= '9'))) {
169                        [input consume];
170                    } else {
171                        MismatchedSetException *mse = [MismatchedSetException newException:nil stream:input];
172                        [self recover:mse];
173                        @throw mse;
174                    }
175
176
177                    }
178                    break;
179
180                default :
181                    if ( cnt2 >= 1 )
182                        goto loop2;
183                    EarlyExitException *eee =
184                        [EarlyExitException newException:input decisionNumber:2];
185                    @throw eee;
186            }
187            cnt2++;
188        } while (YES);
189        loop2: ;
190
191
192        }
193
194        /* token+rule list labels */
195
196        state.type = _type;
197        state.channel = _channel;
198    }
199    @finally {
200        //
201        /* ruleScopeCleanUp */
202
203    }
204    return;
205}
206/* $ANTLR end "INT" */
207// $ANTLR start "WS"
208- (void) mWS
209{
210    //
211    /* ruleScopeSetUp */
212
213    /* ruleDeclarations */
214
215    @try {
216        NSInteger _type = WS;
217        NSInteger _channel = TokenChannelDefault;
218        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/combined/Combined.g:20:5: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ ) // ruleBlockSingleAlt
219        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/combined/Combined.g:20:9: ( ' ' | '\\t' | '\\r' | '\\n' )+ // alt
220        {
221
222        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/combined/Combined.g:20:9: ( ' ' | '\\t' | '\\r' | '\\n' )+ // positiveClosureBlock
223        NSInteger cnt3 = 0;
224        do {
225            NSInteger alt3 = 2;
226            NSInteger LA3_0 = [input LA:1];
227            if ( ((LA3_0 >= '\t' && LA3_0 <= '\n')||LA3_0=='\r'||LA3_0==' ') ) {
228                alt3=1;
229            }
230
231
232            switch (alt3) {
233                case 1 : ;
234                    // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/combined/Combined.g: // alt
235                    {
236
237                    if ((([input LA:1] >= '\t') && ([input LA:1] <= '\n'))||[input LA:1] == '\r'||[input LA:1] == ' ') {
238                        [input consume];
239                    } else {
240                        MismatchedSetException *mse = [MismatchedSetException newException:nil stream:input];
241                        [self recover:mse];
242                        @throw mse;
243                    }
244
245
246                    }
247                    break;
248
249                default :
250                    if ( cnt3 >= 1 )
251                        goto loop3;
252                    EarlyExitException *eee =
253                        [EarlyExitException newException:input decisionNumber:3];
254                    @throw eee;
255            }
256            cnt3++;
257        } while (YES);
258        loop3: ;
259
260
261
262         _channel=99;
263
264
265        }
266
267        /* token+rule list labels */
268
269        state.type = _type;
270        state.channel = _channel;
271    }
272    @finally {
273        //
274        /* ruleScopeCleanUp */
275
276    }
277    return;
278}
279/* $ANTLR end "WS" */
280- (void) mTokens
281{
282    // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/combined/Combined.g:1:8: ( ID | INT | WS ) //ruleblock
283    NSInteger alt4=3;
284    unichar charLA4 = [input LA:1];
285    switch (charLA4) {
286        case 'A': ;
287        case 'B': ;
288        case 'C': ;
289        case 'D': ;
290        case 'E': ;
291        case 'F': ;
292        case 'G': ;
293        case 'H': ;
294        case 'I': ;
295        case 'J': ;
296        case 'K': ;
297        case 'L': ;
298        case 'M': ;
299        case 'N': ;
300        case 'O': ;
301        case 'P': ;
302        case 'Q': ;
303        case 'R': ;
304        case 'S': ;
305        case 'T': ;
306        case 'U': ;
307        case 'V': ;
308        case 'W': ;
309        case 'X': ;
310        case 'Y': ;
311        case 'Z': ;
312        case '_': ;
313        case 'a': ;
314        case 'b': ;
315        case 'c': ;
316        case 'd': ;
317        case 'e': ;
318        case 'f': ;
319        case 'g': ;
320        case 'h': ;
321        case 'i': ;
322        case 'j': ;
323        case 'k': ;
324        case 'l': ;
325        case 'm': ;
326        case 'n': ;
327        case 'o': ;
328        case 'p': ;
329        case 'q': ;
330        case 'r': ;
331        case 's': ;
332        case 't': ;
333        case 'u': ;
334        case 'v': ;
335        case 'w': ;
336        case 'x': ;
337        case 'y': ;
338        case 'z': ;
339            {
340            alt4=1;
341            }
342            break;
343        case '0': ;
344        case '1': ;
345        case '2': ;
346        case '3': ;
347        case '4': ;
348        case '5': ;
349        case '6': ;
350        case '7': ;
351        case '8': ;
352        case '9': ;
353            {
354            alt4=2;
355            }
356            break;
357        case '\t': ;
358        case '\n': ;
359        case '\r': ;
360        case ' ': ;
361            {
362            alt4=3;
363            }
364            break;
365
366    default: ;
367        NoViableAltException *nvae = [NoViableAltException newException:4 state:0 stream:input];
368        nvae.c = charLA4;
369        @throw nvae;
370
371    }
372
373    switch (alt4) {
374        case 1 : ;
375            // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/combined/Combined.g:1:10: ID // alt
376            {
377
378
379            [self mID];
380
381
382
383            }
384            break;
385        case 2 : ;
386            // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/combined/Combined.g:1:13: INT // alt
387            {
388
389
390            [self mINT];
391
392
393
394            }
395            break;
396        case 3 : ;
397            // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/combined/Combined.g:1:17: WS // alt
398            {
399
400
401            [self mWS];
402
403
404
405            }
406            break;
407
408    }
409
410}
411
412@end /* end of CombinedLexer implementation line 397 */