1/** \file
2 *  This OBJC source file was generated by $ANTLR version 3.2 Aug 20, 2010 15:00:19
3 *
4 *     -  From the grammar source file : /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/treerewrite/TreeRewrite.g
5 *     -                            On : 2010-08-20 15:03:14
6 *     -                 for the lexer : TreeRewriteLexerLexer *
7 * Editing it, at least manually, is not wise.
8 *
9 * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
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 20, 2010 15:00:19 /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/treerewrite/TreeRewrite.g 2010-08-20 15:03:14
41
42/* -----------------------------------------
43 * Include the ANTLR3 generated header file.
44 */
45#import "TreeRewriteLexer.h"
46/* ----------------------------------------- */
47
48
49/* ============================================================================= */
50
51/* =============================================================================
52 * Start of recognizer
53 */
54
55
56/** As per Terence: No returns for lexer rules!
57#pragma mark Rule return scopes start
58#pragma mark Rule return scopes end
59*/
60@implementation TreeRewriteLexer // line 330
61
62+ (void) initialize
63{
64    [ANTLRBaseRecognizer setGrammarFileName:@"/usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/treerewrite/TreeRewrite.g"];
65}
66
67+ (NSString *) tokenNameForType:(NSInteger)aTokenType
68{
69    return [[self getTokenNames] objectAtIndex:aTokenType];
70}
71
72+ (TreeRewriteLexer *)newTreeRewriteLexer:(id<ANTLRCharStream>)anInput
73{
74    return [[TreeRewriteLexer alloc] initWithCharStream:anInput];
75}
76
77- (id) initWithCharStream:(id<ANTLRCharStream>)anInput
78{
79    if ((self = [super initWithCharStream:anInput State:[ANTLRRecognizerSharedState newANTLRRecognizerSharedStateWithRuleLen:3+1]]) != nil) {
80
81    }
82    return self;
83}
84
85- (void) dealloc
86{
87    [super dealloc];
88}
89
90// Start of actions.lexer.methods
91// start methods()
92
93// Start of Rules
94// $ANTLR start "INT"
95- (void) mINT
96{
97    //
98    // ruleScopeSetUp
99
100    @try {
101        NSInteger _type = INT;
102        NSInteger _channel = ANTLRTokenChannelDefault;
103        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/treerewrite/TreeRewrite.g:15:5: ( ( '0' .. '9' )+ ) // ruleBlockSingleAlt
104        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/treerewrite/TreeRewrite.g:15:7: ( '0' .. '9' )+ // alt
105        {
106        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/treerewrite/TreeRewrite.g:15:7: ( '0' .. '9' )+ // positiveClosureBlock
107        NSInteger cnt1=0;
108        do {
109            NSInteger alt1=2;
110            NSInteger LA1_0 = [input LA:1];
111            if ( ((LA1_0>='0' && LA1_0<='9')) ) {
112                alt1=1;
113            }
114
115
116            switch (alt1) {
117                case 1 : ;
118                    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/treerewrite/TreeRewrite.g:15:8: '0' .. '9' // alt
119                    {
120                    [self matchRangeFromChar:'0' to:'9'];   /* element() */
121                     /* elements */
122                    }
123                    break;
124
125                default :
126                    if ( cnt1 >= 1 )
127                        goto loop1;
128                    ANTLREarlyExitException *eee = [ANTLREarlyExitException exceptionWithStream:input decisionNumber:1];
129                    @throw eee;
130            }
131            cnt1++;
132        } while (YES);
133        loop1: ;
134          /* element() */
135         /* elements */
136        }
137
138        // token+rule list labels
139
140        [state setType:_type];
141
142        state.channel = _channel;
143    }
144    @finally {
145        //
146    }
147    return;
148}
149// $ANTLR end "INT"
150
151// $ANTLR start "WS"
152- (void) mWS
153{
154    //
155    // ruleScopeSetUp
156
157    @try {
158        NSInteger _type = WS;
159        NSInteger _channel = ANTLRTokenChannelDefault;
160        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/treerewrite/TreeRewrite.g:18:5: ( ' ' ) // ruleBlockSingleAlt
161        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/treerewrite/TreeRewrite.g:18:9: ' ' // alt
162        {
163        [self matchChar:' '];
164          /* element() */
165        state.channel=99;  /* element() */
166         /* elements */
167        }
168
169        // token+rule list labels
170
171        [state setType:_type];
172
173        state.channel = _channel;
174    }
175    @finally {
176        //
177    }
178    return;
179}
180// $ANTLR end "WS"
181
182- (void) mTokens
183{
184    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/treerewrite/TreeRewrite.g:1:8: ( INT | WS ) //ruleblock
185    NSInteger alt2=2;
186    NSInteger LA2_0 = [input LA:1];
187
188    if ( ((LA2_0>='0' && LA2_0<='9')) ) {
189        alt2=1;
190    }
191    else if ( (LA2_0==' ') ) {
192        alt2=2;
193    }
194    else {
195        ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newANTLRNoViableAltException:2 state:0 stream:input];
196        @throw nvae;
197    }
198    switch (alt2) {
199        case 1 : ;
200            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/treerewrite/TreeRewrite.g:1:10: INT // alt
201            {
202                [self mINT];
203              /* element() */
204             /* elements */
205            }
206            break;
207        case 2 : ;
208            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/treerewrite/TreeRewrite.g:1:14: WS // alt
209            {
210                [self mWS];
211              /* element() */
212             /* elements */
213            }
214            break;
215
216    }
217
218}
219
220@end // end of TreeRewriteLexer implementation // line 397
221
222/* End of code
223 * =============================================================================
224 */
225