• 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/lexertest-simple/TestLexer.g
5 *     -                            On : 2012-02-16 17:36:38
6 *     -                 for the lexer : TestLexerLexer
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/lexertest-simple/TestLexer.g 2012-02-16 17:36:38
15
16
17/* -----------------------------------------
18 * Include the ANTLR3 generated header file.
19 */
20#import "TestLexer.h"
21/* ----------------------------------------- */
22
23
24/* ============================================================================= */
25/* =============================================================================
26 * Start of recognizer
27 */
28
29/** As per Terence: No returns for lexer rules! */
30@implementation TestLexer // line 330
31
32+ (void) initialize
33{
34    [BaseRecognizer setGrammarFileName:@"/Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/lexertest-simple/TestLexer.g"];
35}
36
37+ (NSString *) tokenNameForType:(NSInteger)aTokenType
38{
39    return [[self getTokenNames] objectAtIndex:aTokenType];
40}
41
42+ (TestLexer *)newTestLexerWithCharStream:(id<CharStream>)anInput
43{
44    return [[TestLexer 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/lexertest-simple/TestLexer.g:8:4: ( LETTER ( LETTER | DIGIT )* ) // ruleBlockSingleAlt
78        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/lexertest-simple/TestLexer.g:8:6: LETTER ( LETTER | DIGIT )* // alt
79        {
80
81
82        [self mLETTER];
83
84
85
86
87        do {
88            NSInteger alt1=2;
89            NSInteger LA1_0 = [input LA:1];
90            if ( ((LA1_0 >= '0' && LA1_0 <= '9')||(LA1_0 >= 'A' && LA1_0 <= 'Z')||(LA1_0 >= 'a' && LA1_0 <= 'z')) ) {
91                alt1=1;
92            }
93
94
95            switch (alt1) {
96                case 1 : ;
97                    // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/lexertest-simple/TestLexer.g: // alt
98                    {
99
100                    if ((([input LA:1] >= '0') && ([input LA:1] <= '9'))||(([input LA:1] >= 'A') && ([input LA:1] <= 'Z'))||(([input LA:1] >= 'a') && ([input LA:1] <= 'z'))) {
101                        [input consume];
102                    } else {
103                        MismatchedSetException *mse = [MismatchedSetException newException:nil stream:input];
104                        [self recover:mse];
105                        @throw mse;
106                    }
107
108
109                    }
110                    break;
111
112                default :
113                    goto loop1;
114            }
115        } while (YES);
116        loop1: ;
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 "ID" */
134// $ANTLR start "DIGIT"
135- (void) mDIGIT
136{
137    //
138    /* ruleScopeSetUp */
139
140    /* ruleDeclarations */
141
142    @try {
143        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/lexertest-simple/TestLexer.g:11:16: ( '0' .. '9' ) // ruleBlockSingleAlt
144        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/lexertest-simple/TestLexer.g: // alt
145        {
146
147        if ((([input LA:1] >= '0') && ([input LA:1] <= '9'))) {
148            [input consume];
149        } else {
150            MismatchedSetException *mse = [MismatchedSetException newException:nil stream:input];
151            [self recover:mse];
152            @throw mse;
153        }
154
155
156        }
157
158
159    }
160    @finally {
161        //
162        /* ruleScopeCleanUp */
163
164    }
165    return;
166}
167/* $ANTLR end "DIGIT" */
168// $ANTLR start "LETTER"
169- (void) mLETTER
170{
171    //
172    /* ruleScopeSetUp */
173
174    /* ruleDeclarations */
175
176    @try {
177        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/lexertest-simple/TestLexer.g:15:2: ( 'a' .. 'z' | 'A' .. 'Z' ) // ruleBlockSingleAlt
178        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/lexertest-simple/TestLexer.g: // alt
179        {
180
181        if ((([input LA:1] >= 'A') && ([input LA:1] <= 'Z'))||(([input LA:1] >= 'a') && ([input LA:1] <= 'z'))) {
182            [input consume];
183        } else {
184            MismatchedSetException *mse = [MismatchedSetException newException:nil stream:input];
185            [self recover:mse];
186            @throw mse;
187        }
188
189
190        }
191
192
193    }
194    @finally {
195        //
196        /* ruleScopeCleanUp */
197
198    }
199    return;
200}
201/* $ANTLR end "LETTER" */
202- (void) mTokens
203{
204    // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/lexertest-simple/TestLexer.g:1:8: ( ID ) // ruleBlockSingleAlt
205    // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/lexertest-simple/TestLexer.g:1:10: ID // alt
206    {
207
208
209    [self mID];
210
211
212
213    }
214
215
216}
217
218@end /* end of TestLexer implementation line 397 */