• 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/treerewrite/TreeRewrite.g
5 *     -                            On : 2012-02-16 17:42:35
6 *     -                 for the lexer : TreeRewriteLexerLexer
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/treerewrite/TreeRewrite.g 2012-02-16 17:42:35
15
16
17/* -----------------------------------------
18 * Include the ANTLR3 generated header file.
19 */
20#import "TreeRewriteLexer.h"
21/* ----------------------------------------- */
22
23
24/* ============================================================================= */
25/* =============================================================================
26 * Start of recognizer
27 */
28
29/** As per Terence: No returns for lexer rules! */
30@implementation TreeRewriteLexer // line 330
31
32+ (void) initialize
33{
34    [BaseRecognizer setGrammarFileName:@"/Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treerewrite/TreeRewrite.g"];
35}
36
37+ (NSString *) tokenNameForType:(NSInteger)aTokenType
38{
39    return [[self getTokenNames] objectAtIndex:aTokenType];
40}
41
42+ (TreeRewriteLexer *)newTreeRewriteLexerWithCharStream:(id<CharStream>)anInput
43{
44    return [[TreeRewriteLexer alloc] initWithCharStream:anInput];
45}
46
47- (id) initWithCharStream:(id<CharStream>)anInput
48{
49    self = [super initWithCharStream:anInput State:[RecognizerSharedState newRecognizerSharedStateWithRuleLen:3+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 "INT"
67- (void) mINT
68{
69    //
70    /* ruleScopeSetUp */
71
72    /* ruleDeclarations */
73
74    @try {
75        NSInteger _type = INT;
76        NSInteger _channel = TokenChannelDefault;
77        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treerewrite/TreeRewrite.g:15:5: ( ( '0' .. '9' )+ ) // ruleBlockSingleAlt
78        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treerewrite/TreeRewrite.g:15:7: ( '0' .. '9' )+ // alt
79        {
80
81        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treerewrite/TreeRewrite.g:15:7: ( '0' .. '9' )+ // positiveClosureBlock
82        NSInteger cnt1 = 0;
83        do {
84            NSInteger alt1 = 2;
85            NSInteger LA1_0 = [input LA:1];
86            if ( ((LA1_0 >= '0' && LA1_0 <= '9')) ) {
87                alt1=1;
88            }
89
90
91            switch (alt1) {
92                case 1 : ;
93                    // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treerewrite/TreeRewrite.g: // alt
94                    {
95
96                    if ((([input LA:1] >= '0') && ([input LA:1] <= '9'))) {
97                        [input consume];
98                    } else {
99                        MismatchedSetException *mse = [MismatchedSetException newException:nil stream:input];
100                        [self recover:mse];
101                        @throw mse;
102                    }
103
104
105                    }
106                    break;
107
108                default :
109                    if ( cnt1 >= 1 )
110                        goto loop1;
111                    EarlyExitException *eee =
112                        [EarlyExitException newException:input decisionNumber:1];
113                    @throw eee;
114            }
115            cnt1++;
116        } while (YES);
117        loop1: ;
118
119
120        }
121
122        /* token+rule list labels */
123
124        state.type = _type;
125        state.channel = _channel;
126    }
127    @finally {
128        //
129        /* ruleScopeCleanUp */
130
131    }
132    return;
133}
134/* $ANTLR end "INT" */
135// $ANTLR start "WS"
136- (void) mWS
137{
138    //
139    /* ruleScopeSetUp */
140
141    /* ruleDeclarations */
142
143    @try {
144        NSInteger _type = WS;
145        NSInteger _channel = TokenChannelDefault;
146        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treerewrite/TreeRewrite.g:18:5: ( ' ' ) // ruleBlockSingleAlt
147        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treerewrite/TreeRewrite.g:18:9: ' ' // alt
148        {
149
150
151        [self matchChar:' '];
152
153
154
155        _channel=HIDDEN;
156
157
158        }
159
160        /* token+rule list labels */
161
162        state.type = _type;
163        state.channel = _channel;
164    }
165    @finally {
166        //
167        /* ruleScopeCleanUp */
168
169    }
170    return;
171}
172/* $ANTLR end "WS" */
173- (void) mTokens
174{
175    // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treerewrite/TreeRewrite.g:1:8: ( INT | WS ) //ruleblock
176    NSInteger alt2=2;
177    NSInteger LA2_0 = [input LA:1];
178
179    if ( ((LA2_0 >= '0' && LA2_0 <= '9')) ) {
180        alt2=1;
181    }
182    else if ( (LA2_0==' ') ) {
183        alt2=2;
184    }
185    else {
186        NoViableAltException *nvae = [NoViableAltException newException:2 state:0 stream:input];
187        nvae.c = LA2_0;
188        @throw nvae;
189
190    }
191    switch (alt2) {
192        case 1 : ;
193            // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treerewrite/TreeRewrite.g:1:10: INT // alt
194            {
195
196
197            [self mINT];
198
199
200
201            }
202            break;
203        case 2 : ;
204            // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treerewrite/TreeRewrite.g:1:14: WS // alt
205            {
206
207
208            [self mWS];
209
210
211
212            }
213            break;
214
215    }
216
217}
218
219@end /* end of TreeRewriteLexer implementation line 397 */