• 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/treeparser/LangDumpDecl.g
5 *     -                            On : 2012-02-16 17:59:08
6 *     -           for the tree parser : LangDumpDeclTreeParser
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/treeparser/LangDumpDecl.g 2012-02-16 17:59:08
15
16
17/* -----------------------------------------
18 * Include the ANTLR3 generated header file.
19 */
20#import "LangDumpDecl.h"
21/* ----------------------------------------- */
22
23
24/* ============================================================================= */
25/* =============================================================================
26 * Start of recognizer
27 */
28
29#pragma mark Bitsets
30static ANTLRBitSet *FOLLOW_DECL_in_decl45;
31static const unsigned long long FOLLOW_DECL_in_decl45_data[] = { 0x0000000000000004LL};
32static ANTLRBitSet *FOLLOW_type_in_decl47;
33static const unsigned long long FOLLOW_type_in_decl47_data[] = { 0x0000000000000040LL};
34static ANTLRBitSet *FOLLOW_declarator_in_decl49;
35static const unsigned long long FOLLOW_declarator_in_decl49_data[] = { 0x0000000000000008LL};
36static ANTLRBitSet *FOLLOW_INTTYPE_in_type81;
37static const unsigned long long FOLLOW_INTTYPE_in_type81_data[] = { 0x0000000000000002LL};
38static ANTLRBitSet *FOLLOW_ID_in_declarator95;
39static const unsigned long long FOLLOW_ID_in_declarator95_data[] = { 0x0000000000000002LL};
40
41
42#pragma mark Dynamic Global globalAttributeScopeImplementation
43
44#pragma mark Dynamic Rule Scopes ruleAttributeScopeImplementation
45
46#pragma mark Rule Return Scopes returnScopeImplementation
47@implementation LangDumpDecl_declarator_return /* returnScopeImplementation */
48 /* start of synthesize -- OBJC-Line 1837 */
49+ (LangDumpDecl_declarator_return *)newLangDumpDecl_declarator_return
50{
51return [[[LangDumpDecl_declarator_return alloc] init] retain];
52}
53
54- (id) init
55{
56self = [super init];
57return self;
58}
59
60
61
62@end /* end of returnScope implementation */
63
64
65
66@implementation LangDumpDecl  // line 637
67
68/* ObjC start of ruleAttributeScope */
69#pragma mark Dynamic Rule Scopes ruleAttributeScope
70/* ObjC end of ruleAttributeScope */
71#pragma mark global Attribute Scopes globalAttributeScope
72/* ObjC start globalAttributeScope */
73/* ObjC end globalAttributeScope */
74/* ObjC start actions.(actionScope).synthesize */
75/* ObjC start synthesize() */
76
77+ (void) initialize
78{
79    #pragma mark Bitsets
80    FOLLOW_DECL_in_decl45 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_DECL_in_decl45_data Count:(NSUInteger)1] retain];
81    FOLLOW_type_in_decl47 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_decl47_data Count:(NSUInteger)1] retain];
82    FOLLOW_declarator_in_decl49 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_decl49_data Count:(NSUInteger)1] retain];
83    FOLLOW_INTTYPE_in_type81 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_INTTYPE_in_type81_data Count:(NSUInteger)1] retain];
84    FOLLOW_ID_in_declarator95 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_declarator95_data Count:(NSUInteger)1] retain];
85
86    [BaseRecognizer setTokenNames:[[AMutableArray arrayWithObjects:@"<invalid>", @"<EOR>", @"<DOWN>", @"<UP>",
87 @"DECL", @"FLOATTYPE", @"ID", @"INT", @"INTTYPE", @"WS", @"';'", nil] retain]];
88    [BaseRecognizer setGrammarFileName:@"/Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/LangDumpDecl.g"];
89}
90
91+ (LangDumpDecl *)newLangDumpDecl:(id<TreeNodeStream>)aStream
92{
93    return [[LangDumpDecl alloc] initWithStream:aStream];
94}
95
96- (id) initWithStream:(id<TreeNodeStream>)aStream
97{
98    self = [super initWithStream:aStream State:[[RecognizerSharedState newRecognizerSharedStateWithRuleLen:3+1] retain]];
99    if ( self != nil ) {
100        /* start of actions-actionScope-init */
101        /* start of init */
102    }
103    return self;
104}
105
106- (void) dealloc
107{
108    [super dealloc];
109}
110
111/* ObjC start actions.(actionScope).methods */
112/* ObjC end actions.(actionScope).methods */
113/* ObjC start methods() */
114/* ObjC end methods() */
115/* ObjC start rules */
116/*
117 * $ANTLR start decl
118 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/LangDumpDecl.g:8:1: decl : ^( DECL type declarator ) ;
119 */
120- (void) decl
121{
122    /* ruleScopeSetUp */
123
124    /* ruleDeclarations */
125
126    @try {
127        /* ruleLabelDefs entry */
128        LangDumpDecl_declarator_return * declarator1 = nil ;
129
130
131        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/LangDumpDecl.g:8:6: ( ^( DECL type declarator ) ) // ruleBlockSingleAlt
132        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/LangDumpDecl.g:8:8: ^( DECL type declarator ) // alt
133        {
134
135
136        [self match:input TokenType:DECL Follow:FOLLOW_DECL_in_decl45];
137
138            [self match:input TokenType:DOWN Follow:nil];
139
140            /* ruleRef */
141            [self pushFollow:FOLLOW_type_in_decl47];
142            [self type];
143
144            [self popFollow];
145
146
147
148            /* ruleRef */
149            [self pushFollow:FOLLOW_declarator_in_decl49];
150            declarator1 = [self declarator];
151
152            [self popFollow];
153
154
155
156            [self match:input TokenType:UP Follow:nil];
157
158
159
160         NSLog(@"int %@", (declarator1!=nil?[[input getTokenStream] toStringFromStart:[[input getTreeAdaptor] getTokenStartIndex:[declarator1 getStart]]ToEnd:[[input getTreeAdaptor] getTokenStopIndex:[declarator1 getStart]]]:0));
161
162
163        }
164
165        /* token+rule list labels */
166
167    }
168    @catch (RecognitionException *re) {
169        [self reportError:re];
170        [self recover:input Exception:re];
171    }
172
173    @finally {
174        /* ruleScopeCleanUp */
175
176    }
177    return ;
178}
179/* $ANTLR end decl */
180
181/*
182 * $ANTLR start type
183 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/LangDumpDecl.g:13:1: type : INTTYPE ;
184 */
185- (void) type
186{
187    /* ruleScopeSetUp */
188
189    /* ruleDeclarations */
190
191    @try {
192        /* ruleLabelDefs entry */
193
194
195        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/LangDumpDecl.g:13:6: ( INTTYPE ) // ruleBlockSingleAlt
196        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/LangDumpDecl.g:13:8: INTTYPE // alt
197        {
198
199        [self match:input TokenType:INTTYPE Follow:FOLLOW_INTTYPE_in_type81];
200
201        }
202
203        /* token+rule list labels */
204
205    }
206    @catch (RecognitionException *re) {
207        [self reportError:re];
208        [self recover:input Exception:re];
209    }
210
211    @finally {
212        /* ruleScopeCleanUp */
213
214    }
215    return ;
216}
217/* $ANTLR end type */
218
219/*
220 * $ANTLR start declarator
221 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/LangDumpDecl.g:15:1: declarator : ID ;
222 */
223- (LangDumpDecl_declarator_return *) declarator
224{
225    /* ruleScopeSetUp */
226
227    /* ruleDeclarations */
228    LangDumpDecl_declarator_return * retval = [LangDumpDecl_declarator_return newLangDumpDecl_declarator_return];
229    [retval setStart:[input LT:1]];
230
231
232    @try {
233        /* ruleLabelDefs entry */
234
235
236        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/LangDumpDecl.g:16:6: ( ID ) // ruleBlockSingleAlt
237        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/LangDumpDecl.g:16:8: ID // alt
238        {
239
240        [self match:input TokenType:ID Follow:FOLLOW_ID_in_declarator95];
241
242        }
243
244        /* token+rule list labels */
245
246    }
247    @catch (RecognitionException *re) {
248        [self reportError:re];
249        [self recover:input Exception:re];
250    }
251
252    @finally {
253        /* ruleScopeCleanUp */
254
255    }
256    return retval;
257}
258/* $ANTLR end declarator */
259/* ObjC end rules */
260
261@end /* end of LangDumpDecl implementation line 692 */
262