1/** \file
2 *  This OBJC source file was generated by $ANTLR version 3.2 Aug 24, 2010 10:45:57
3 *
4 *     -  From the grammar source file : Combined.g
5 *     -                            On : 2010-08-24 13:53:42
6 *     -                 for the lexer : CombinedLexerLexer *
7 * Editing it, at least manually, is not wise.
8 *
9 * ObjC language generator and runtime by Alan Condit, acondit|hereisanat|ipns|dotgoeshere|com.
10 *
11 *
12*/
13// [The "BSD licence"]
14// Copyright (c) 2010 Alan Condit
15//
16// All rights reserved.
17//
18// Redistribution and use in source and binary forms, with or without
19// modification, are permitted provided that the following conditions
20// are met:
21// 1. Redistributions of source code must retain the above copyright
22//    notice, this list of conditions and the following disclaimer.
23// 2. Redistributions in binary form must reproduce the above copyright
24//    notice, this list of conditions and the following disclaimer in the
25//    documentation and/or other materials provided with the distribution.
26// 3. The name of the author may not be used to endorse or promote products
27//    derived from this software without specific prior written permission.
28//
29// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
30// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
31// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
32// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
33// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
34// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
38// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39
40// $ANTLR 3.2 Aug 24, 2010 10:45:57 Combined.g 2010-08-24 13:53:42
41
42/* -----------------------------------------
43 * Include the ANTLR3 generated header file.
44 */
45#import "CombinedLexer.h"
46/* ----------------------------------------- */
47
48
49/* ============================================================================= */
50
51/* =============================================================================
52 * Start of recognizer
53 */
54
55
56/** As per Terence: No returns for lexer rules! */
57@implementation CombinedLexer // line 330
58
59+ (void) initialize
60{
61    [ANTLRBaseRecognizer setGrammarFileName:@"Combined.g"];
62}
63
64+ (NSString *) tokenNameForType:(NSInteger)aTokenType
65{
66    return [[self getTokenNames] objectAtIndex:aTokenType];
67}
68
69+ (CombinedLexer *)newCombinedLexerWithCharStream:(id<ANTLRCharStream>)anInput
70{
71    return [[CombinedLexer alloc] initWithCharStream:anInput];
72}
73
74- (id) initWithCharStream:(id<ANTLRCharStream>)anInput
75{
76    if ((self = [super initWithCharStream:anInput State:[ANTLRRecognizerSharedState newANTLRRecognizerSharedStateWithRuleLen:4+1]]) != nil) {
77
78    }
79    return self;
80}
81
82- (void) dealloc
83{
84    [super dealloc];
85}
86
87/* Start of actions.lexer.methods */
88/* start methods() */
89
90/* Start of Rules */
91// $ANTLR start "ID"
92- (void) mID
93{
94    //
95    /* ruleScopeSetUp */
96
97    @try {
98        NSInteger _type = ID;
99        NSInteger _channel = ANTLRTokenChannelDefault;
100        // Combined.g:14:5: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )* ) // ruleBlockSingleAlt
101        // Combined.g:14:9: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )* // alt
102        {
103        if ((([input LA:1] >= 'A') && ([input LA:1] <= 'Z'))||[input LA:1] == '_'||(([input LA:1] >= 'a') && ([input LA:1] <= 'z'))) {
104            [input consume];
105
106        } else {
107            ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException exceptionWithSet:nil stream:input];
108            [self recover:mse];
109            @throw mse;}
110          /* element() */
111        do {
112            NSInteger alt1=2;
113            NSInteger LA1_0 = [input LA:1];
114            if ( ((LA1_0>='0' && LA1_0<='9')||(LA1_0>='A' && LA1_0<='Z')||LA1_0=='_'||(LA1_0>='a' && LA1_0<='z')) ) {
115                alt1=1;
116            }
117
118
119            switch (alt1) {
120                case 1 : ;
121                    // Combined.g: // alt
122                    {
123                    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'))) {
124                        [input consume];
125
126                    } else {
127                        ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException exceptionWithSet:nil stream:input];
128                        [self recover:mse];
129                        @throw mse;}
130                      /* element() */
131                     /* elements */
132                    }
133                    break;
134
135                default :
136                    goto loop1;
137            }
138        } while (YES);
139        loop1: ;
140          /* element() */
141         /* elements */
142        }
143
144        // token+rule list labels
145
146        [state setType:_type];
147
148        state.channel = _channel;
149    }
150    @finally {
151        //
152    }
153    return;
154}
155// $ANTLR end "ID"
156
157// $ANTLR start "INT"
158- (void) mINT
159{
160    //
161    /* ruleScopeSetUp */
162
163    @try {
164        NSInteger _type = INT;
165        NSInteger _channel = ANTLRTokenChannelDefault;
166        // Combined.g:17:5: ( ( '0' .. '9' )+ ) // ruleBlockSingleAlt
167        // Combined.g:17:9: ( '0' .. '9' )+ // alt
168        {
169        // Combined.g:17:9: ( '0' .. '9' )+ // positiveClosureBlock
170        NSInteger cnt2=0;
171        do {
172            NSInteger alt2=2;
173            NSInteger LA2_0 = [input LA:1];
174            if ( ((LA2_0>='0' && LA2_0<='9')) ) {
175                alt2=1;
176            }
177
178
179            switch (alt2) {
180                case 1 : ;
181                    // Combined.g:17:10: '0' .. '9' // alt
182                    {
183                    [self matchRangeFromChar:'0' to:'9'];   /* element() */
184                     /* elements */
185                    }
186                    break;
187
188                default :
189                    if ( cnt2 >= 1 )
190                        goto loop2;
191                    ANTLREarlyExitException *eee = [ANTLREarlyExitException exceptionWithStream:input decisionNumber:2];
192                    @throw eee;
193            }
194            cnt2++;
195        } while (YES);
196        loop2: ;
197          /* element() */
198         /* elements */
199        }
200
201        // token+rule list labels
202
203        [state setType:_type];
204
205        state.channel = _channel;
206    }
207    @finally {
208        //
209    }
210    return;
211}
212// $ANTLR end "INT"
213
214// $ANTLR start "WS"
215- (void) mWS
216{
217    //
218    /* ruleScopeSetUp */
219
220    @try {
221        NSInteger _type = WS;
222        NSInteger _channel = ANTLRTokenChannelDefault;
223        // Combined.g:20:5: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ ) // ruleBlockSingleAlt
224        // Combined.g:20:9: ( ' ' | '\\t' | '\\r' | '\\n' )+ // alt
225        {
226        // Combined.g:20:9: ( ' ' | '\\t' | '\\r' | '\\n' )+ // positiveClosureBlock
227        NSInteger cnt3=0;
228        do {
229            NSInteger alt3=2;
230            NSInteger LA3_0 = [input LA:1];
231            if ( ((LA3_0>='\t' && LA3_0<='\n')||LA3_0=='\r'||LA3_0==' ') ) {
232                alt3=1;
233            }
234
235
236            switch (alt3) {
237                case 1 : ;
238                    // Combined.g: // alt
239                    {
240                    if ((([input LA:1] >= '\t') && ([input LA:1] <= '\n'))||[input LA:1] == '\r'||[input LA:1] == ' ') {
241                        [input consume];
242
243                    } else {
244                        ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException exceptionWithSet:nil stream:input];
245                        [self recover:mse];
246                        @throw mse;}
247                      /* element() */
248                     /* elements */
249                    }
250                    break;
251
252                default :
253                    if ( cnt3 >= 1 )
254                        goto loop3;
255                    ANTLREarlyExitException *eee = [ANTLREarlyExitException exceptionWithStream:input decisionNumber:3];
256                    @throw eee;
257            }
258            cnt3++;
259        } while (YES);
260        loop3: ;
261          /* element() */
262         _channel=99;   /* element() */
263         /* elements */
264        }
265
266        // token+rule list labels
267
268        [state setType:_type];
269
270        state.channel = _channel;
271    }
272    @finally {
273        //
274    }
275    return;
276}
277// $ANTLR end "WS"
278
279- (void) mTokens
280{
281    // Combined.g:1:8: ( ID | INT | WS ) //ruleblock
282    NSInteger alt4=3;
283    switch ([input LA:1]) {
284        case 'A': ;
285        case 'B': ;
286        case 'C': ;
287        case 'D': ;
288        case 'E': ;
289        case 'F': ;
290        case 'G': ;
291        case 'H': ;
292        case 'I': ;
293        case 'J': ;
294        case 'K': ;
295        case 'L': ;
296        case 'M': ;
297        case 'N': ;
298        case 'O': ;
299        case 'P': ;
300        case 'Q': ;
301        case 'R': ;
302        case 'S': ;
303        case 'T': ;
304        case 'U': ;
305        case 'V': ;
306        case 'W': ;
307        case 'X': ;
308        case 'Y': ;
309        case 'Z': ;
310        case '_': ;
311        case 'a': ;
312        case 'b': ;
313        case 'c': ;
314        case 'd': ;
315        case 'e': ;
316        case 'f': ;
317        case 'g': ;
318        case 'h': ;
319        case 'i': ;
320        case 'j': ;
321        case 'k': ;
322        case 'l': ;
323        case 'm': ;
324        case 'n': ;
325        case 'o': ;
326        case 'p': ;
327        case 'q': ;
328        case 'r': ;
329        case 's': ;
330        case 't': ;
331        case 'u': ;
332        case 'v': ;
333        case 'w': ;
334        case 'x': ;
335        case 'y': ;
336        case 'z': ;
337            {
338            alt4=1;
339            }
340            break;
341        case '0': ;
342        case '1': ;
343        case '2': ;
344        case '3': ;
345        case '4': ;
346        case '5': ;
347        case '6': ;
348        case '7': ;
349        case '8': ;
350        case '9': ;
351            {
352            alt4=2;
353            }
354            break;
355        case '\t': ;
356        case '\n': ;
357        case '\r': ;
358        case ' ': ;
359            {
360            alt4=3;
361            }
362            break;
363
364    default: ;
365        ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newANTLRNoViableAltException:4 state:0 stream:input];
366        @throw nvae;
367    }
368
369    switch (alt4) {
370        case 1 : ;
371            // Combined.g:1:10: ID // alt
372            {
373                [self mID];
374              /* element() */
375             /* elements */
376            }
377            break;
378        case 2 : ;
379            // Combined.g:1:13: INT // alt
380            {
381                [self mINT];
382              /* element() */
383             /* elements */
384            }
385            break;
386        case 3 : ;
387            // Combined.g:1:17: WS // alt
388            {
389                [self mWS];
390              /* element() */
391             /* elements */
392            }
393            break;
394
395    }
396
397}
398
399@end /* end of CombinedLexer implementation line 397 */
400
401/* End of code
402 * =============================================================================
403 */
404