1/** \file
2 *  This OBJC source file was generated by $ANTLR version ${project.version} ${buildNumber}
3 *
4 *     -  From the grammar source file : TreeRewrite.g
5 *     -                            On : 2011-05-06 18:56:28
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 ${project.version} ${buildNumber} TreeRewrite.g 2011-05-06 18:56:28
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    [ANTLRBaseRecognizer setGrammarFileName:@"TreeRewrite.g"];
35}
36
37+ (NSString *) tokenNameForType:(NSInteger)aTokenType
38{
39    return [[self getTokenNames] objectAtIndex:aTokenType];
40}
41
42+ (TreeRewriteLexer *)newTreeRewriteLexerWithCharStream:(id<ANTLRCharStream>)anInput
43{
44    return [[TreeRewriteLexer alloc] initWithCharStream:anInput];
45}
46
47- (id) initWithCharStream:(id<ANTLRCharStream>)anInput
48{
49    self = [super initWithCharStream:anInput State:[[ANTLRRecognizerSharedState newANTLRRecognizerSharedStateWithRuleLen:3+1] retain]];
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    /* my ruleScopeSetUp */
71    /* Terence's stuff */
72
73    @try {
74        NSInteger _type = INT;
75        NSInteger _channel = ANTLRTokenChannelDefault;
76        // TreeRewrite.g:15:5: ( ( '0' .. '9' )+ ) // ruleBlockSingleAlt
77        // TreeRewrite.g:15:7: ( '0' .. '9' )+ // alt
78        {
79        // TreeRewrite.g:15:7: ( '0' .. '9' )+ // positiveClosureBlock
80        NSInteger cnt1 = 0;
81        do {
82            NSInteger alt1 = 2;
83            NSInteger LA1_0 = [input LA:1];
84            if ( ((LA1_0 >= '0' && LA1_0 <= '9')) ) {
85                alt1=1;
86            }
87
88
89            switch (alt1) {
90                case 1 : ;
91                    // TreeRewrite.g: // alt
92                    {
93                    if ((([input LA:1] >= '0') && ([input LA:1] <= '9'))) {
94                        [input consume];
95                    } else {
96                        ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException newException:nil stream:input];
97                        [self recover:mse];
98                        @throw mse;
99                    }
100
101
102                    }
103                    break;
104
105                default :
106                    if ( cnt1 >= 1 )
107                        goto loop1;
108                    ANTLREarlyExitException *eee =
109                        [ANTLREarlyExitException newException:input decisionNumber:1];
110                    @throw eee;
111            }
112            cnt1++;
113        } while (YES);
114        loop1: ;
115
116
117        }
118
119        // token+rule list labels
120
121        state.type = _type;
122        state.channel = _channel;
123    }
124    @finally {
125        //
126        /* Terence's stuff */
127
128    }
129    return;
130}
131/* $ANTLR end "INT" */
132
133// $ANTLR start "WS"
134- (void) mWS
135{
136    //
137    /* my ruleScopeSetUp */
138    /* Terence's stuff */
139
140    @try {
141        NSInteger _type = WS;
142        NSInteger _channel = ANTLRTokenChannelDefault;
143        // TreeRewrite.g:18:5: ( ' ' ) // ruleBlockSingleAlt
144        // TreeRewrite.g:18:9: ' ' // alt
145        {
146        [self matchChar:' '];
147
148
149        _channel=HIDDEN;
150
151
152        }
153
154        // token+rule list labels
155
156        state.type = _type;
157        state.channel = _channel;
158    }
159    @finally {
160        //
161        /* Terence's stuff */
162
163    }
164    return;
165}
166/* $ANTLR end "WS" */
167
168- (void) mTokens
169{
170    // TreeRewrite.g:1:8: ( INT | WS ) //ruleblock
171    NSInteger alt2=2;
172    NSInteger LA2_0 = [input LA:1];
173
174    if ( ((LA2_0 >= '0' && LA2_0 <= '9')) ) {
175        alt2=1;
176    }
177    else if ( (LA2_0==' ') ) {
178        alt2=2;
179    }
180    else {
181        ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:2 state:0 stream:input];
182        nvae.c = LA2_0;
183        @throw nvae;
184
185    }
186    switch (alt2) {
187        case 1 : ;
188            // TreeRewrite.g:1:10: INT // alt
189            {
190            [self mINT];
191
192
193
194            }
195            break;
196        case 2 : ;
197            // TreeRewrite.g:1:14: WS // alt
198            {
199            [self mWS];
200
201
202
203            }
204            break;
205
206    }
207
208}
209
210@end /* end of TreeRewriteLexer implementation line 397 */