• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/** \file
2 *  This OBJC source file was generated by $ANTLR version 3.2 Aug 23, 2010 07:48:06
3 *
4 *     -  From the grammar source file : /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g
5 *     -                            On : 2010-08-23 07:54:46
6 *     -                for the parser : SimpleCParserParser *
7 * Editing it, at least manually, is not wise.
8 *
9 * ObjC language generator and runtime by Alan Condit, acondit|hereisanat|ipns|dotgoeshere|com.
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 23, 2010 07:48:06 /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g 2010-08-23 07:54:46
41
42/* -----------------------------------------
43 * Include the ANTLR3 generated header file.
44 */
45#import "SimpleCParser.h"
46/* ----------------------------------------- */
47
48
49/* ============================================================================= */
50
51/* =============================================================================
52 * Start of recognizer
53 */
54
55
56#pragma mark Cyclic DFA implementation start DFA2
57@implementation DFA2
58const static NSInteger dfa2_eot[13] =
59    {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
60const static NSInteger dfa2_eof[13] =
61    {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
62const static unichar dfa2_min[13] =
63    {10,10,21,10,0,10,21,23,0,0,10,10,23};
64const static unichar dfa2_max[13] =
65    {13,10,22,24,0,10,25,24,0,0,13,10,24};
66const static NSInteger dfa2_accept[13] =
67    {-1,-1,-1,-1,1,-1,-1,-1,3,2,-1,-1,-1};
68const static NSInteger dfa2_special[13] =
69    {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
70const static NSInteger dfa2_transition[] = {};
71const static NSInteger dfa2_transition0[] = {9, -1, -1, -1, 8};
72const static NSInteger dfa2_transition1[] = {10, 6};
73const static NSInteger dfa2_transition2[] = {5, 5, 5, 5, -1, -1, -1, -1,
74 -1, -1, -1, -1, -1, -1, 6};
75const static NSInteger dfa2_transition3[] = {11, 11, 11, 11};
76const static NSInteger dfa2_transition4[] = {4, 3};
77const static NSInteger dfa2_transition5[] = {1, 1, 1, 1};
78const static NSInteger dfa2_transition6[] = {7};
79const static NSInteger dfa2_transition7[] = {12};
80const static NSInteger dfa2_transition8[] = {2};
81
82
83+ () newDFA2WithRecognizer:(ANTLRBaseRecognizer *)aRecognizer
84{
85    return [[[DFA2 alloc] initWithRecognizer:aRecognizer] retain];
86}
87
88- (id) initWithRecognizer:(ANTLRBaseRecognizer *) theRecognizer
89{
90    if ((self = [super initWithRecognizer:theRecognizer]) != nil) {
91        decisionNumber = 2;
92        eot = dfa2_eot;
93        eof = dfa2_eof;
94        min = dfa2_min;
95        max = dfa2_max;
96        accept = dfa2_accept;
97        special = dfa2_special;
98        if (!(transition = calloc(13, sizeof(void*)))) {
99            [self release];
100            return nil;
101        }
102        len = 13;
103        transition[0] = dfa2_transition5;
104        transition[1] = dfa2_transition8;
105        transition[2] = dfa2_transition4;
106        transition[3] = dfa2_transition2;
107        transition[4] = dfa2_transition;
108        transition[5] = dfa2_transition6;
109        transition[6] = dfa2_transition0;
110        transition[7] = dfa2_transition1;
111        transition[8] = dfa2_transition;
112        transition[9] = dfa2_transition;
113        transition[10] = dfa2_transition3;
114        transition[11] = dfa2_transition7;
115        transition[12] = dfa2_transition1;
116    }
117    return self;
118}
119
120- (void) dealloc
121{
122    free(transition);
123    [super dealloc];
124}
125
126- (NSString *) description
127{
128    return @"20:1: declaration : ( variable | functionHeader ';' -> ^( FUNC_DECL functionHeader ) | functionHeader block -> ^( FUNC_DEF functionHeader block ) );";
129}
130
131
132@end /* end DFA2 implementation */
133
134#pragma mark Cyclic DFA implementation end DFA2
135
136
137
138#pragma mark Bitsets
139static ANTLRBitSet *FOLLOW_declaration_in_program85;
140static const unsigned long long FOLLOW_declaration_in_program85_data[] = { 0x0000000000003C02LL};
141static ANTLRBitSet *FOLLOW_variable_in_declaration105;
142static const unsigned long long FOLLOW_variable_in_declaration105_data[] = { 0x0000000000000002LL};
143static ANTLRBitSet *FOLLOW_functionHeader_in_declaration115;
144static const unsigned long long FOLLOW_functionHeader_in_declaration115_data[] = { 0x0000000000200000LL};
145static ANTLRBitSet *FOLLOW_21_in_declaration117;
146static const unsigned long long FOLLOW_21_in_declaration117_data[] = { 0x0000000000000002LL};
147static ANTLRBitSet *FOLLOW_functionHeader_in_declaration135;
148static const unsigned long long FOLLOW_functionHeader_in_declaration135_data[] = { 0x0000000002000000LL};
149static ANTLRBitSet *FOLLOW_block_in_declaration137;
150static const unsigned long long FOLLOW_block_in_declaration137_data[] = { 0x0000000000000002LL};
151static ANTLRBitSet *FOLLOW_type_in_variable166;
152static const unsigned long long FOLLOW_type_in_variable166_data[] = { 0x0000000000000400LL};
153static ANTLRBitSet *FOLLOW_declarator_in_variable168;
154static const unsigned long long FOLLOW_declarator_in_variable168_data[] = { 0x0000000000200000LL};
155static ANTLRBitSet *FOLLOW_21_in_variable170;
156static const unsigned long long FOLLOW_21_in_variable170_data[] = { 0x0000000000000002LL};
157static ANTLRBitSet *FOLLOW_K_ID_in_declarator199;
158static const unsigned long long FOLLOW_K_ID_in_declarator199_data[] = { 0x0000000000000002LL};
159static ANTLRBitSet *FOLLOW_type_in_functionHeader219;
160static const unsigned long long FOLLOW_type_in_functionHeader219_data[] = { 0x0000000000000400LL};
161static ANTLRBitSet *FOLLOW_K_ID_in_functionHeader221;
162static const unsigned long long FOLLOW_K_ID_in_functionHeader221_data[] = { 0x0000000000400000LL};
163static ANTLRBitSet *FOLLOW_22_in_functionHeader223;
164static const unsigned long long FOLLOW_22_in_functionHeader223_data[] = { 0x0000000001003C00LL};
165static ANTLRBitSet *FOLLOW_formalParameter_in_functionHeader227;
166static const unsigned long long FOLLOW_formalParameter_in_functionHeader227_data[] = { 0x0000000001800000LL};
167static ANTLRBitSet *FOLLOW_23_in_functionHeader231;
168static const unsigned long long FOLLOW_23_in_functionHeader231_data[] = { 0x0000000000003C00LL};
169static ANTLRBitSet *FOLLOW_formalParameter_in_functionHeader233;
170static const unsigned long long FOLLOW_formalParameter_in_functionHeader233_data[] = { 0x0000000001800000LL};
171static ANTLRBitSet *FOLLOW_24_in_functionHeader241;
172static const unsigned long long FOLLOW_24_in_functionHeader241_data[] = { 0x0000000000000002LL};
173static ANTLRBitSet *FOLLOW_type_in_formalParameter281;
174static const unsigned long long FOLLOW_type_in_formalParameter281_data[] = { 0x0000000000000400LL};
175static ANTLRBitSet *FOLLOW_declarator_in_formalParameter283;
176static const unsigned long long FOLLOW_declarator_in_formalParameter283_data[] = { 0x0000000000000002LL};
177static ANTLRBitSet *FOLLOW_set_in_type0;
178static const unsigned long long FOLLOW_set_in_type0_data[] = { 0x0000000000000002LL};
179static ANTLRBitSet *FOLLOW_25_in_block376;
180static const unsigned long long FOLLOW_25_in_block376_data[] = { 0x0000000006607C00LL};
181static ANTLRBitSet *FOLLOW_variable_in_block390;
182static const unsigned long long FOLLOW_variable_in_block390_data[] = { 0x0000000006607C00LL};
183static ANTLRBitSet *FOLLOW_stat_in_block405;
184static const unsigned long long FOLLOW_stat_in_block405_data[] = { 0x0000000006604C00LL};
185static ANTLRBitSet *FOLLOW_26_in_block416;
186static const unsigned long long FOLLOW_26_in_block416_data[] = { 0x0000000000000002LL};
187static ANTLRBitSet *FOLLOW_forStat_in_stat449;
188static const unsigned long long FOLLOW_forStat_in_stat449_data[] = { 0x0000000000000002LL};
189static ANTLRBitSet *FOLLOW_expr_in_stat457;
190static const unsigned long long FOLLOW_expr_in_stat457_data[] = { 0x0000000000200000LL};
191static ANTLRBitSet *FOLLOW_21_in_stat459;
192static const unsigned long long FOLLOW_21_in_stat459_data[] = { 0x0000000000000002LL};
193static ANTLRBitSet *FOLLOW_block_in_stat468;
194static const unsigned long long FOLLOW_block_in_stat468_data[] = { 0x0000000000000002LL};
195static ANTLRBitSet *FOLLOW_assignStat_in_stat476;
196static const unsigned long long FOLLOW_assignStat_in_stat476_data[] = { 0x0000000000200000LL};
197static ANTLRBitSet *FOLLOW_21_in_stat478;
198static const unsigned long long FOLLOW_21_in_stat478_data[] = { 0x0000000000000002LL};
199static ANTLRBitSet *FOLLOW_21_in_stat487;
200static const unsigned long long FOLLOW_21_in_stat487_data[] = { 0x0000000000000002LL};
201static ANTLRBitSet *FOLLOW_K_FOR_in_forStat507;
202static const unsigned long long FOLLOW_K_FOR_in_forStat507_data[] = { 0x0000000000400000LL};
203static ANTLRBitSet *FOLLOW_22_in_forStat509;
204static const unsigned long long FOLLOW_22_in_forStat509_data[] = { 0x0000000000000400LL};
205static ANTLRBitSet *FOLLOW_assignStat_in_forStat513;
206static const unsigned long long FOLLOW_assignStat_in_forStat513_data[] = { 0x0000000000200000LL};
207static ANTLRBitSet *FOLLOW_21_in_forStat515;
208static const unsigned long long FOLLOW_21_in_forStat515_data[] = { 0x0000000000400C00LL};
209static ANTLRBitSet *FOLLOW_expr_in_forStat517;
210static const unsigned long long FOLLOW_expr_in_forStat517_data[] = { 0x0000000000200000LL};
211static ANTLRBitSet *FOLLOW_21_in_forStat519;
212static const unsigned long long FOLLOW_21_in_forStat519_data[] = { 0x0000000000000400LL};
213static ANTLRBitSet *FOLLOW_assignStat_in_forStat523;
214static const unsigned long long FOLLOW_assignStat_in_forStat523_data[] = { 0x0000000001000000LL};
215static ANTLRBitSet *FOLLOW_24_in_forStat525;
216static const unsigned long long FOLLOW_24_in_forStat525_data[] = { 0x0000000002000000LL};
217static ANTLRBitSet *FOLLOW_block_in_forStat527;
218static const unsigned long long FOLLOW_block_in_forStat527_data[] = { 0x0000000000000002LL};
219static ANTLRBitSet *FOLLOW_K_ID_in_assignStat570;
220static const unsigned long long FOLLOW_K_ID_in_assignStat570_data[] = { 0x0000000000008000LL};
221static ANTLRBitSet *FOLLOW_K_EQ_in_assignStat572;
222static const unsigned long long FOLLOW_K_EQ_in_assignStat572_data[] = { 0x0000000000400C00LL};
223static ANTLRBitSet *FOLLOW_expr_in_assignStat574;
224static const unsigned long long FOLLOW_expr_in_assignStat574_data[] = { 0x0000000000000002LL};
225static ANTLRBitSet *FOLLOW_condExpr_in_expr598;
226static const unsigned long long FOLLOW_condExpr_in_expr598_data[] = { 0x0000000000000002LL};
227static ANTLRBitSet *FOLLOW_aexpr_in_condExpr617;
228static const unsigned long long FOLLOW_aexpr_in_condExpr617_data[] = { 0x0000000000030002LL};
229static ANTLRBitSet *FOLLOW_K_EQEQ_in_condExpr622;
230static const unsigned long long FOLLOW_K_EQEQ_in_condExpr622_data[] = { 0x0000000000400C00LL};
231static ANTLRBitSet *FOLLOW_K_LT_in_condExpr627;
232static const unsigned long long FOLLOW_K_LT_in_condExpr627_data[] = { 0x0000000000400C00LL};
233static ANTLRBitSet *FOLLOW_aexpr_in_condExpr631;
234static const unsigned long long FOLLOW_aexpr_in_condExpr631_data[] = { 0x0000000000000002LL};
235static ANTLRBitSet *FOLLOW_atom_in_aexpr653;
236static const unsigned long long FOLLOW_atom_in_aexpr653_data[] = { 0x0000000000040002LL};
237static ANTLRBitSet *FOLLOW_K_PLUS_in_aexpr657;
238static const unsigned long long FOLLOW_K_PLUS_in_aexpr657_data[] = { 0x0000000000400C00LL};
239static ANTLRBitSet *FOLLOW_atom_in_aexpr660;
240static const unsigned long long FOLLOW_atom_in_aexpr660_data[] = { 0x0000000000040002LL};
241static ANTLRBitSet *FOLLOW_K_ID_in_atom680;
242static const unsigned long long FOLLOW_K_ID_in_atom680_data[] = { 0x0000000000000002LL};
243static ANTLRBitSet *FOLLOW_K_INT_in_atom694;
244static const unsigned long long FOLLOW_K_INT_in_atom694_data[] = { 0x0000000000000002LL};
245static ANTLRBitSet *FOLLOW_22_in_atom708;
246static const unsigned long long FOLLOW_22_in_atom708_data[] = { 0x0000000000400C00LL};
247static ANTLRBitSet *FOLLOW_expr_in_atom710;
248static const unsigned long long FOLLOW_expr_in_atom710_data[] = { 0x0000000001000000LL};
249static ANTLRBitSet *FOLLOW_24_in_atom712;
250static const unsigned long long FOLLOW_24_in_atom712_data[] = { 0x0000000000000002LL};
251
252
253#pragma mark Dynamic Global Scopes
254
255#pragma mark Dynamic Rule Scopes
256
257#pragma mark Rule return scopes start
258@implementation SimpleCParser_program_return
259+ (SimpleCParser_program_return *)newSimpleCParser_program_return
260{
261    return [[[SimpleCParser_program_return alloc] init] retain];
262}
263
264/* AST returnScope.methods */
265- (ANTLRCommonTree *)getTree
266{
267    return tree;
268}
269
270- (void) setTree:(ANTLRCommonTree *)aTree
271{
272    if (tree != aTree) {
273        if (tree != nil) [tree release];
274        if (aTree != nil) [aTree retain];
275        tree = aTree;
276    }
277}
278
279- (void) dealloc
280{
281    [self setTree:nil];
282    [super dealloc];
283}
284
285
286
287
288@end /* end of returnScope implementation */
289
290@implementation SimpleCParser_declaration_return
291+ (SimpleCParser_declaration_return *)newSimpleCParser_declaration_return
292{
293    return [[[SimpleCParser_declaration_return alloc] init] retain];
294}
295
296/* AST returnScope.methods */
297- (ANTLRCommonTree *)getTree
298{
299    return tree;
300}
301
302- (void) setTree:(ANTLRCommonTree *)aTree
303{
304    if (tree != aTree) {
305        if (tree != nil) [tree release];
306        if (aTree != nil) [aTree retain];
307        tree = aTree;
308    }
309}
310
311- (void) dealloc
312{
313    [self setTree:nil];
314    [super dealloc];
315}
316
317
318
319
320@end /* end of returnScope implementation */
321
322@implementation SimpleCParser_variable_return
323+ (SimpleCParser_variable_return *)newSimpleCParser_variable_return
324{
325    return [[[SimpleCParser_variable_return alloc] init] retain];
326}
327
328/* AST returnScope.methods */
329- (ANTLRCommonTree *)getTree
330{
331    return tree;
332}
333
334- (void) setTree:(ANTLRCommonTree *)aTree
335{
336    if (tree != aTree) {
337        if (tree != nil) [tree release];
338        if (aTree != nil) [aTree retain];
339        tree = aTree;
340    }
341}
342
343- (void) dealloc
344{
345    [self setTree:nil];
346    [super dealloc];
347}
348
349
350
351
352@end /* end of returnScope implementation */
353
354@implementation SimpleCParser_declarator_return
355+ (SimpleCParser_declarator_return *)newSimpleCParser_declarator_return
356{
357    return [[[SimpleCParser_declarator_return alloc] init] retain];
358}
359
360/* AST returnScope.methods */
361- (ANTLRCommonTree *)getTree
362{
363    return tree;
364}
365
366- (void) setTree:(ANTLRCommonTree *)aTree
367{
368    if (tree != aTree) {
369        if (tree != nil) [tree release];
370        if (aTree != nil) [aTree retain];
371        tree = aTree;
372    }
373}
374
375- (void) dealloc
376{
377    [self setTree:nil];
378    [super dealloc];
379}
380
381
382
383
384@end /* end of returnScope implementation */
385
386@implementation SimpleCParser_functionHeader_return
387+ (SimpleCParser_functionHeader_return *)newSimpleCParser_functionHeader_return
388{
389    return [[[SimpleCParser_functionHeader_return alloc] init] retain];
390}
391
392/* AST returnScope.methods */
393- (ANTLRCommonTree *)getTree
394{
395    return tree;
396}
397
398- (void) setTree:(ANTLRCommonTree *)aTree
399{
400    if (tree != aTree) {
401        if (tree != nil) [tree release];
402        if (aTree != nil) [aTree retain];
403        tree = aTree;
404    }
405}
406
407- (void) dealloc
408{
409    [self setTree:nil];
410    [super dealloc];
411}
412
413
414
415
416@end /* end of returnScope implementation */
417
418@implementation SimpleCParser_formalParameter_return
419+ (SimpleCParser_formalParameter_return *)newSimpleCParser_formalParameter_return
420{
421    return [[[SimpleCParser_formalParameter_return alloc] init] retain];
422}
423
424/* AST returnScope.methods */
425- (ANTLRCommonTree *)getTree
426{
427    return tree;
428}
429
430- (void) setTree:(ANTLRCommonTree *)aTree
431{
432    if (tree != aTree) {
433        if (tree != nil) [tree release];
434        if (aTree != nil) [aTree retain];
435        tree = aTree;
436    }
437}
438
439- (void) dealloc
440{
441    [self setTree:nil];
442    [super dealloc];
443}
444
445
446
447
448@end /* end of returnScope implementation */
449
450@implementation SimpleCParser_type_return
451+ (SimpleCParser_type_return *)newSimpleCParser_type_return
452{
453    return [[[SimpleCParser_type_return alloc] init] retain];
454}
455
456/* AST returnScope.methods */
457- (ANTLRCommonTree *)getTree
458{
459    return tree;
460}
461
462- (void) setTree:(ANTLRCommonTree *)aTree
463{
464    if (tree != aTree) {
465        if (tree != nil) [tree release];
466        if (aTree != nil) [aTree retain];
467        tree = aTree;
468    }
469}
470
471- (void) dealloc
472{
473    [self setTree:nil];
474    [super dealloc];
475}
476
477
478
479
480@end /* end of returnScope implementation */
481
482@implementation SimpleCParser_block_return
483+ (SimpleCParser_block_return *)newSimpleCParser_block_return
484{
485    return [[[SimpleCParser_block_return alloc] init] retain];
486}
487
488/* AST returnScope.methods */
489- (ANTLRCommonTree *)getTree
490{
491    return tree;
492}
493
494- (void) setTree:(ANTLRCommonTree *)aTree
495{
496    if (tree != aTree) {
497        if (tree != nil) [tree release];
498        if (aTree != nil) [aTree retain];
499        tree = aTree;
500    }
501}
502
503- (void) dealloc
504{
505    [self setTree:nil];
506    [super dealloc];
507}
508
509
510
511
512@end /* end of returnScope implementation */
513
514@implementation SimpleCParser_stat_return
515+ (SimpleCParser_stat_return *)newSimpleCParser_stat_return
516{
517    return [[[SimpleCParser_stat_return alloc] init] retain];
518}
519
520/* AST returnScope.methods */
521- (ANTLRCommonTree *)getTree
522{
523    return tree;
524}
525
526- (void) setTree:(ANTLRCommonTree *)aTree
527{
528    if (tree != aTree) {
529        if (tree != nil) [tree release];
530        if (aTree != nil) [aTree retain];
531        tree = aTree;
532    }
533}
534
535- (void) dealloc
536{
537    [self setTree:nil];
538    [super dealloc];
539}
540
541
542
543
544@end /* end of returnScope implementation */
545
546@implementation SimpleCParser_forStat_return
547+ (SimpleCParser_forStat_return *)newSimpleCParser_forStat_return
548{
549    return [[[SimpleCParser_forStat_return alloc] init] retain];
550}
551
552/* AST returnScope.methods */
553- (ANTLRCommonTree *)getTree
554{
555    return tree;
556}
557
558- (void) setTree:(ANTLRCommonTree *)aTree
559{
560    if (tree != aTree) {
561        if (tree != nil) [tree release];
562        if (aTree != nil) [aTree retain];
563        tree = aTree;
564    }
565}
566
567- (void) dealloc
568{
569    [self setTree:nil];
570    [super dealloc];
571}
572
573
574
575
576@end /* end of returnScope implementation */
577
578@implementation SimpleCParser_assignStat_return
579+ (SimpleCParser_assignStat_return *)newSimpleCParser_assignStat_return
580{
581    return [[[SimpleCParser_assignStat_return alloc] init] retain];
582}
583
584/* AST returnScope.methods */
585- (ANTLRCommonTree *)getTree
586{
587    return tree;
588}
589
590- (void) setTree:(ANTLRCommonTree *)aTree
591{
592    if (tree != aTree) {
593        if (tree != nil) [tree release];
594        if (aTree != nil) [aTree retain];
595        tree = aTree;
596    }
597}
598
599- (void) dealloc
600{
601    [self setTree:nil];
602    [super dealloc];
603}
604
605
606
607
608@end /* end of returnScope implementation */
609
610@implementation SimpleCParser_expr_return
611+ (SimpleCParser_expr_return *)newSimpleCParser_expr_return
612{
613    return [[[SimpleCParser_expr_return alloc] init] retain];
614}
615
616/* AST returnScope.methods */
617- (ANTLRCommonTree *)getTree
618{
619    return tree;
620}
621
622- (void) setTree:(ANTLRCommonTree *)aTree
623{
624    if (tree != aTree) {
625        if (tree != nil) [tree release];
626        if (aTree != nil) [aTree retain];
627        tree = aTree;
628    }
629}
630
631- (void) dealloc
632{
633    [self setTree:nil];
634    [super dealloc];
635}
636
637
638
639
640@end /* end of returnScope implementation */
641
642@implementation SimpleCParser_condExpr_return
643+ (SimpleCParser_condExpr_return *)newSimpleCParser_condExpr_return
644{
645    return [[[SimpleCParser_condExpr_return alloc] init] retain];
646}
647
648/* AST returnScope.methods */
649- (ANTLRCommonTree *)getTree
650{
651    return tree;
652}
653
654- (void) setTree:(ANTLRCommonTree *)aTree
655{
656    if (tree != aTree) {
657        if (tree != nil) [tree release];
658        if (aTree != nil) [aTree retain];
659        tree = aTree;
660    }
661}
662
663- (void) dealloc
664{
665    [self setTree:nil];
666    [super dealloc];
667}
668
669
670
671
672@end /* end of returnScope implementation */
673
674@implementation SimpleCParser_aexpr_return
675+ (SimpleCParser_aexpr_return *)newSimpleCParser_aexpr_return
676{
677    return [[[SimpleCParser_aexpr_return alloc] init] retain];
678}
679
680/* AST returnScope.methods */
681- (ANTLRCommonTree *)getTree
682{
683    return tree;
684}
685
686- (void) setTree:(ANTLRCommonTree *)aTree
687{
688    if (tree != aTree) {
689        if (tree != nil) [tree release];
690        if (aTree != nil) [aTree retain];
691        tree = aTree;
692    }
693}
694
695- (void) dealloc
696{
697    [self setTree:nil];
698    [super dealloc];
699}
700
701
702
703
704@end /* end of returnScope implementation */
705
706@implementation SimpleCParser_atom_return
707+ (SimpleCParser_atom_return *)newSimpleCParser_atom_return
708{
709    return [[[SimpleCParser_atom_return alloc] init] retain];
710}
711
712/* AST returnScope.methods */
713- (ANTLRCommonTree *)getTree
714{
715    return tree;
716}
717
718- (void) setTree:(ANTLRCommonTree *)aTree
719{
720    if (tree != aTree) {
721        if (tree != nil) [tree release];
722        if (aTree != nil) [aTree retain];
723        tree = aTree;
724    }
725}
726
727- (void) dealloc
728{
729    [self setTree:nil];
730    [super dealloc];
731}
732
733
734
735
736@end /* end of returnScope implementation */
737
738
739
740@implementation SimpleCParser  // line 610
741
742+ (void) initialize
743{
744    #pragma mark Bitsets
745    FOLLOW_declaration_in_program85 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_declaration_in_program85_data Count:(NSUInteger)1] retain];
746    FOLLOW_variable_in_declaration105 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_variable_in_declaration105_data Count:(NSUInteger)1] retain];
747    FOLLOW_functionHeader_in_declaration115 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_functionHeader_in_declaration115_data Count:(NSUInteger)1] retain];
748    FOLLOW_21_in_declaration117 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_21_in_declaration117_data Count:(NSUInteger)1] retain];
749    FOLLOW_functionHeader_in_declaration135 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_functionHeader_in_declaration135_data Count:(NSUInteger)1] retain];
750    FOLLOW_block_in_declaration137 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_declaration137_data Count:(NSUInteger)1] retain];
751    FOLLOW_type_in_variable166 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_variable166_data Count:(NSUInteger)1] retain];
752    FOLLOW_declarator_in_variable168 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_variable168_data Count:(NSUInteger)1] retain];
753    FOLLOW_21_in_variable170 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_21_in_variable170_data Count:(NSUInteger)1] retain];
754    FOLLOW_K_ID_in_declarator199 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_ID_in_declarator199_data Count:(NSUInteger)1] retain];
755    FOLLOW_type_in_functionHeader219 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_functionHeader219_data Count:(NSUInteger)1] retain];
756    FOLLOW_K_ID_in_functionHeader221 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_ID_in_functionHeader221_data Count:(NSUInteger)1] retain];
757    FOLLOW_22_in_functionHeader223 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_22_in_functionHeader223_data Count:(NSUInteger)1] retain];
758    FOLLOW_formalParameter_in_functionHeader227 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_formalParameter_in_functionHeader227_data Count:(NSUInteger)1] retain];
759    FOLLOW_23_in_functionHeader231 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_23_in_functionHeader231_data Count:(NSUInteger)1] retain];
760    FOLLOW_formalParameter_in_functionHeader233 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_formalParameter_in_functionHeader233_data Count:(NSUInteger)1] retain];
761    FOLLOW_24_in_functionHeader241 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_24_in_functionHeader241_data Count:(NSUInteger)1] retain];
762    FOLLOW_type_in_formalParameter281 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_formalParameter281_data Count:(NSUInteger)1] retain];
763    FOLLOW_declarator_in_formalParameter283 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_formalParameter283_data Count:(NSUInteger)1] retain];
764    FOLLOW_set_in_type0 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_set_in_type0_data Count:(NSUInteger)1] retain];
765    FOLLOW_25_in_block376 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_25_in_block376_data Count:(NSUInteger)1] retain];
766    FOLLOW_variable_in_block390 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_variable_in_block390_data Count:(NSUInteger)1] retain];
767    FOLLOW_stat_in_block405 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_stat_in_block405_data Count:(NSUInteger)1] retain];
768    FOLLOW_26_in_block416 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_26_in_block416_data Count:(NSUInteger)1] retain];
769    FOLLOW_forStat_in_stat449 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_forStat_in_stat449_data Count:(NSUInteger)1] retain];
770    FOLLOW_expr_in_stat457 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_stat457_data Count:(NSUInteger)1] retain];
771    FOLLOW_21_in_stat459 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_21_in_stat459_data Count:(NSUInteger)1] retain];
772    FOLLOW_block_in_stat468 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_stat468_data Count:(NSUInteger)1] retain];
773    FOLLOW_assignStat_in_stat476 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_stat476_data Count:(NSUInteger)1] retain];
774    FOLLOW_21_in_stat478 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_21_in_stat478_data Count:(NSUInteger)1] retain];
775    FOLLOW_21_in_stat487 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_21_in_stat487_data Count:(NSUInteger)1] retain];
776    FOLLOW_K_FOR_in_forStat507 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_FOR_in_forStat507_data Count:(NSUInteger)1] retain];
777    FOLLOW_22_in_forStat509 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_22_in_forStat509_data Count:(NSUInteger)1] retain];
778    FOLLOW_assignStat_in_forStat513 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_forStat513_data Count:(NSUInteger)1] retain];
779    FOLLOW_21_in_forStat515 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_21_in_forStat515_data Count:(NSUInteger)1] retain];
780    FOLLOW_expr_in_forStat517 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_forStat517_data Count:(NSUInteger)1] retain];
781    FOLLOW_21_in_forStat519 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_21_in_forStat519_data Count:(NSUInteger)1] retain];
782    FOLLOW_assignStat_in_forStat523 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_forStat523_data Count:(NSUInteger)1] retain];
783    FOLLOW_24_in_forStat525 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_24_in_forStat525_data Count:(NSUInteger)1] retain];
784    FOLLOW_block_in_forStat527 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_forStat527_data Count:(NSUInteger)1] retain];
785    FOLLOW_K_ID_in_assignStat570 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_ID_in_assignStat570_data Count:(NSUInteger)1] retain];
786    FOLLOW_K_EQ_in_assignStat572 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_EQ_in_assignStat572_data Count:(NSUInteger)1] retain];
787    FOLLOW_expr_in_assignStat574 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_assignStat574_data Count:(NSUInteger)1] retain];
788    FOLLOW_condExpr_in_expr598 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_condExpr_in_expr598_data Count:(NSUInteger)1] retain];
789    FOLLOW_aexpr_in_condExpr617 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_aexpr_in_condExpr617_data Count:(NSUInteger)1] retain];
790    FOLLOW_K_EQEQ_in_condExpr622 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_EQEQ_in_condExpr622_data Count:(NSUInteger)1] retain];
791    FOLLOW_K_LT_in_condExpr627 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_LT_in_condExpr627_data Count:(NSUInteger)1] retain];
792    FOLLOW_aexpr_in_condExpr631 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_aexpr_in_condExpr631_data Count:(NSUInteger)1] retain];
793    FOLLOW_atom_in_aexpr653 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_atom_in_aexpr653_data Count:(NSUInteger)1] retain];
794    FOLLOW_K_PLUS_in_aexpr657 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_PLUS_in_aexpr657_data Count:(NSUInteger)1] retain];
795    FOLLOW_atom_in_aexpr660 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_atom_in_aexpr660_data Count:(NSUInteger)1] retain];
796    FOLLOW_K_ID_in_atom680 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_ID_in_atom680_data Count:(NSUInteger)1] retain];
797    FOLLOW_K_INT_in_atom694 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_INT_in_atom694_data Count:(NSUInteger)1] retain];
798    FOLLOW_22_in_atom708 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_22_in_atom708_data Count:(NSUInteger)1] retain];
799    FOLLOW_expr_in_atom710 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_atom710_data Count:(NSUInteger)1] retain];
800    FOLLOW_24_in_atom712 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_24_in_atom712_data Count:(NSUInteger)1] retain];
801
802    [ANTLRBaseRecognizer setTokenNames:[[[NSArray alloc] initWithObjects:@"<invalid>", @"<EOR>", @"<DOWN>", @"<UP>",
803 @"VAR_DEF", @"ARG_DEF", @"FUNC_HDR", @"FUNC_DECL", @"FUNC_DEF", @"BLOCK",
804 @"K_ID", @"K_INT", @"K_CHAR", @"K_VOID", @"K_FOR", @"K_EQ", @"K_EQEQ",
805 @"K_LT", @"K_PLUS", @"K_INT_TYPE", @"WS", @"';'", @"'('", @"','", @"')'",
806 @"'{'", @"'}'", nil] retain]];
807}
808
809+ (SimpleCParser *)newSimpleCParser:(id<ANTLRTokenStream>)aStream
810{
811    return [[SimpleCParser alloc] initWithTokenStream:aStream];
812
813}
814
815- (id) initWithTokenStream:(id<ANTLRTokenStream>)aStream
816{
817    if ((self = [super initWithTokenStream:aStream State:[[ANTLRRecognizerSharedState newANTLRRecognizerSharedStateWithRuleLen:15+1] retain]]) != nil) {
818
819
820        dfa2 = [DFA2 newDFA2WithRecognizer:self];
821
822        /* start of actions-actionScope-init */
823        /* start of init */
824        /* AST genericParser.init */
825        [self setTreeAdaptor:[[ANTLRCommonTreeAdaptor newANTLRCommonTreeAdaptor] retain]];
826    }
827    return self;
828}
829
830- (void) dealloc
831{
832    [dfa2 release];
833    /* AST genericParser.dealloc */
834    [self setTreeAdaptor:nil];
835
836    [super dealloc];
837}
838// start actions.actionScope.methods
839// start methods()
840/* AST genericParser.methods */
841/* AST parserMethods */
842- (id<ANTLRTreeAdaptor>) getTreeAdaptor
843{
844	return treeAdaptor;
845}
846
847- (void) setTreeAdaptor:(id<ANTLRTreeAdaptor>)aTreeAdaptor
848{
849	if (aTreeAdaptor != treeAdaptor) {
850		treeAdaptor = aTreeAdaptor;
851	}
852}
853// start rules
854/*
855 * $ANTLR start program
856 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:16:1: program : ( declaration )+ ;
857 */
858- (SimpleCParser_program_return *) program
859{
860    /* ruleScopeSetUp */
861
862    /* AST ruleDeclarations */
863    SimpleCParser_program_return * retval = [SimpleCParser_program_return newSimpleCParser_program_return];
864    [retval setStart:[input LT:1]];
865
866    ANTLRCommonTree *root_0 = nil;
867
868    @try {
869        /* AST ruleLabelDefs */
870        SimpleCParser_declaration_return * declaration1 = nil;
871
872
873
874        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:17:5: ( ( declaration )+ ) // ruleBlockSingleAlt
875        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:17:9: ( declaration )+ // alt
876        {
877        root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
878
879        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:17:9: ( declaration )+ // positiveClosureBlock
880        NSInteger cnt1=0;
881        do {
882            NSInteger alt1=2;
883            NSInteger LA1_0 = [input LA:1];
884            if ( ((LA1_0>=K_ID && LA1_0<=K_VOID)) ) {
885                alt1=1;
886            }
887
888
889            switch (alt1) {
890                case 1 : ;
891                    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:17:9: declaration // alt
892                    {
893                    /* ASTParser ruleRef */
894                    [self pushFollow:FOLLOW_declaration_in_program85];
895                    declaration1 = [self declaration];
896                    [self popFollow];
897
898
899                    [treeAdaptor addChild:[declaration1 getTree] toTree:root_0];  /* element() */
900                     /* elements */
901                    }
902                    break;
903
904                default :
905                    if ( cnt1 >= 1 )
906                        goto loop1;
907                    ANTLREarlyExitException *eee = [ANTLREarlyExitException exceptionWithStream:input decisionNumber:1];
908                    @throw eee;
909            }
910            cnt1++;
911        } while (YES);
912        loop1: ;
913          /* element() */
914         /* elements */
915        }
916
917        /* ASTParser ruleCleanUp */
918        /* AST ruleCleanUp */
919        // token+rule list labels
920        [retval setStop:[input LT:-1]];
921
922
923            retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
924            [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken];
925
926    }
927    @catch (ANTLRRecognitionException *re) {
928        [self reportError:re];
929        [self recover:input Exception:re];
930        /* ASTParser rule.setErrorReturnValue */
931        retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re];
932
933    }    @finally {
934    }
935    return retval;
936}
937/* $ANTLR end program */
938/*
939 * $ANTLR start declaration
940 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:20:1: declaration : ( variable | functionHeader ';' -> ^( FUNC_DECL functionHeader ) | functionHeader block -> ^( FUNC_DEF functionHeader block ) );
941 */
942- (SimpleCParser_declaration_return *) declaration
943{
944    /* ruleScopeSetUp */
945
946    /* AST ruleDeclarations */
947    SimpleCParser_declaration_return * retval = [SimpleCParser_declaration_return newSimpleCParser_declaration_return];
948    [retval setStart:[input LT:1]];
949
950    ANTLRCommonTree *root_0 = nil;
951
952    @try {
953        /* AST ruleLabelDefs */
954        ANTLRCommonToken *char_literal4 = nil;
955        SimpleCParser_variable_return * variable2 = nil;
956
957        SimpleCParser_functionHeader_return * functionHeader3 = nil;
958
959        SimpleCParser_functionHeader_return * functionHeader5 = nil;
960
961        SimpleCParser_block_return * block6 = nil;
962
963
964        ANTLRCommonTree *char_literal4_tree=nil;
965        ANTLRRewriteRuleTokenStream *stream_21 =
966            [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
967                                                             description:@"token 21"] retain];
968        ANTLRRewriteRuleSubtreeStream *stream_functionHeader =
969            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
970                                                                description:@"rule functionHeader"] retain];
971        ANTLRRewriteRuleSubtreeStream *stream_block =
972            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
973                                                                description:@"rule block"] retain];
974        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:21:5: ( variable | functionHeader ';' -> ^( FUNC_DECL functionHeader ) | functionHeader block -> ^( FUNC_DEF functionHeader block ) ) //ruleblock
975        NSInteger alt2=3;
976        alt2 = [dfa2 predict:input];
977        switch (alt2) {
978            case 1 : ;
979                // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:21:9: variable // alt
980                {
981                root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
982
983                /* ASTParser ruleRef */
984                [self pushFollow:FOLLOW_variable_in_declaration105];
985                variable2 = [self variable];
986                [self popFollow];
987
988
989                [treeAdaptor addChild:[variable2 getTree] toTree:root_0];  /* element() */
990                 /* elements */
991                }
992                break;
993            case 2 : ;
994                // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:22:9: functionHeader ';' // alt
995                {
996                [self pushFollow:FOLLOW_functionHeader_in_declaration115];
997                functionHeader3 = [self functionHeader];
998                [self popFollow];
999
1000
1001                [stream_functionHeader addElement:[functionHeader3 getTree]];  /* element() */
1002                char_literal4=(ANTLRCommonToken *)[self match:input TokenType:21 Follow:FOLLOW_21_in_declaration117];
1003                    [stream_21 addElement:char_literal4];
1004                  /* element() */
1005                 /* elements */
1006
1007                // AST REWRITE
1008                // elements: functionHeader
1009                // token labels:
1010                // rule labels: retval
1011                // token list labels:
1012                // rule list labels:
1013                // wildcard labels:
1014                 [retval setTree:root_0];
1015
1016                retval.tree = root_0;
1017
1018                ANTLRRewriteRuleSubtreeStream *stream_retval =
1019                    [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
1020                                                                        description:@"token retval"
1021                                                                            element:retval!=nil?[retval getTree]:nil] retain];
1022
1023                root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
1024
1025                // 22:28: -> ^( FUNC_DECL functionHeader )
1026                {
1027                    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:22:31: ^( FUNC_DECL functionHeader )
1028                    {
1029                        ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
1030                        root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:[[treeAdaptor createTree:(NSInteger)FUNC_DECL Text:[[ANTLRBaseRecognizer getTokenNames] objectAtIndex:(NSUInteger)FUNC_DECL]] retain]
1031                                                                               old:root_1];
1032
1033                        [treeAdaptor addChild:[stream_functionHeader nextTree] toTree:root_1];
1034
1035                        [treeAdaptor addChild:root_1 toTree:root_0];
1036                    }
1037
1038                }
1039
1040                retval.tree = root_0;
1041
1042                }
1043                break;
1044            case 3 : ;
1045                // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:23:9: functionHeader block // alt
1046                {
1047                [self pushFollow:FOLLOW_functionHeader_in_declaration135];
1048                functionHeader5 = [self functionHeader];
1049                [self popFollow];
1050
1051
1052                [stream_functionHeader addElement:[functionHeader5 getTree]];  /* element() */
1053                [self pushFollow:FOLLOW_block_in_declaration137];
1054                block6 = [self block];
1055                [self popFollow];
1056
1057
1058                [stream_block addElement:[block6 getTree]];  /* element() */
1059                 /* elements */
1060
1061                // AST REWRITE
1062                // elements: functionHeader, block
1063                // token labels:
1064                // rule labels: retval
1065                // token list labels:
1066                // rule list labels:
1067                // wildcard labels:
1068                 [retval setTree:root_0];
1069
1070                retval.tree = root_0;
1071
1072                ANTLRRewriteRuleSubtreeStream *stream_retval =
1073                    [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
1074                                                                        description:@"token retval"
1075                                                                            element:retval!=nil?[retval getTree]:nil] retain];
1076
1077                root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
1078
1079                // 23:30: -> ^( FUNC_DEF functionHeader block )
1080                {
1081                    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:23:33: ^( FUNC_DEF functionHeader block )
1082                    {
1083                        ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
1084                        root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:[[treeAdaptor createTree:(NSInteger)FUNC_DEF Text:[[ANTLRBaseRecognizer getTokenNames] objectAtIndex:(NSUInteger)FUNC_DEF]] retain]
1085                                                                               old:root_1];
1086
1087                        [treeAdaptor addChild:[stream_functionHeader nextTree] toTree:root_1];
1088                        [treeAdaptor addChild:[stream_block nextTree] toTree:root_1];
1089
1090                        [treeAdaptor addChild:root_1 toTree:root_0];
1091                    }
1092
1093                }
1094
1095                retval.tree = root_0;
1096
1097                }
1098                break;
1099
1100        }
1101        /* ASTParser ruleCleanUp */
1102        /* AST ruleCleanUp */
1103        // token+rule list labels
1104        [retval setStop:[input LT:-1]];
1105
1106        [stream_21 release];
1107        [stream_functionHeader release];
1108        [stream_block release];
1109
1110            retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
1111            [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken];
1112
1113    }
1114    @catch (ANTLRRecognitionException *re) {
1115        [self reportError:re];
1116        [self recover:input Exception:re];
1117        /* ASTParser rule.setErrorReturnValue */
1118        retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re];
1119
1120    }    @finally {
1121    }
1122    return retval;
1123}
1124/* $ANTLR end declaration */
1125/*
1126 * $ANTLR start variable
1127 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:26:1: variable : type declarator ';' -> ^( VAR_DEF type declarator ) ;
1128 */
1129- (SimpleCParser_variable_return *) variable
1130{
1131    /* ruleScopeSetUp */
1132
1133    /* AST ruleDeclarations */
1134    SimpleCParser_variable_return * retval = [SimpleCParser_variable_return newSimpleCParser_variable_return];
1135    [retval setStart:[input LT:1]];
1136
1137    ANTLRCommonTree *root_0 = nil;
1138
1139    @try {
1140        /* AST ruleLabelDefs */
1141        ANTLRCommonToken *char_literal9 = nil;
1142        SimpleCParser_type_return * type7 = nil;
1143
1144        SimpleCParser_declarator_return * declarator8 = nil;
1145
1146
1147        ANTLRCommonTree *char_literal9_tree=nil;
1148        ANTLRRewriteRuleTokenStream *stream_21 =
1149            [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
1150                                                             description:@"token 21"] retain];
1151        ANTLRRewriteRuleSubtreeStream *stream_declarator =
1152            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
1153                                                                description:@"rule declarator"] retain];
1154        ANTLRRewriteRuleSubtreeStream *stream_type =
1155            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
1156                                                                description:@"rule type"] retain];
1157        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:27:5: ( type declarator ';' -> ^( VAR_DEF type declarator ) ) // ruleBlockSingleAlt
1158        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:27:9: type declarator ';' // alt
1159        {
1160        [self pushFollow:FOLLOW_type_in_variable166];
1161        type7 = [self type];
1162        [self popFollow];
1163
1164
1165        [stream_type addElement:[type7 getTree]];  /* element() */
1166        [self pushFollow:FOLLOW_declarator_in_variable168];
1167        declarator8 = [self declarator];
1168        [self popFollow];
1169
1170
1171        [stream_declarator addElement:[declarator8 getTree]];  /* element() */
1172        char_literal9=(ANTLRCommonToken *)[self match:input TokenType:21 Follow:FOLLOW_21_in_variable170];
1173            [stream_21 addElement:char_literal9];
1174          /* element() */
1175         /* elements */
1176
1177        // AST REWRITE
1178        // elements: type, declarator
1179        // token labels:
1180        // rule labels: retval
1181        // token list labels:
1182        // rule list labels:
1183        // wildcard labels:
1184         [retval setTree:root_0];
1185
1186        retval.tree = root_0;
1187
1188        ANTLRRewriteRuleSubtreeStream *stream_retval =
1189            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
1190                                                                description:@"token retval"
1191                                                                    element:retval!=nil?[retval getTree]:nil] retain];
1192
1193        root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
1194
1195        // 27:29: -> ^( VAR_DEF type declarator )
1196        {
1197            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:27:32: ^( VAR_DEF type declarator )
1198            {
1199                ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
1200                root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:[[treeAdaptor createTree:(NSInteger)VAR_DEF Text:[[ANTLRBaseRecognizer getTokenNames] objectAtIndex:(NSUInteger)VAR_DEF]] retain]
1201                                                                       old:root_1];
1202
1203                [treeAdaptor addChild:[stream_type nextTree] toTree:root_1];
1204                [treeAdaptor addChild:[stream_declarator nextTree] toTree:root_1];
1205
1206                [treeAdaptor addChild:root_1 toTree:root_0];
1207            }
1208
1209        }
1210
1211        retval.tree = root_0;
1212
1213        }
1214
1215        /* ASTParser ruleCleanUp */
1216        /* AST ruleCleanUp */
1217        // token+rule list labels
1218        [retval setStop:[input LT:-1]];
1219
1220        [stream_21 release];
1221        [stream_declarator release];
1222        [stream_type release];
1223
1224            retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
1225            [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken];
1226
1227    }
1228    @catch (ANTLRRecognitionException *re) {
1229        [self reportError:re];
1230        [self recover:input Exception:re];
1231        /* ASTParser rule.setErrorReturnValue */
1232        retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re];
1233
1234    }    @finally {
1235    }
1236    return retval;
1237}
1238/* $ANTLR end variable */
1239/*
1240 * $ANTLR start declarator
1241 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:30:1: declarator : K_ID ;
1242 */
1243- (SimpleCParser_declarator_return *) declarator
1244{
1245    /* ruleScopeSetUp */
1246
1247    /* AST ruleDeclarations */
1248    SimpleCParser_declarator_return * retval = [SimpleCParser_declarator_return newSimpleCParser_declarator_return];
1249    [retval setStart:[input LT:1]];
1250
1251    ANTLRCommonTree *root_0 = nil;
1252
1253    @try {
1254        /* AST ruleLabelDefs */
1255        ANTLRCommonToken *K_ID10 = nil;
1256
1257        ANTLRCommonTree *K_ID10_tree=nil;
1258
1259        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:31:5: ( K_ID ) // ruleBlockSingleAlt
1260        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:31:9: K_ID // alt
1261        {
1262        root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
1263
1264        /* ASTParser tokenRef */
1265        K_ID10=(ANTLRCommonToken *)[self match:input TokenType:K_ID Follow:FOLLOW_K_ID_in_declarator199];
1266        K_ID10_tree = /* ASTParser createNodeFromToken */
1267        (ANTLRCommonTree *)[[treeAdaptor createTree:K_ID10] retain];
1268        [treeAdaptor addChild:K_ID10_tree  toTree:root_0];
1269          /* element() */
1270         /* elements */
1271        }
1272
1273        /* ASTParser ruleCleanUp */
1274        /* AST ruleCleanUp */
1275        // token+rule list labels
1276        [retval setStop:[input LT:-1]];
1277
1278
1279            retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
1280            [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken];
1281
1282    }
1283    @catch (ANTLRRecognitionException *re) {
1284        [self reportError:re];
1285        [self recover:input Exception:re];
1286        /* ASTParser rule.setErrorReturnValue */
1287        retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re];
1288
1289    }    @finally {
1290    }
1291    return retval;
1292}
1293/* $ANTLR end declarator */
1294/*
1295 * $ANTLR start functionHeader
1296 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:34:1: functionHeader : type K_ID '(' ( formalParameter ( ',' formalParameter )* )? ')' -> ^( FUNC_HDR type K_ID ( formalParameter )+ ) ;
1297 */
1298- (SimpleCParser_functionHeader_return *) functionHeader
1299{
1300    /* ruleScopeSetUp */
1301
1302    /* AST ruleDeclarations */
1303    SimpleCParser_functionHeader_return * retval = [SimpleCParser_functionHeader_return newSimpleCParser_functionHeader_return];
1304    [retval setStart:[input LT:1]];
1305
1306    ANTLRCommonTree *root_0 = nil;
1307
1308    @try {
1309        /* AST ruleLabelDefs */
1310        ANTLRCommonToken *K_ID12 = nil;
1311        ANTLRCommonToken *char_literal13 = nil;
1312        ANTLRCommonToken *char_literal15 = nil;
1313        ANTLRCommonToken *char_literal17 = nil;
1314        SimpleCParser_type_return * type11 = nil;
1315
1316        SimpleCParser_formalParameter_return * formalParameter14 = nil;
1317
1318        SimpleCParser_formalParameter_return * formalParameter16 = nil;
1319
1320
1321        ANTLRCommonTree *K_ID12_tree=nil;
1322        ANTLRCommonTree *char_literal13_tree=nil;
1323        ANTLRCommonTree *char_literal15_tree=nil;
1324        ANTLRCommonTree *char_literal17_tree=nil;
1325        ANTLRRewriteRuleTokenStream *stream_K_ID =
1326            [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
1327                                                             description:@"token K_ID"] retain];
1328        ANTLRRewriteRuleTokenStream *stream_22 =
1329            [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
1330                                                             description:@"token 22"] retain];
1331        ANTLRRewriteRuleTokenStream *stream_23 =
1332            [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
1333                                                             description:@"token 23"] retain];
1334        ANTLRRewriteRuleTokenStream *stream_24 =
1335            [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
1336                                                             description:@"token 24"] retain];
1337        ANTLRRewriteRuleSubtreeStream *stream_formalParameter =
1338            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
1339                                                                description:@"rule formalParameter"] retain];
1340        ANTLRRewriteRuleSubtreeStream *stream_type =
1341            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
1342                                                                description:@"rule type"] retain];
1343        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:35:5: ( type K_ID '(' ( formalParameter ( ',' formalParameter )* )? ')' -> ^( FUNC_HDR type K_ID ( formalParameter )+ ) ) // ruleBlockSingleAlt
1344        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:35:9: type K_ID '(' ( formalParameter ( ',' formalParameter )* )? ')' // alt
1345        {
1346        [self pushFollow:FOLLOW_type_in_functionHeader219];
1347        type11 = [self type];
1348        [self popFollow];
1349
1350
1351        [stream_type addElement:[type11 getTree]];  /* element() */
1352        K_ID12=(ANTLRCommonToken *)[self match:input TokenType:K_ID Follow:FOLLOW_K_ID_in_functionHeader221];
1353            [stream_K_ID addElement:K_ID12];
1354          /* element() */
1355        char_literal13=(ANTLRCommonToken *)[self match:input TokenType:22 Follow:FOLLOW_22_in_functionHeader223];
1356            [stream_22 addElement:char_literal13];
1357          /* element() */
1358        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:35:23: ( formalParameter ( ',' formalParameter )* )? // block
1359        NSInteger alt4=2;
1360        NSInteger LA4_0 = [input LA:1];
1361
1362        if ( ((LA4_0>=K_ID && LA4_0<=K_VOID)) ) {
1363            alt4=1;
1364        }
1365        switch (alt4) {
1366            case 1 : ;
1367                // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:35:25: formalParameter ( ',' formalParameter )* // alt
1368                {
1369                [self pushFollow:FOLLOW_formalParameter_in_functionHeader227];
1370                formalParameter14 = [self formalParameter];
1371                [self popFollow];
1372
1373
1374                [stream_formalParameter addElement:[formalParameter14 getTree]];  /* element() */
1375                do {
1376                    NSInteger alt3=2;
1377                    NSInteger LA3_0 = [input LA:1];
1378                    if ( (LA3_0==23) ) {
1379                        alt3=1;
1380                    }
1381
1382
1383                    switch (alt3) {
1384                        case 1 : ;
1385                            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:35:43: ',' formalParameter // alt
1386                            {
1387                            char_literal15=(ANTLRCommonToken *)[self match:input TokenType:23 Follow:FOLLOW_23_in_functionHeader231];
1388                                [stream_23 addElement:char_literal15];
1389                              /* element() */
1390                            [self pushFollow:FOLLOW_formalParameter_in_functionHeader233];
1391                            formalParameter16 = [self formalParameter];
1392                            [self popFollow];
1393
1394
1395                            [stream_formalParameter addElement:[formalParameter16 getTree]];  /* element() */
1396                             /* elements */
1397                            }
1398                            break;
1399
1400                        default :
1401                            goto loop3;
1402                    }
1403                } while (YES);
1404                loop3: ;
1405                  /* element() */
1406                 /* elements */
1407                }
1408                break;
1409
1410        }
1411          /* element() */
1412        char_literal17=(ANTLRCommonToken *)[self match:input TokenType:24 Follow:FOLLOW_24_in_functionHeader241];
1413            [stream_24 addElement:char_literal17];
1414          /* element() */
1415         /* elements */
1416
1417        // AST REWRITE
1418        // elements: K_ID, formalParameter, type
1419        // token labels:
1420        // rule labels: retval
1421        // token list labels:
1422        // rule list labels:
1423        // wildcard labels:
1424         [retval setTree:root_0];
1425
1426        retval.tree = root_0;
1427
1428        ANTLRRewriteRuleSubtreeStream *stream_retval =
1429            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
1430                                                                description:@"token retval"
1431                                                                    element:retval!=nil?[retval getTree]:nil] retain];
1432
1433        root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
1434
1435        // 36:9: -> ^( FUNC_HDR type K_ID ( formalParameter )+ )
1436        {
1437            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:36:12: ^( FUNC_HDR type K_ID ( formalParameter )+ )
1438            {
1439                ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
1440                root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:[[treeAdaptor createTree:(NSInteger)FUNC_HDR Text:[[ANTLRBaseRecognizer getTokenNames] objectAtIndex:(NSUInteger)FUNC_HDR]] retain]
1441                                                                       old:root_1];
1442
1443                [treeAdaptor addChild:[stream_type nextTree] toTree:root_1];
1444                 // TODO: args:
1445                [treeAdaptor addChild:[stream_K_ID nextNode] toTree:root_1];
1446                // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:36:33: ( formalParameter )+
1447                {
1448                if ( !([stream_formalParameter hasNext]) ) {
1449                    @throw [NSException exceptionWithName:@"RewriteEarlyExitException" reason:nil userInfo:nil];
1450                }
1451                while ( [stream_formalParameter hasNext] ) {
1452                    [treeAdaptor addChild:[stream_formalParameter nextTree] toTree:root_1];
1453
1454                }
1455                [stream_formalParameter reset];
1456
1457                }
1458                [treeAdaptor addChild:root_1 toTree:root_0];
1459            }
1460
1461        }
1462
1463        retval.tree = root_0;
1464
1465        }
1466
1467        /* ASTParser ruleCleanUp */
1468        /* AST ruleCleanUp */
1469        // token+rule list labels
1470        [retval setStop:[input LT:-1]];
1471
1472        [stream_K_ID release];
1473        [stream_22 release];
1474        [stream_23 release];
1475        [stream_24 release];
1476        [stream_formalParameter release];
1477        [stream_type release];
1478
1479            retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
1480            [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken];
1481
1482    }
1483    @catch (ANTLRRecognitionException *re) {
1484        [self reportError:re];
1485        [self recover:input Exception:re];
1486        /* ASTParser rule.setErrorReturnValue */
1487        retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re];
1488
1489    }    @finally {
1490    }
1491    return retval;
1492}
1493/* $ANTLR end functionHeader */
1494/*
1495 * $ANTLR start formalParameter
1496 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:39:1: formalParameter : type declarator -> ^( ARG_DEF type declarator ) ;
1497 */
1498- (SimpleCParser_formalParameter_return *) formalParameter
1499{
1500    /* ruleScopeSetUp */
1501
1502    /* AST ruleDeclarations */
1503    SimpleCParser_formalParameter_return * retval = [SimpleCParser_formalParameter_return newSimpleCParser_formalParameter_return];
1504    [retval setStart:[input LT:1]];
1505
1506    ANTLRCommonTree *root_0 = nil;
1507
1508    @try {
1509        /* AST ruleLabelDefs */
1510        SimpleCParser_type_return * type18 = nil;
1511
1512        SimpleCParser_declarator_return * declarator19 = nil;
1513
1514
1515        ANTLRRewriteRuleSubtreeStream *stream_declarator =
1516            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
1517                                                                description:@"rule declarator"] retain];
1518        ANTLRRewriteRuleSubtreeStream *stream_type =
1519            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
1520                                                                description:@"rule type"] retain];
1521        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:40:5: ( type declarator -> ^( ARG_DEF type declarator ) ) // ruleBlockSingleAlt
1522        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:40:9: type declarator // alt
1523        {
1524        [self pushFollow:FOLLOW_type_in_formalParameter281];
1525        type18 = [self type];
1526        [self popFollow];
1527
1528
1529        [stream_type addElement:[type18 getTree]];  /* element() */
1530        [self pushFollow:FOLLOW_declarator_in_formalParameter283];
1531        declarator19 = [self declarator];
1532        [self popFollow];
1533
1534
1535        [stream_declarator addElement:[declarator19 getTree]];  /* element() */
1536         /* elements */
1537
1538        // AST REWRITE
1539        // elements: declarator, type
1540        // token labels:
1541        // rule labels: retval
1542        // token list labels:
1543        // rule list labels:
1544        // wildcard labels:
1545         [retval setTree:root_0];
1546
1547        retval.tree = root_0;
1548
1549        ANTLRRewriteRuleSubtreeStream *stream_retval =
1550            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
1551                                                                description:@"token retval"
1552                                                                    element:retval!=nil?[retval getTree]:nil] retain];
1553
1554        root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
1555
1556        // 40:25: -> ^( ARG_DEF type declarator )
1557        {
1558            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:40:28: ^( ARG_DEF type declarator )
1559            {
1560                ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
1561                root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:[[treeAdaptor createTree:(NSInteger)ARG_DEF Text:[[ANTLRBaseRecognizer getTokenNames] objectAtIndex:(NSUInteger)ARG_DEF]] retain]
1562                                                                       old:root_1];
1563
1564                [treeAdaptor addChild:[stream_type nextTree] toTree:root_1];
1565                [treeAdaptor addChild:[stream_declarator nextTree] toTree:root_1];
1566
1567                [treeAdaptor addChild:root_1 toTree:root_0];
1568            }
1569
1570        }
1571
1572        retval.tree = root_0;
1573
1574        }
1575
1576        /* ASTParser ruleCleanUp */
1577        /* AST ruleCleanUp */
1578        // token+rule list labels
1579        [retval setStop:[input LT:-1]];
1580
1581        [stream_declarator release];
1582        [stream_type release];
1583
1584            retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
1585            [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken];
1586
1587    }
1588    @catch (ANTLRRecognitionException *re) {
1589        [self reportError:re];
1590        [self recover:input Exception:re];
1591        /* ASTParser rule.setErrorReturnValue */
1592        retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re];
1593
1594    }    @finally {
1595    }
1596    return retval;
1597}
1598/* $ANTLR end formalParameter */
1599/*
1600 * $ANTLR start type
1601 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:43:1: type : ( K_INT | K_CHAR | K_VOID | K_ID );
1602 */
1603- (SimpleCParser_type_return *) type
1604{
1605    /* ruleScopeSetUp */
1606
1607    /* AST ruleDeclarations */
1608    SimpleCParser_type_return * retval = [SimpleCParser_type_return newSimpleCParser_type_return];
1609    [retval setStart:[input LT:1]];
1610
1611    ANTLRCommonTree *root_0 = nil;
1612
1613    @try {
1614        /* AST ruleLabelDefs */
1615        ANTLRCommonToken *set20 = nil;
1616
1617        ANTLRCommonTree *set20_tree=nil;
1618
1619        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:44:5: ( K_INT | K_CHAR | K_VOID | K_ID ) // ruleBlockSingleAlt
1620        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g: // alt
1621        {
1622        root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
1623
1624        /* ASTParser matchRuleBlockSet */
1625        /* ASTParser matchSet */
1626        set20 = (ANTLRCommonToken *)[input LT:1];
1627        if ((([input LA:1] >= K_ID) && ([input LA:1] <= K_VOID))) {
1628            [input consume];
1629                [treeAdaptor addChild:/* ASTParser createNodeFromToken */
1630            (ANTLRCommonTree *)[[treeAdaptor createTree:set20] retain] toTree:root_0 ];
1631            [state setIsErrorRecovery:NO];
1632        } else {
1633            ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException exceptionWithSet:nil stream:input];
1634            @throw mse;
1635        }
1636          /* element() */
1637         /* elements */
1638        }
1639
1640        /* ASTParser ruleCleanUp */
1641        /* AST ruleCleanUp */
1642        // token+rule list labels
1643        [retval setStop:[input LT:-1]];
1644
1645
1646            retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
1647            [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken];
1648
1649    }
1650    @catch (ANTLRRecognitionException *re) {
1651        [self reportError:re];
1652        [self recover:input Exception:re];
1653        /* ASTParser rule.setErrorReturnValue */
1654        retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re];
1655
1656    }    @finally {
1657    }
1658    return retval;
1659}
1660/* $ANTLR end type */
1661/*
1662 * $ANTLR start block
1663 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:50:1: block : lc= '{' ( variable )* ( stat )* '}' -> ^( BLOCK[$lc,@\"BLOCK\"] ( variable )* ( stat )* ) ;
1664 */
1665- (SimpleCParser_block_return *) block
1666{
1667    /* ruleScopeSetUp */
1668
1669    /* AST ruleDeclarations */
1670    SimpleCParser_block_return * retval = [SimpleCParser_block_return newSimpleCParser_block_return];
1671    [retval setStart:[input LT:1]];
1672
1673    ANTLRCommonTree *root_0 = nil;
1674
1675    @try {
1676        /* AST ruleLabelDefs */
1677        ANTLRCommonToken *lc = nil;
1678        ANTLRCommonToken *char_literal23 = nil;
1679        SimpleCParser_variable_return * variable21 = nil;
1680
1681        SimpleCParser_stat_return * stat22 = nil;
1682
1683
1684        ANTLRCommonTree *lc_tree=nil;
1685        ANTLRCommonTree *char_literal23_tree=nil;
1686        ANTLRRewriteRuleTokenStream *stream_25 =
1687            [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
1688                                                             description:@"token 25"] retain];
1689        ANTLRRewriteRuleTokenStream *stream_26 =
1690            [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
1691                                                             description:@"token 26"] retain];
1692        ANTLRRewriteRuleSubtreeStream *stream_variable =
1693            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
1694                                                                description:@"rule variable"] retain];
1695        ANTLRRewriteRuleSubtreeStream *stream_stat =
1696            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
1697                                                                description:@"rule stat"] retain];
1698        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:51:5: (lc= '{' ( variable )* ( stat )* '}' -> ^( BLOCK[$lc,@\"BLOCK\"] ( variable )* ( stat )* ) ) // ruleBlockSingleAlt
1699        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:51:9: lc= '{' ( variable )* ( stat )* '}' // alt
1700        {
1701        lc=(ANTLRCommonToken *)[self match:input TokenType:25 Follow:FOLLOW_25_in_block376];
1702            [stream_25 addElement:lc];
1703          /* element() */
1704        do {
1705            NSInteger alt5=2;
1706            switch ([input LA:1]) {
1707                case K_ID: ;
1708                    {
1709                    NSInteger LA5_2 = [input LA:2];
1710                    if ( (LA5_2==K_ID) ) {
1711                        alt5=1;
1712                    }
1713
1714
1715                    }
1716                    break;
1717                case K_INT: ;
1718                    {
1719                    NSInteger LA5_3 = [input LA:2];
1720                    if ( (LA5_3==K_ID) ) {
1721                        alt5=1;
1722                    }
1723
1724
1725                    }
1726                    break;
1727                case K_CHAR: ;
1728                case K_VOID: ;
1729                    {
1730                    alt5=1;
1731                    }
1732                    break;
1733
1734            }
1735
1736            switch (alt5) {
1737                case 1 : ;
1738                    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:52:13: variable // alt
1739                    {
1740                    [self pushFollow:FOLLOW_variable_in_block390];
1741                    variable21 = [self variable];
1742                    [self popFollow];
1743
1744
1745                    [stream_variable addElement:[variable21 getTree]];  /* element() */
1746                     /* elements */
1747                    }
1748                    break;
1749
1750                default :
1751                    goto loop5;
1752            }
1753        } while (YES);
1754        loop5: ;
1755          /* element() */
1756        do {
1757            NSInteger alt6=2;
1758            NSInteger LA6_0 = [input LA:1];
1759            if ( ((LA6_0>=K_ID && LA6_0<=K_INT)||LA6_0==K_FOR||(LA6_0>=21 && LA6_0<=22)||LA6_0==25) ) {
1760                alt6=1;
1761            }
1762
1763
1764            switch (alt6) {
1765                case 1 : ;
1766                    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:53:13: stat // alt
1767                    {
1768                    [self pushFollow:FOLLOW_stat_in_block405];
1769                    stat22 = [self stat];
1770                    [self popFollow];
1771
1772
1773                    [stream_stat addElement:[stat22 getTree]];  /* element() */
1774                     /* elements */
1775                    }
1776                    break;
1777
1778                default :
1779                    goto loop6;
1780            }
1781        } while (YES);
1782        loop6: ;
1783          /* element() */
1784        char_literal23=(ANTLRCommonToken *)[self match:input TokenType:26 Follow:FOLLOW_26_in_block416];
1785            [stream_26 addElement:char_literal23];
1786          /* element() */
1787         /* elements */
1788
1789        // AST REWRITE
1790        // elements: stat, variable
1791        // token labels:
1792        // rule labels: retval
1793        // token list labels:
1794        // rule list labels:
1795        // wildcard labels:
1796         [retval setTree:root_0];
1797
1798        retval.tree = root_0;
1799
1800        ANTLRRewriteRuleSubtreeStream *stream_retval =
1801            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
1802                                                                description:@"token retval"
1803                                                                    element:retval!=nil?[retval getTree]:nil] retain];
1804
1805        root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
1806
1807        // 55:9: -> ^( BLOCK[$lc,@\"BLOCK\"] ( variable )* ( stat )* )
1808        {
1809            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:55:12: ^( BLOCK[$lc,@\"BLOCK\"] ( variable )* ( stat )* )
1810            {
1811                ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
1812                root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:[[treeAdaptor createTree:(NSInteger)BLOCK Text:[[ANTLRBaseRecognizer getTokenNames] objectAtIndex:(NSUInteger)BLOCK]] retain]
1813                                                                       old:root_1];
1814
1815                // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:55:34: ( variable )*
1816                while ( [stream_variable hasNext] ) {
1817                    [treeAdaptor addChild:[stream_variable nextTree] toTree:root_1];
1818
1819                }
1820                [stream_variable reset];
1821                // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:55:44: ( stat )*
1822                while ( [stream_stat hasNext] ) {
1823                    [treeAdaptor addChild:[stream_stat nextTree] toTree:root_1];
1824
1825                }
1826                [stream_stat reset];
1827
1828                [treeAdaptor addChild:root_1 toTree:root_0];
1829            }
1830
1831        }
1832
1833        retval.tree = root_0;
1834
1835        }
1836
1837        /* ASTParser ruleCleanUp */
1838        /* AST ruleCleanUp */
1839        // token+rule list labels
1840        [retval setStop:[input LT:-1]];
1841
1842        [stream_25 release];
1843        [stream_26 release];
1844        [stream_variable release];
1845        [stream_stat release];
1846
1847            retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
1848            [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken];
1849
1850    }
1851    @catch (ANTLRRecognitionException *re) {
1852        [self reportError:re];
1853        [self recover:input Exception:re];
1854        /* ASTParser rule.setErrorReturnValue */
1855        retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re];
1856
1857    }    @finally {
1858    }
1859    return retval;
1860}
1861/* $ANTLR end block */
1862/*
1863 * $ANTLR start stat
1864 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:58:1: stat : ( forStat | expr ';' | block | assignStat ';' | ';' );
1865 */
1866- (SimpleCParser_stat_return *) stat
1867{
1868    /* ruleScopeSetUp */
1869
1870    /* AST ruleDeclarations */
1871    SimpleCParser_stat_return * retval = [SimpleCParser_stat_return newSimpleCParser_stat_return];
1872    [retval setStart:[input LT:1]];
1873
1874    ANTLRCommonTree *root_0 = nil;
1875
1876    @try {
1877        /* AST ruleLabelDefs */
1878        ANTLRCommonToken *char_literal26 = nil;
1879        ANTLRCommonToken *char_literal29 = nil;
1880        ANTLRCommonToken *char_literal30 = nil;
1881        SimpleCParser_forStat_return * forStat24 = nil;
1882
1883        SimpleCParser_expr_return * expr25 = nil;
1884
1885        SimpleCParser_block_return * block27 = nil;
1886
1887        SimpleCParser_assignStat_return * assignStat28 = nil;
1888
1889
1890        ANTLRCommonTree *char_literal26_tree=nil;
1891        ANTLRCommonTree *char_literal29_tree=nil;
1892        ANTLRCommonTree *char_literal30_tree=nil;
1893
1894        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:58:5: ( forStat | expr ';' | block | assignStat ';' | ';' ) //ruleblock
1895        NSInteger alt7=5;
1896        switch ([input LA:1]) {
1897            case K_FOR: ;
1898                {
1899                alt7=1;
1900                }
1901                break;
1902            case K_ID: ;
1903                {
1904                NSInteger LA7_2 = [input LA:2];
1905
1906                if ( (LA7_2==K_EQ) ) {
1907                    alt7=4;
1908                }
1909                else if ( ((LA7_2>=K_EQEQ && LA7_2<=K_PLUS)||LA7_2==21) ) {
1910                    alt7=2;
1911                }
1912                else {
1913                    ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newANTLRNoViableAltException:7 state:2 stream:input];
1914                    @throw nvae;
1915                }
1916                }
1917                break;
1918            case K_INT: ;
1919            case 22: ;
1920                {
1921                alt7=2;
1922                }
1923                break;
1924            case 25: ;
1925                {
1926                alt7=3;
1927                }
1928                break;
1929            case 21: ;
1930                {
1931                alt7=5;
1932                }
1933                break;
1934
1935        default: ;
1936            ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newANTLRNoViableAltException:7 state:0 stream:input];
1937            @throw nvae;
1938        }
1939
1940        switch (alt7) {
1941            case 1 : ;
1942                // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:58:7: forStat // alt
1943                {
1944                root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
1945
1946                /* ASTParser ruleRef */
1947                [self pushFollow:FOLLOW_forStat_in_stat449];
1948                forStat24 = [self forStat];
1949                [self popFollow];
1950
1951
1952                [treeAdaptor addChild:[forStat24 getTree] toTree:root_0];  /* element() */
1953                 /* elements */
1954                }
1955                break;
1956            case 2 : ;
1957                // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:59:7: expr ';' // alt
1958                {
1959                root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
1960
1961                /* ASTParser ruleRef */
1962                [self pushFollow:FOLLOW_expr_in_stat457];
1963                expr25 = [self expr];
1964                [self popFollow];
1965
1966
1967                [treeAdaptor addChild:[expr25 getTree] toTree:root_0];  /* element() */
1968                char_literal26=(ANTLRCommonToken *)[self match:input TokenType:21 Follow:FOLLOW_21_in_stat459];   /* element() */
1969                 /* elements */
1970                }
1971                break;
1972            case 3 : ;
1973                // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:60:7: block // alt
1974                {
1975                root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
1976
1977                /* ASTParser ruleRef */
1978                [self pushFollow:FOLLOW_block_in_stat468];
1979                block27 = [self block];
1980                [self popFollow];
1981
1982
1983                [treeAdaptor addChild:[block27 getTree] toTree:root_0];  /* element() */
1984                 /* elements */
1985                }
1986                break;
1987            case 4 : ;
1988                // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:61:7: assignStat ';' // alt
1989                {
1990                root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
1991
1992                /* ASTParser ruleRef */
1993                [self pushFollow:FOLLOW_assignStat_in_stat476];
1994                assignStat28 = [self assignStat];
1995                [self popFollow];
1996
1997
1998                [treeAdaptor addChild:[assignStat28 getTree] toTree:root_0];  /* element() */
1999                char_literal29=(ANTLRCommonToken *)[self match:input TokenType:21 Follow:FOLLOW_21_in_stat478];   /* element() */
2000                 /* elements */
2001                }
2002                break;
2003            case 5 : ;
2004                // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:62:7: ';' // alt
2005                {
2006                root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
2007
2008                char_literal30=(ANTLRCommonToken *)[self match:input TokenType:21 Follow:FOLLOW_21_in_stat487];   /* element() */
2009                 /* elements */
2010                }
2011                break;
2012
2013        }
2014        /* ASTParser ruleCleanUp */
2015        /* AST ruleCleanUp */
2016        // token+rule list labels
2017        [retval setStop:[input LT:-1]];
2018
2019
2020            retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
2021            [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken];
2022
2023    }
2024    @catch (ANTLRRecognitionException *re) {
2025        [self reportError:re];
2026        [self recover:input Exception:re];
2027        /* ASTParser rule.setErrorReturnValue */
2028        retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re];
2029
2030    }    @finally {
2031    }
2032    return retval;
2033}
2034/* $ANTLR end stat */
2035/*
2036 * $ANTLR start forStat
2037 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:65:1: forStat : K_FOR '(' start= assignStat ';' expr ';' next= assignStat ')' block -> ^( K_FOR $start expr $next block ) ;
2038 */
2039- (SimpleCParser_forStat_return *) forStat
2040{
2041    /* ruleScopeSetUp */
2042
2043    /* AST ruleDeclarations */
2044    SimpleCParser_forStat_return * retval = [SimpleCParser_forStat_return newSimpleCParser_forStat_return];
2045    [retval setStart:[input LT:1]];
2046
2047    ANTLRCommonTree *root_0 = nil;
2048
2049    @try {
2050        /* AST ruleLabelDefs */
2051        ANTLRCommonToken *K_FOR31 = nil;
2052        ANTLRCommonToken *char_literal32 = nil;
2053        ANTLRCommonToken *char_literal33 = nil;
2054        ANTLRCommonToken *char_literal35 = nil;
2055        ANTLRCommonToken *char_literal36 = nil;
2056        SimpleCParser_assignStat_return * start = nil;
2057
2058        SimpleCParser_assignStat_return * next = nil;
2059
2060        SimpleCParser_expr_return * expr34 = nil;
2061
2062        SimpleCParser_block_return * block37 = nil;
2063
2064
2065        ANTLRCommonTree *K_FOR31_tree=nil;
2066        ANTLRCommonTree *char_literal32_tree=nil;
2067        ANTLRCommonTree *char_literal33_tree=nil;
2068        ANTLRCommonTree *char_literal35_tree=nil;
2069        ANTLRCommonTree *char_literal36_tree=nil;
2070        ANTLRRewriteRuleTokenStream *stream_21 =
2071            [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
2072                                                             description:@"token 21"] retain];
2073        ANTLRRewriteRuleTokenStream *stream_22 =
2074            [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
2075                                                             description:@"token 22"] retain];
2076        ANTLRRewriteRuleTokenStream *stream_24 =
2077            [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
2078                                                             description:@"token 24"] retain];
2079        ANTLRRewriteRuleTokenStream *stream_K_FOR =
2080            [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
2081                                                             description:@"token K_FOR"] retain];
2082        ANTLRRewriteRuleSubtreeStream *stream_assignStat =
2083            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
2084                                                                description:@"rule assignStat"] retain];
2085        ANTLRRewriteRuleSubtreeStream *stream_block =
2086            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
2087                                                                description:@"rule block"] retain];
2088        ANTLRRewriteRuleSubtreeStream *stream_expr =
2089            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
2090                                                                description:@"rule expr"] retain];
2091        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:66:5: ( K_FOR '(' start= assignStat ';' expr ';' next= assignStat ')' block -> ^( K_FOR $start expr $next block ) ) // ruleBlockSingleAlt
2092        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:66:9: K_FOR '(' start= assignStat ';' expr ';' next= assignStat ')' block // alt
2093        {
2094        K_FOR31=(ANTLRCommonToken *)[self match:input TokenType:K_FOR Follow:FOLLOW_K_FOR_in_forStat507];
2095            [stream_K_FOR addElement:K_FOR31];
2096          /* element() */
2097        char_literal32=(ANTLRCommonToken *)[self match:input TokenType:22 Follow:FOLLOW_22_in_forStat509];
2098            [stream_22 addElement:char_literal32];
2099          /* element() */
2100        [self pushFollow:FOLLOW_assignStat_in_forStat513];
2101        start = [self assignStat];
2102        [self popFollow];
2103
2104
2105        [stream_assignStat addElement:[start getTree]];  /* element() */
2106        char_literal33=(ANTLRCommonToken *)[self match:input TokenType:21 Follow:FOLLOW_21_in_forStat515];
2107            [stream_21 addElement:char_literal33];
2108          /* element() */
2109        [self pushFollow:FOLLOW_expr_in_forStat517];
2110        expr34 = [self expr];
2111        [self popFollow];
2112
2113
2114        [stream_expr addElement:[expr34 getTree]];  /* element() */
2115        char_literal35=(ANTLRCommonToken *)[self match:input TokenType:21 Follow:FOLLOW_21_in_forStat519];
2116            [stream_21 addElement:char_literal35];
2117          /* element() */
2118        [self pushFollow:FOLLOW_assignStat_in_forStat523];
2119        next = [self assignStat];
2120        [self popFollow];
2121
2122
2123        [stream_assignStat addElement:[next getTree]];  /* element() */
2124        char_literal36=(ANTLRCommonToken *)[self match:input TokenType:24 Follow:FOLLOW_24_in_forStat525];
2125            [stream_24 addElement:char_literal36];
2126          /* element() */
2127        [self pushFollow:FOLLOW_block_in_forStat527];
2128        block37 = [self block];
2129        [self popFollow];
2130
2131
2132        [stream_block addElement:[block37 getTree]];  /* element() */
2133         /* elements */
2134
2135        // AST REWRITE
2136        // elements: K_FOR, expr, start, next, block
2137        // token labels:
2138        // rule labels: retval, start, next
2139        // token list labels:
2140        // rule list labels:
2141        // wildcard labels:
2142         [retval setTree:root_0];
2143
2144        retval.tree = root_0;
2145
2146        ANTLRRewriteRuleSubtreeStream *stream_retval =
2147            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
2148                                                                description:@"token retval"
2149                                                                    element:retval!=nil?[retval getTree]:nil] retain];
2150        ANTLRRewriteRuleSubtreeStream *stream_start =
2151            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
2152                                                                description:@"token start"
2153                                                                    element:start!=nil?[start getTree]:nil] retain];
2154        ANTLRRewriteRuleSubtreeStream *stream_next =
2155            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
2156                                                                description:@"token next"
2157                                                                    element:next!=nil?[next getTree]:nil] retain];
2158
2159        root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
2160
2161        // 67:9: -> ^( K_FOR $start expr $next block )
2162        {
2163            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:67:12: ^( K_FOR $start expr $next block )
2164            {
2165                ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
2166                root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:[stream_K_FOR nextNode] old:root_1];
2167
2168                [treeAdaptor addChild:[stream_start nextTree] toTree:root_1];
2169                [treeAdaptor addChild:[stream_expr nextTree] toTree:root_1];
2170                [treeAdaptor addChild:[stream_next nextTree] toTree:root_1];
2171                [treeAdaptor addChild:[stream_block nextTree] toTree:root_1];
2172
2173                [treeAdaptor addChild:root_1 toTree:root_0];
2174            }
2175
2176        }
2177
2178        retval.tree = root_0;
2179
2180        }
2181
2182        /* ASTParser ruleCleanUp */
2183        /* AST ruleCleanUp */
2184        // token+rule list labels
2185        [retval setStop:[input LT:-1]];
2186
2187        [stream_21 release];
2188        [stream_22 release];
2189        [stream_24 release];
2190        [stream_K_FOR release];
2191        [stream_assignStat release];
2192        [stream_block release];
2193        [stream_expr release];
2194
2195            retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
2196            [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken];
2197
2198    }
2199    @catch (ANTLRRecognitionException *re) {
2200        [self reportError:re];
2201        [self recover:input Exception:re];
2202        /* ASTParser rule.setErrorReturnValue */
2203        retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re];
2204
2205    }    @finally {
2206    }
2207    return retval;
2208}
2209/* $ANTLR end forStat */
2210/*
2211 * $ANTLR start assignStat
2212 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:70:1: assignStat : K_ID K_EQ expr -> ^( K_EQ K_ID expr ) ;
2213 */
2214- (SimpleCParser_assignStat_return *) assignStat
2215{
2216    /* ruleScopeSetUp */
2217
2218    /* AST ruleDeclarations */
2219    SimpleCParser_assignStat_return * retval = [SimpleCParser_assignStat_return newSimpleCParser_assignStat_return];
2220    [retval setStart:[input LT:1]];
2221
2222    ANTLRCommonTree *root_0 = nil;
2223
2224    @try {
2225        /* AST ruleLabelDefs */
2226        ANTLRCommonToken *K_ID38 = nil;
2227        ANTLRCommonToken *K_EQ39 = nil;
2228        SimpleCParser_expr_return * expr40 = nil;
2229
2230
2231        ANTLRCommonTree *K_ID38_tree=nil;
2232        ANTLRCommonTree *K_EQ39_tree=nil;
2233        ANTLRRewriteRuleTokenStream *stream_K_ID =
2234            [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
2235                                                             description:@"token K_ID"] retain];
2236        ANTLRRewriteRuleTokenStream *stream_K_EQ =
2237            [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
2238                                                             description:@"token K_EQ"] retain];
2239        ANTLRRewriteRuleSubtreeStream *stream_expr =
2240            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
2241                                                                description:@"rule expr"] retain];
2242        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:71:5: ( K_ID K_EQ expr -> ^( K_EQ K_ID expr ) ) // ruleBlockSingleAlt
2243        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:71:9: K_ID K_EQ expr // alt
2244        {
2245        K_ID38=(ANTLRCommonToken *)[self match:input TokenType:K_ID Follow:FOLLOW_K_ID_in_assignStat570];
2246            [stream_K_ID addElement:K_ID38];
2247          /* element() */
2248        K_EQ39=(ANTLRCommonToken *)[self match:input TokenType:K_EQ Follow:FOLLOW_K_EQ_in_assignStat572];
2249            [stream_K_EQ addElement:K_EQ39];
2250          /* element() */
2251        [self pushFollow:FOLLOW_expr_in_assignStat574];
2252        expr40 = [self expr];
2253        [self popFollow];
2254
2255
2256        [stream_expr addElement:[expr40 getTree]];  /* element() */
2257         /* elements */
2258
2259        // AST REWRITE
2260        // elements: K_EQ, K_ID, expr
2261        // token labels:
2262        // rule labels: retval
2263        // token list labels:
2264        // rule list labels:
2265        // wildcard labels:
2266         [retval setTree:root_0];
2267
2268        retval.tree = root_0;
2269
2270        ANTLRRewriteRuleSubtreeStream *stream_retval =
2271            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
2272                                                                description:@"token retval"
2273                                                                    element:retval!=nil?[retval getTree]:nil] retain];
2274
2275        root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
2276
2277        // 71:24: -> ^( K_EQ K_ID expr )
2278        {
2279            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:71:27: ^( K_EQ K_ID expr )
2280            {
2281                ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
2282                root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:[stream_K_EQ nextNode] old:root_1];
2283
2284                 // TODO: args:
2285                [treeAdaptor addChild:[stream_K_ID nextNode] toTree:root_1];
2286                [treeAdaptor addChild:[stream_expr nextTree] toTree:root_1];
2287
2288                [treeAdaptor addChild:root_1 toTree:root_0];
2289            }
2290
2291        }
2292
2293        retval.tree = root_0;
2294
2295        }
2296
2297        /* ASTParser ruleCleanUp */
2298        /* AST ruleCleanUp */
2299        // token+rule list labels
2300        [retval setStop:[input LT:-1]];
2301
2302        [stream_K_ID release];
2303        [stream_K_EQ release];
2304        [stream_expr release];
2305
2306            retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
2307            [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken];
2308
2309    }
2310    @catch (ANTLRRecognitionException *re) {
2311        [self reportError:re];
2312        [self recover:input Exception:re];
2313        /* ASTParser rule.setErrorReturnValue */
2314        retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re];
2315
2316    }    @finally {
2317    }
2318    return retval;
2319}
2320/* $ANTLR end assignStat */
2321/*
2322 * $ANTLR start expr
2323 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:74:1: expr : condExpr ;
2324 */
2325- (SimpleCParser_expr_return *) expr
2326{
2327    /* ruleScopeSetUp */
2328
2329    /* AST ruleDeclarations */
2330    SimpleCParser_expr_return * retval = [SimpleCParser_expr_return newSimpleCParser_expr_return];
2331    [retval setStart:[input LT:1]];
2332
2333    ANTLRCommonTree *root_0 = nil;
2334
2335    @try {
2336        /* AST ruleLabelDefs */
2337        SimpleCParser_condExpr_return * condExpr41 = nil;
2338
2339
2340
2341        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:74:5: ( condExpr ) // ruleBlockSingleAlt
2342        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:74:9: condExpr // alt
2343        {
2344        root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
2345
2346        /* ASTParser ruleRef */
2347        [self pushFollow:FOLLOW_condExpr_in_expr598];
2348        condExpr41 = [self condExpr];
2349        [self popFollow];
2350
2351
2352        [treeAdaptor addChild:[condExpr41 getTree] toTree:root_0];  /* element() */
2353         /* elements */
2354        }
2355
2356        /* ASTParser ruleCleanUp */
2357        /* AST ruleCleanUp */
2358        // token+rule list labels
2359        [retval setStop:[input LT:-1]];
2360
2361
2362            retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
2363            [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken];
2364
2365    }
2366    @catch (ANTLRRecognitionException *re) {
2367        [self reportError:re];
2368        [self recover:input Exception:re];
2369        /* ASTParser rule.setErrorReturnValue */
2370        retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re];
2371
2372    }    @finally {
2373    }
2374    return retval;
2375}
2376/* $ANTLR end expr */
2377/*
2378 * $ANTLR start condExpr
2379 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:77:1: condExpr : aexpr ( ( K_EQEQ | K_LT ) aexpr )? ;
2380 */
2381- (SimpleCParser_condExpr_return *) condExpr
2382{
2383    /* ruleScopeSetUp */
2384
2385    /* AST ruleDeclarations */
2386    SimpleCParser_condExpr_return * retval = [SimpleCParser_condExpr_return newSimpleCParser_condExpr_return];
2387    [retval setStart:[input LT:1]];
2388
2389    ANTLRCommonTree *root_0 = nil;
2390
2391    @try {
2392        /* AST ruleLabelDefs */
2393        ANTLRCommonToken *K_EQEQ43 = nil;
2394        ANTLRCommonToken *K_LT44 = nil;
2395        SimpleCParser_aexpr_return * aexpr42 = nil;
2396
2397        SimpleCParser_aexpr_return * aexpr45 = nil;
2398
2399
2400        ANTLRCommonTree *K_EQEQ43_tree=nil;
2401        ANTLRCommonTree *K_LT44_tree=nil;
2402
2403        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:78:5: ( aexpr ( ( K_EQEQ | K_LT ) aexpr )? ) // ruleBlockSingleAlt
2404        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:78:9: aexpr ( ( K_EQEQ | K_LT ) aexpr )? // alt
2405        {
2406        root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
2407
2408        /* ASTParser ruleRef */
2409        [self pushFollow:FOLLOW_aexpr_in_condExpr617];
2410        aexpr42 = [self aexpr];
2411        [self popFollow];
2412
2413
2414        [treeAdaptor addChild:[aexpr42 getTree] toTree:root_0];  /* element() */
2415        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:78:15: ( ( K_EQEQ | K_LT ) aexpr )? // block
2416        NSInteger alt9=2;
2417        NSInteger LA9_0 = [input LA:1];
2418
2419        if ( ((LA9_0>=K_EQEQ && LA9_0<=K_LT)) ) {
2420            alt9=1;
2421        }
2422        switch (alt9) {
2423            case 1 : ;
2424                // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:78:17: ( K_EQEQ | K_LT ) aexpr // alt
2425                {
2426                // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:78:17: ( K_EQEQ | K_LT ) // block
2427                NSInteger alt8=2;
2428                NSInteger LA8_0 = [input LA:1];
2429
2430                if ( (LA8_0==K_EQEQ) ) {
2431                    alt8=1;
2432                }
2433                else if ( (LA8_0==K_LT) ) {
2434                    alt8=2;
2435                }
2436                else {
2437                    ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newANTLRNoViableAltException:8 state:0 stream:input];
2438                    @throw nvae;
2439                }
2440                switch (alt8) {
2441                    case 1 : ;
2442                        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:78:18: K_EQEQ // alt
2443                        {
2444                        K_EQEQ43=(ANTLRCommonToken *)[self match:input TokenType:K_EQEQ Follow:FOLLOW_K_EQEQ_in_condExpr622];
2445                        K_EQEQ43_tree = /* ASTParser createNodeFromToken */
2446                        (ANTLRCommonTree *)[[treeAdaptor createTree:K_EQEQ43] retain];
2447                        root_0 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:K_EQEQ43_tree old:root_0];
2448                          /* element() */
2449                         /* elements */
2450                        }
2451                        break;
2452                    case 2 : ;
2453                        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:78:28: K_LT // alt
2454                        {
2455                        K_LT44=(ANTLRCommonToken *)[self match:input TokenType:K_LT Follow:FOLLOW_K_LT_in_condExpr627];
2456                        K_LT44_tree = /* ASTParser createNodeFromToken */
2457                        (ANTLRCommonTree *)[[treeAdaptor createTree:K_LT44] retain];
2458                        root_0 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:K_LT44_tree old:root_0];
2459                          /* element() */
2460                         /* elements */
2461                        }
2462                        break;
2463
2464                }
2465                  /* element() */
2466                /* ASTParser ruleRef */
2467                [self pushFollow:FOLLOW_aexpr_in_condExpr631];
2468                aexpr45 = [self aexpr];
2469                [self popFollow];
2470
2471
2472                [treeAdaptor addChild:[aexpr45 getTree] toTree:root_0];  /* element() */
2473                 /* elements */
2474                }
2475                break;
2476
2477        }
2478          /* element() */
2479         /* elements */
2480        }
2481
2482        /* ASTParser ruleCleanUp */
2483        /* AST ruleCleanUp */
2484        // token+rule list labels
2485        [retval setStop:[input LT:-1]];
2486
2487
2488            retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
2489            [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken];
2490
2491    }
2492    @catch (ANTLRRecognitionException *re) {
2493        [self reportError:re];
2494        [self recover:input Exception:re];
2495        /* ASTParser rule.setErrorReturnValue */
2496        retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re];
2497
2498    }    @finally {
2499    }
2500    return retval;
2501}
2502/* $ANTLR end condExpr */
2503/*
2504 * $ANTLR start aexpr
2505 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:81:1: aexpr : atom ( K_PLUS atom )* ;
2506 */
2507- (SimpleCParser_aexpr_return *) aexpr
2508{
2509    /* ruleScopeSetUp */
2510
2511    /* AST ruleDeclarations */
2512    SimpleCParser_aexpr_return * retval = [SimpleCParser_aexpr_return newSimpleCParser_aexpr_return];
2513    [retval setStart:[input LT:1]];
2514
2515    ANTLRCommonTree *root_0 = nil;
2516
2517    @try {
2518        /* AST ruleLabelDefs */
2519        ANTLRCommonToken *K_PLUS47 = nil;
2520        SimpleCParser_atom_return * atom46 = nil;
2521
2522        SimpleCParser_atom_return * atom48 = nil;
2523
2524
2525        ANTLRCommonTree *K_PLUS47_tree=nil;
2526
2527        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:82:5: ( atom ( K_PLUS atom )* ) // ruleBlockSingleAlt
2528        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:82:9: atom ( K_PLUS atom )* // alt
2529        {
2530        root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
2531
2532        /* ASTParser ruleRef */
2533        [self pushFollow:FOLLOW_atom_in_aexpr653];
2534        atom46 = [self atom];
2535        [self popFollow];
2536
2537
2538        [treeAdaptor addChild:[atom46 getTree] toTree:root_0];  /* element() */
2539        do {
2540            NSInteger alt10=2;
2541            NSInteger LA10_0 = [input LA:1];
2542            if ( (LA10_0==K_PLUS) ) {
2543                alt10=1;
2544            }
2545
2546
2547            switch (alt10) {
2548                case 1 : ;
2549                    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:82:16: K_PLUS atom // alt
2550                    {
2551                    K_PLUS47=(ANTLRCommonToken *)[self match:input TokenType:K_PLUS Follow:FOLLOW_K_PLUS_in_aexpr657];
2552                    K_PLUS47_tree = /* ASTParser createNodeFromToken */
2553                    (ANTLRCommonTree *)[[treeAdaptor createTree:K_PLUS47] retain];
2554                    root_0 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:K_PLUS47_tree old:root_0];
2555                      /* element() */
2556                    /* ASTParser ruleRef */
2557                    [self pushFollow:FOLLOW_atom_in_aexpr660];
2558                    atom48 = [self atom];
2559                    [self popFollow];
2560
2561
2562                    [treeAdaptor addChild:[atom48 getTree] toTree:root_0];  /* element() */
2563                     /* elements */
2564                    }
2565                    break;
2566
2567                default :
2568                    goto loop10;
2569            }
2570        } while (YES);
2571        loop10: ;
2572          /* element() */
2573         /* elements */
2574        }
2575
2576        /* ASTParser ruleCleanUp */
2577        /* AST ruleCleanUp */
2578        // token+rule list labels
2579        [retval setStop:[input LT:-1]];
2580
2581
2582            retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
2583            [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken];
2584
2585    }
2586    @catch (ANTLRRecognitionException *re) {
2587        [self reportError:re];
2588        [self recover:input Exception:re];
2589        /* ASTParser rule.setErrorReturnValue */
2590        retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re];
2591
2592    }    @finally {
2593    }
2594    return retval;
2595}
2596/* $ANTLR end aexpr */
2597/*
2598 * $ANTLR start atom
2599 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:85:1: atom : ( K_ID | K_INT | '(' expr ')' -> expr );
2600 */
2601- (SimpleCParser_atom_return *) atom
2602{
2603    /* ruleScopeSetUp */
2604
2605    /* AST ruleDeclarations */
2606    SimpleCParser_atom_return * retval = [SimpleCParser_atom_return newSimpleCParser_atom_return];
2607    [retval setStart:[input LT:1]];
2608
2609    ANTLRCommonTree *root_0 = nil;
2610
2611    @try {
2612        /* AST ruleLabelDefs */
2613        ANTLRCommonToken *K_ID49 = nil;
2614        ANTLRCommonToken *K_INT50 = nil;
2615        ANTLRCommonToken *char_literal51 = nil;
2616        ANTLRCommonToken *char_literal53 = nil;
2617        SimpleCParser_expr_return * expr52 = nil;
2618
2619
2620        ANTLRCommonTree *K_ID49_tree=nil;
2621        ANTLRCommonTree *K_INT50_tree=nil;
2622        ANTLRCommonTree *char_literal51_tree=nil;
2623        ANTLRCommonTree *char_literal53_tree=nil;
2624        ANTLRRewriteRuleTokenStream *stream_22 =
2625            [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
2626                                                             description:@"token 22"] retain];
2627        ANTLRRewriteRuleTokenStream *stream_24 =
2628            [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
2629                                                             description:@"token 24"] retain];
2630        ANTLRRewriteRuleSubtreeStream *stream_expr =
2631            [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
2632                                                                description:@"rule expr"] retain];
2633        // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:86:5: ( K_ID | K_INT | '(' expr ')' -> expr ) //ruleblock
2634        NSInteger alt11=3;
2635        switch ([input LA:1]) {
2636            case K_ID: ;
2637                {
2638                alt11=1;
2639                }
2640                break;
2641            case K_INT: ;
2642                {
2643                alt11=2;
2644                }
2645                break;
2646            case 22: ;
2647                {
2648                alt11=3;
2649                }
2650                break;
2651
2652        default: ;
2653            ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newANTLRNoViableAltException:11 state:0 stream:input];
2654            @throw nvae;
2655        }
2656
2657        switch (alt11) {
2658            case 1 : ;
2659                // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:86:7: K_ID // alt
2660                {
2661                root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
2662
2663                /* ASTParser tokenRef */
2664                K_ID49=(ANTLRCommonToken *)[self match:input TokenType:K_ID Follow:FOLLOW_K_ID_in_atom680];
2665                K_ID49_tree = /* ASTParser createNodeFromToken */
2666                (ANTLRCommonTree *)[[treeAdaptor createTree:K_ID49] retain];
2667                [treeAdaptor addChild:K_ID49_tree  toTree:root_0];
2668                  /* element() */
2669                 /* elements */
2670                }
2671                break;
2672            case 2 : ;
2673                // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:87:7: K_INT // alt
2674                {
2675                root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
2676
2677                /* ASTParser tokenRef */
2678                K_INT50=(ANTLRCommonToken *)[self match:input TokenType:K_INT Follow:FOLLOW_K_INT_in_atom694];
2679                K_INT50_tree = /* ASTParser createNodeFromToken */
2680                (ANTLRCommonTree *)[[treeAdaptor createTree:K_INT50] retain];
2681                [treeAdaptor addChild:K_INT50_tree  toTree:root_0];
2682                  /* element() */
2683                 /* elements */
2684                }
2685                break;
2686            case 3 : ;
2687                // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:88:7: '(' expr ')' // alt
2688                {
2689                char_literal51=(ANTLRCommonToken *)[self match:input TokenType:22 Follow:FOLLOW_22_in_atom708];
2690                    [stream_22 addElement:char_literal51];
2691                  /* element() */
2692                [self pushFollow:FOLLOW_expr_in_atom710];
2693                expr52 = [self expr];
2694                [self popFollow];
2695
2696
2697                [stream_expr addElement:[expr52 getTree]];  /* element() */
2698                char_literal53=(ANTLRCommonToken *)[self match:input TokenType:24 Follow:FOLLOW_24_in_atom712];
2699                    [stream_24 addElement:char_literal53];
2700                  /* element() */
2701                 /* elements */
2702
2703                // AST REWRITE
2704                // elements: expr
2705                // token labels:
2706                // rule labels: retval
2707                // token list labels:
2708                // rule list labels:
2709                // wildcard labels:
2710                 [retval setTree:root_0];
2711
2712                retval.tree = root_0;
2713
2714                ANTLRRewriteRuleSubtreeStream *stream_retval =
2715                    [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
2716                                                                        description:@"token retval"
2717                                                                            element:retval!=nil?[retval getTree]:nil] retain];
2718
2719                root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
2720
2721                // 88:20: -> expr
2722                {
2723                    [treeAdaptor addChild:[stream_expr nextTree] toTree:root_0];
2724
2725                }
2726
2727                retval.tree = root_0;
2728
2729                }
2730                break;
2731
2732        }
2733        /* ASTParser ruleCleanUp */
2734        /* AST ruleCleanUp */
2735        // token+rule list labels
2736        [retval setStop:[input LT:-1]];
2737
2738        [stream_22 release];
2739        [stream_24 release];
2740        [stream_expr release];
2741
2742            retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
2743            [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken];
2744
2745    }
2746    @catch (ANTLRRecognitionException *re) {
2747        [self reportError:re];
2748        [self recover:input Exception:re];
2749        /* ASTParser rule.setErrorReturnValue */
2750        retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re];
2751
2752    }    @finally {
2753    }
2754    return retval;
2755}
2756/* $ANTLR end atom */
2757
2758@end /* end of SimpleCParser implementation line 669 */
2759
2760
2761/* End of code
2762 * =============================================================================
2763 */
2764