• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/** \file
2 *  This OBJC source file was generated by $ANTLR version 3.4
3 *
4 *     -  From the grammar source file : /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/polydiff/Poly.g
5 *     -                            On : 2012-02-16 18:10:10
6 *     -                for the parser : PolyParserParser
7 *
8 * Editing it, at least manually, is not wise.
9 *
10 * ObjC language generator and runtime by Alan Condit, acondit|hereisanat|ipns|dotgoeshere|com.
11 *
12 *
13*/
14// $ANTLR 3.4 /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/polydiff/Poly.g 2012-02-16 18:10:10
15
16
17/* -----------------------------------------
18 * Include the ANTLR3 generated header file.
19 */
20#import "PolyParser.h"
21/* ----------------------------------------- */
22
23
24/* ============================================================================= */
25/* =============================================================================
26 * Start of recognizer
27 */
28
29#pragma mark Bitsets
30static ANTLRBitSet *FOLLOW_term_in_poly43;
31static const unsigned long long FOLLOW_term_in_poly43_data[] = { 0x0000000000000102LL};
32static ANTLRBitSet *FOLLOW_8_in_poly46;
33static const unsigned long long FOLLOW_8_in_poly46_data[] = { 0x0000000000000030LL};
34static ANTLRBitSet *FOLLOW_term_in_poly49;
35static const unsigned long long FOLLOW_term_in_poly49_data[] = { 0x0000000000000102LL};
36static ANTLRBitSet *FOLLOW_INT_in_term63;
37static const unsigned long long FOLLOW_INT_in_term63_data[] = { 0x0000000000000010LL};
38static ANTLRBitSet *FOLLOW_ID_in_term65;
39static const unsigned long long FOLLOW_ID_in_term65_data[] = { 0x0000000000000002LL};
40static ANTLRBitSet *FOLLOW_INT_in_term85;
41static const unsigned long long FOLLOW_INT_in_term85_data[] = { 0x0000000000000010LL};
42static ANTLRBitSet *FOLLOW_exp_in_term87;
43static const unsigned long long FOLLOW_exp_in_term87_data[] = { 0x0000000000000002LL};
44static ANTLRBitSet *FOLLOW_exp_in_term106;
45static const unsigned long long FOLLOW_exp_in_term106_data[] = { 0x0000000000000002LL};
46static ANTLRBitSet *FOLLOW_INT_in_term114;
47static const unsigned long long FOLLOW_INT_in_term114_data[] = { 0x0000000000000002LL};
48static ANTLRBitSet *FOLLOW_ID_in_term119;
49static const unsigned long long FOLLOW_ID_in_term119_data[] = { 0x0000000000000002LL};
50static ANTLRBitSet *FOLLOW_ID_in_exp132;
51static const unsigned long long FOLLOW_ID_in_exp132_data[] = { 0x0000000000000200LL};
52static ANTLRBitSet *FOLLOW_9_in_exp134;
53static const unsigned long long FOLLOW_9_in_exp134_data[] = { 0x0000000000000020LL};
54static ANTLRBitSet *FOLLOW_INT_in_exp137;
55static const unsigned long long FOLLOW_INT_in_exp137_data[] = { 0x0000000000000002LL};
56
57
58#pragma mark Dynamic Global globalAttributeScopeImplementation
59
60#pragma mark Dynamic Rule Scopes ruleAttributeScopeImplementation
61
62#pragma mark Rule Return Scopes returnScopeImplementation
63@implementation PolyParser_poly_return /* returnScopeImplementation */
64/* AST returnScope.synthesize */
65@synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
66+ (PolyParser_poly_return *)newPolyParser_poly_return
67{
68return [[[PolyParser_poly_return alloc] init] retain];
69}
70
71- (id) init
72{
73self = [super init];
74return self;
75}
76
77/* AST returnScope.methods */
78- (CommonTree *)getTree
79{
80    return tree;
81}
82
83- (void) setTree:(CommonTree *)aTree
84{
85    if (tree != aTree) {
86        if (tree != nil) [tree release];
87        if (aTree != nil) [aTree retain];
88        tree = aTree;
89    }
90}
91
92- (void) dealloc
93{
94    self.tree = nil;
95    [super dealloc];
96}
97
98
99@end /* end of returnScope implementation */
100
101@implementation PolyParser_term_return /* returnScopeImplementation */
102/* AST returnScope.synthesize */
103@synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
104+ (PolyParser_term_return *)newPolyParser_term_return
105{
106return [[[PolyParser_term_return alloc] init] retain];
107}
108
109- (id) init
110{
111self = [super init];
112return self;
113}
114
115/* AST returnScope.methods */
116- (CommonTree *)getTree
117{
118    return tree;
119}
120
121- (void) setTree:(CommonTree *)aTree
122{
123    if (tree != aTree) {
124        if (tree != nil) [tree release];
125        if (aTree != nil) [aTree retain];
126        tree = aTree;
127    }
128}
129
130- (void) dealloc
131{
132    self.tree = nil;
133    [super dealloc];
134}
135
136
137@end /* end of returnScope implementation */
138
139@implementation PolyParser_exp_return /* returnScopeImplementation */
140/* AST returnScope.synthesize */
141@synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
142+ (PolyParser_exp_return *)newPolyParser_exp_return
143{
144return [[[PolyParser_exp_return alloc] init] retain];
145}
146
147- (id) init
148{
149self = [super init];
150return self;
151}
152
153/* AST returnScope.methods */
154- (CommonTree *)getTree
155{
156    return tree;
157}
158
159- (void) setTree:(CommonTree *)aTree
160{
161    if (tree != aTree) {
162        if (tree != nil) [tree release];
163        if (aTree != nil) [aTree retain];
164        tree = aTree;
165    }
166}
167
168- (void) dealloc
169{
170    self.tree = nil;
171    [super dealloc];
172}
173
174
175@end /* end of returnScope implementation */
176
177
178
179@implementation PolyParser  // line 637
180
181/* ObjC start of ruleAttributeScope */
182#pragma mark Dynamic Rule Scopes ruleAttributeScope
183/* ObjC end of ruleAttributeScope */
184#pragma mark global Attribute Scopes globalAttributeScope
185/* ObjC start globalAttributeScope */
186/* ObjC end globalAttributeScope */
187/* ObjC start actions.(actionScope).synthesize */
188/* ObjC start synthesize() */
189/* AST genericParser.synthesize */
190/* AST parserProperties */
191@synthesize treeAdaptor;
192
193+ (void) initialize
194{
195    #pragma mark Bitsets
196    FOLLOW_term_in_poly43 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_term_in_poly43_data Count:(NSUInteger)1] retain];
197    FOLLOW_8_in_poly46 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_8_in_poly46_data Count:(NSUInteger)1] retain];
198    FOLLOW_term_in_poly49 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_term_in_poly49_data Count:(NSUInteger)1] retain];
199    FOLLOW_INT_in_term63 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_INT_in_term63_data Count:(NSUInteger)1] retain];
200    FOLLOW_ID_in_term65 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_term65_data Count:(NSUInteger)1] retain];
201    FOLLOW_INT_in_term85 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_INT_in_term85_data Count:(NSUInteger)1] retain];
202    FOLLOW_exp_in_term87 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_exp_in_term87_data Count:(NSUInteger)1] retain];
203    FOLLOW_exp_in_term106 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_exp_in_term106_data Count:(NSUInteger)1] retain];
204    FOLLOW_INT_in_term114 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_INT_in_term114_data Count:(NSUInteger)1] retain];
205    FOLLOW_ID_in_term119 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_term119_data Count:(NSUInteger)1] retain];
206    FOLLOW_ID_in_exp132 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_exp132_data Count:(NSUInteger)1] retain];
207    FOLLOW_9_in_exp134 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_9_in_exp134_data Count:(NSUInteger)1] retain];
208    FOLLOW_INT_in_exp137 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_INT_in_exp137_data Count:(NSUInteger)1] retain];
209
210    [BaseRecognizer setTokenNames:[[AMutableArray arrayWithObjects:@"<invalid>", @"<EOR>", @"<DOWN>", @"<UP>",
211 @"ID", @"INT", @"MULT", @"WS", @"'+'", @"'^'", nil] retain]];
212    [BaseRecognizer setGrammarFileName:@"/Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/polydiff/Poly.g"];
213}
214
215+ (PolyParser *)newPolyParser:(id<TokenStream>)aStream
216{
217    return [[PolyParser alloc] initWithTokenStream:aStream];
218}
219
220- (id) initWithTokenStream:(id<TokenStream>)aStream
221{
222    self = [super initWithTokenStream:aStream State:[[RecognizerSharedState newRecognizerSharedStateWithRuleLen:3+1] retain]];
223    if ( self != nil ) {
224        /* start of actions-actionScope-init */
225        /* start of init */
226        /* AST genericParser.init */
227        [self setTreeAdaptor:[[CommonTreeAdaptor newTreeAdaptor] retain]];
228    }
229    return self;
230}
231
232- (void) dealloc
233{
234    /* AST genericParser.dealloc */
235    [self setTreeAdaptor:nil];
236
237    [super dealloc];
238}
239
240/* ObjC start actions.(actionScope).methods */
241/* ObjC end actions.(actionScope).methods */
242/* ObjC start methods() */
243/* AST genericParser.methods */
244/* AST parserMethods */
245- (id<TreeAdaptor>) getTreeAdaptor
246{
247	return treeAdaptor;
248}
249
250- (void) setTreeAdaptor:(id<TreeAdaptor>)aTreeAdaptor
251{
252	if (aTreeAdaptor != treeAdaptor) {
253		treeAdaptor = aTreeAdaptor;
254	}
255}
256/* ObjC end methods() */
257/* ObjC start rules */
258/*
259 * $ANTLR start poly
260 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/polydiff/Poly.g:8:1: poly : term ( '+' ^ term )* ;
261 */
262- (PolyParser_poly_return *) poly
263{
264    /* ruleScopeSetUp */
265
266    /* AST ruleDeclarations */
267    /* ruleDeclarations */
268    PolyParser_poly_return * retval = [PolyParser_poly_return newPolyParser_poly_return];
269    [retval setStart:[input LT:1]];
270
271
272    CommonTree *root_0 = nil;
273
274    @try {
275        /* AST ruleLabelDefs */
276        /* ruleLabelDefs entry */
277        CommonToken *char_literal2 = nil;PolyParser_term_return * term1 = nil ;
278
279        PolyParser_term_return * term3 = nil ;
280
281
282        CommonTree *char_literal2_tree=nil;
283
284        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/polydiff/Poly.g:8:5: ( term ( '+' ^ term )* ) // ruleBlockSingleAlt
285        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/polydiff/Poly.g:8:7: term ( '+' ^ term )* // alt
286        {
287        root_0 = (CommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
288
289
290
291        /* ASTParser ruleRef */
292        /* ruleRef */
293        [self pushFollow:FOLLOW_term_in_poly43];
294        term1 = [self term];
295
296        [self popFollow];
297
298
299        [treeAdaptor addChild:[term1 getTree] toTree:root_0];
300
301
302        do {
303            NSInteger alt1=2;
304            NSInteger LA1_0 = [input LA:1];
305            if ( (LA1_0==8) ) {
306                alt1=1;
307            }
308
309
310            switch (alt1) {
311                case 1 : ;
312                    // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/polydiff/Poly.g:8:13: '+' ^ term // alt
313                    {
314
315                    char_literal2=(CommonToken *)[self match:input TokenType:8 Follow:FOLLOW_8_in_poly46];
316                    char_literal2_tree = /* ASTParser createNodeFromToken */
317                    (CommonTree *)[[treeAdaptor create:char_literal2] retain]
318                    ;
319                    root_0 = (CommonTree *)[treeAdaptor becomeRoot:char_literal2_tree old:root_0];
320
321
322                    /* ASTParser ruleRef */
323                    /* ruleRef */
324                    [self pushFollow:FOLLOW_term_in_poly49];
325                    term3 = [self term];
326
327                    [self popFollow];
328
329
330                    [treeAdaptor addChild:[term3 getTree] toTree:root_0];
331
332                    }
333                    break;
334
335                default :
336                    goto loop1;
337            }
338        } while (YES);
339        loop1: ;
340
341
342        }
343
344        /* ASTParser ruleCleanUp */
345        /* AST ruleCleanUp */
346        /* token+rule list labels */
347        [retval setStop:[input LT:-1]];
348
349
350
351            retval.tree = (CommonTree *)[treeAdaptor rulePostProcessing:root_0];
352            [treeAdaptor setTokenBoundaries:retval.tree From:retval.start To:retval.stopToken];
353
354    }
355    @catch (RecognitionException *re) {
356        [self reportError:re];
357        [self recover:input Exception:re];
358        /* ASTParser rule.setErrorReturnValue */
359        retval.tree = (CommonTree *)[treeAdaptor errorNode:input From:retval.start To:[input LT:-1] Exception:re];
360
361    }
362
363    @finally {
364        /* ruleScopeCleanUp */
365
366    }
367    return retval;
368}
369/* $ANTLR end poly */
370
371/*
372 * $ANTLR start term
373 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/polydiff/Poly.g:11:1: term : ( INT ID -> ^( MULT[@\"*\"] INT ID ) | INT exp -> ^( MULT[@\"*\"] INT exp ) | exp | INT | ID );
374 */
375- (PolyParser_term_return *) term
376{
377    /* ruleScopeSetUp */
378
379    /* AST ruleDeclarations */
380    /* ruleDeclarations */
381    PolyParser_term_return * retval = [PolyParser_term_return newPolyParser_term_return];
382    [retval setStart:[input LT:1]];
383
384
385    CommonTree *root_0 = nil;
386
387    @try {
388        /* AST ruleLabelDefs */
389        /* ruleLabelDefs entry */
390        CommonToken *INT4 = nil;
391        CommonToken *ID5 = nil;
392        CommonToken *INT6 = nil;
393        CommonToken *INT9 = nil;
394        CommonToken *ID10 = nil;PolyParser_exp_return * exp7 = nil ;
395
396        PolyParser_exp_return * exp8 = nil ;
397
398
399        CommonTree *INT4_tree=nil;
400        CommonTree *ID5_tree=nil;
401        CommonTree *INT6_tree=nil;
402        CommonTree *INT9_tree=nil;
403        CommonTree *ID10_tree=nil;
404        RewriteRuleTokenStream *stream_INT =
405            [[RewriteRuleTokenStream newRewriteRuleTokenStream:treeAdaptor
406                                                             description:@"token INT"] retain];
407        RewriteRuleTokenStream *stream_ID =
408            [[RewriteRuleTokenStream newRewriteRuleTokenStream:treeAdaptor
409                                                             description:@"token ID"] retain];
410        RewriteRuleSubtreeStream *stream_exp =
411            [[RewriteRuleSubtreeStream newRewriteRuleSubtreeStream:treeAdaptor
412                                                                description:@"rule exp"] retain];
413        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/polydiff/Poly.g:11:5: ( INT ID -> ^( MULT[@\"*\"] INT ID ) | INT exp -> ^( MULT[@\"*\"] INT exp ) | exp | INT | ID ) //ruleblock
414        NSInteger alt2=5;
415        NSInteger LA2_0 = [input LA:1];
416
417        if ( (LA2_0==INT) ) {
418            NSInteger LA2_1 = [input LA:2];
419
420            if ( (LA2_1==ID) ) {
421                NSInteger LA2_3 = [input LA:3];
422
423                if ( (LA2_3==9) ) {
424                    alt2=2;
425                }
426                else if ( (LA2_3==EOF||LA2_3==8) ) {
427                    alt2=1;
428                }
429                else {
430                    NoViableAltException *nvae = [NoViableAltException newException:2 state:3 stream:input];
431                    nvae.c = LA2_3;
432                    @throw nvae;
433
434                }
435            }
436            else if ( (LA2_1==EOF||LA2_1==8) ) {
437                alt2=4;
438            }
439            else {
440                NoViableAltException *nvae = [NoViableAltException newException:2 state:1 stream:input];
441                nvae.c = LA2_1;
442                @throw nvae;
443
444            }
445        }
446        else if ( (LA2_0==ID) ) {
447            NSInteger LA2_2 = [input LA:2];
448
449            if ( (LA2_2==9) ) {
450                alt2=3;
451            }
452            else if ( (LA2_2==EOF||LA2_2==8) ) {
453                alt2=5;
454            }
455            else {
456                NoViableAltException *nvae = [NoViableAltException newException:2 state:2 stream:input];
457                nvae.c = LA2_2;
458                @throw nvae;
459
460            }
461        }
462        else {
463            NoViableAltException *nvae = [NoViableAltException newException:2 state:0 stream:input];
464            nvae.c = LA2_0;
465            @throw nvae;
466
467        }
468        switch (alt2) {
469            case 1 : ;
470                // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/polydiff/Poly.g:11:7: INT ID // alt
471                {
472
473                INT4=(CommonToken *)[self match:input TokenType:INT Follow:FOLLOW_INT_in_term63];
474                    [stream_INT addElement:INT4];
475
476
477                ID5=(CommonToken *)[self match:input TokenType:ID Follow:FOLLOW_ID_in_term65];
478                    [stream_ID addElement:ID5];
479
480
481                // AST REWRITE
482                // elements: ID, INT
483                // token labels:
484                // rule labels: retval
485                // token list labels:
486                // rule list labels:
487                // wildcard labels:
488                retval.tree = root_0;
489
490                RewriteRuleSubtreeStream *stream_retval =
491                    [[RewriteRuleSubtreeStream newRewriteRuleSubtreeStream:treeAdaptor
492                        description:@"token retval" element:retval!=nil?[retval getTree]:nil] retain];
493
494                root_0 = (CommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
495
496                // 11:15: -> ^( MULT[@\"*\"] INT ID )
497                {
498                    // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/polydiff/Poly.g:11:18: ^( MULT[@\"*\"] INT ID )
499                    {
500                        CommonTree *root_1 = (CommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
501                        root_1 = (CommonTree *)[treeAdaptor becomeRoot:
502                                [[treeAdaptor createTree:MULT FromToken:@"*" Text:@"MULT"] retain]
503                         old:root_1];
504
505                         // TODO: args:
506                        [treeAdaptor addChild:
507                                    [stream_INT nextNode]
508                         toTree:root_1];
509
510                         // TODO: args:
511                        [treeAdaptor addChild:
512                                    [stream_ID nextNode]
513                         toTree:root_1];
514
515                        [treeAdaptor addChild:root_1 toTree:root_0];
516                    }
517
518                }
519
520
521                retval.tree = root_0;
522
523
524                }
525                break;
526            case 2 : ;
527                // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/polydiff/Poly.g:12:7: INT exp // alt
528                {
529
530                INT6=(CommonToken *)[self match:input TokenType:INT Follow:FOLLOW_INT_in_term85];
531                    [stream_INT addElement:INT6];
532
533
534                /* ruleRef */
535                [self pushFollow:FOLLOW_exp_in_term87];
536                exp7 = [self exp];
537
538                [self popFollow];
539
540
541                [stream_exp addElement:[exp7 getTree]];
542
543                // AST REWRITE
544                // elements: exp, INT
545                // token labels:
546                // rule labels: retval
547                // token list labels:
548                // rule list labels:
549                // wildcard labels:
550                retval.tree = root_0;
551
552                RewriteRuleSubtreeStream *stream_retval =
553                    [[RewriteRuleSubtreeStream newRewriteRuleSubtreeStream:treeAdaptor
554                        description:@"token retval" element:retval!=nil?[retval getTree]:nil] retain];
555
556                root_0 = (CommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
557
558                // 12:15: -> ^( MULT[@\"*\"] INT exp )
559                {
560                    // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/polydiff/Poly.g:12:18: ^( MULT[@\"*\"] INT exp )
561                    {
562                        CommonTree *root_1 = (CommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
563                        root_1 = (CommonTree *)[treeAdaptor becomeRoot:
564                                [[treeAdaptor createTree:MULT FromToken:@"*" Text:@"MULT"] retain]
565                         old:root_1];
566
567                         // TODO: args:
568                        [treeAdaptor addChild:
569                                    [stream_INT nextNode]
570                         toTree:root_1];
571
572                        [treeAdaptor addChild:[stream_exp nextTree] toTree:root_1];
573
574                        [treeAdaptor addChild:root_1 toTree:root_0];
575                    }
576
577                }
578
579
580                retval.tree = root_0;
581
582
583                }
584                break;
585            case 3 : ;
586                // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/polydiff/Poly.g:13:7: exp // alt
587                {
588                root_0 = (CommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
589
590
591
592                /* ASTParser ruleRef */
593                /* ruleRef */
594                [self pushFollow:FOLLOW_exp_in_term106];
595                exp8 = [self exp];
596
597                [self popFollow];
598
599
600                [treeAdaptor addChild:[exp8 getTree] toTree:root_0];
601
602                }
603                break;
604            case 4 : ;
605                // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/polydiff/Poly.g:14:7: INT // alt
606                {
607                root_0 = (CommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
608
609
610
611                /* ASTParser tokenRef */
612                INT9=(CommonToken *)[self match:input TokenType:INT Follow:FOLLOW_INT_in_term114];
613                INT9_tree = /* ASTParser createNodeFromToken */
614                (CommonTree *)[[treeAdaptor create:INT9] retain]
615                ;
616                [treeAdaptor addChild:INT9_tree  toTree:root_0];
617
618
619                }
620                break;
621            case 5 : ;
622                // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/polydiff/Poly.g:15:4: ID // alt
623                {
624                root_0 = (CommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
625
626
627
628                /* ASTParser tokenRef */
629                ID10=(CommonToken *)[self match:input TokenType:ID Follow:FOLLOW_ID_in_term119];
630                ID10_tree = /* ASTParser createNodeFromToken */
631                (CommonTree *)[[treeAdaptor create:ID10] retain]
632                ;
633                [treeAdaptor addChild:ID10_tree  toTree:root_0];
634
635
636                }
637                break;
638
639        }
640        /* ASTParser ruleCleanUp */
641        /* AST ruleCleanUp */
642        /* token+rule list labels */
643        [retval setStop:[input LT:-1]];
644
645
646        [stream_INT release];
647        [stream_ID release];
648        [stream_exp release];
649
650            retval.tree = (CommonTree *)[treeAdaptor rulePostProcessing:root_0];
651            [treeAdaptor setTokenBoundaries:retval.tree From:retval.start To:retval.stopToken];
652
653    }
654    @catch (RecognitionException *re) {
655        [self reportError:re];
656        [self recover:input Exception:re];
657        /* ASTParser rule.setErrorReturnValue */
658        retval.tree = (CommonTree *)[treeAdaptor errorNode:input From:retval.start To:[input LT:-1] Exception:re];
659
660    }
661
662    @finally {
663        /* ruleScopeCleanUp */
664
665    }
666    return retval;
667}
668/* $ANTLR end term */
669
670/*
671 * $ANTLR start exp
672 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/polydiff/Poly.g:18:1: exp : ID '^' ^ INT ;
673 */
674- (PolyParser_exp_return *) exp
675{
676    /* ruleScopeSetUp */
677
678    /* AST ruleDeclarations */
679    /* ruleDeclarations */
680    PolyParser_exp_return * retval = [PolyParser_exp_return newPolyParser_exp_return];
681    [retval setStart:[input LT:1]];
682
683
684    CommonTree *root_0 = nil;
685
686    @try {
687        /* AST ruleLabelDefs */
688        /* ruleLabelDefs entry */
689        CommonToken *ID11 = nil;
690        CommonToken *char_literal12 = nil;
691        CommonToken *INT13 = nil;
692
693        CommonTree *ID11_tree=nil;
694        CommonTree *char_literal12_tree=nil;
695        CommonTree *INT13_tree=nil;
696
697        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/polydiff/Poly.g:18:5: ( ID '^' ^ INT ) // ruleBlockSingleAlt
698        // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/polydiff/Poly.g:18:7: ID '^' ^ INT // alt
699        {
700        root_0 = (CommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
701
702
703
704        /* ASTParser tokenRef */
705        ID11=(CommonToken *)[self match:input TokenType:ID Follow:FOLLOW_ID_in_exp132];
706        ID11_tree = /* ASTParser createNodeFromToken */
707        (CommonTree *)[[treeAdaptor create:ID11] retain]
708        ;
709        [treeAdaptor addChild:ID11_tree  toTree:root_0];
710
711
712        char_literal12=(CommonToken *)[self match:input TokenType:9 Follow:FOLLOW_9_in_exp134];
713        char_literal12_tree = /* ASTParser createNodeFromToken */
714        (CommonTree *)[[treeAdaptor create:char_literal12] retain]
715        ;
716        root_0 = (CommonTree *)[treeAdaptor becomeRoot:char_literal12_tree old:root_0];
717
718
719        /* ASTParser tokenRef */
720        INT13=(CommonToken *)[self match:input TokenType:INT Follow:FOLLOW_INT_in_exp137];
721        INT13_tree = /* ASTParser createNodeFromToken */
722        (CommonTree *)[[treeAdaptor create:INT13] retain]
723        ;
724        [treeAdaptor addChild:INT13_tree  toTree:root_0];
725
726
727        }
728
729        /* ASTParser ruleCleanUp */
730        /* AST ruleCleanUp */
731        /* token+rule list labels */
732        [retval setStop:[input LT:-1]];
733
734
735
736            retval.tree = (CommonTree *)[treeAdaptor rulePostProcessing:root_0];
737            [treeAdaptor setTokenBoundaries:retval.tree From:retval.start To:retval.stopToken];
738
739    }
740    @catch (RecognitionException *re) {
741        [self reportError:re];
742        [self recover:input Exception:re];
743        /* ASTParser rule.setErrorReturnValue */
744        retval.tree = (CommonTree *)[treeAdaptor errorNode:input From:retval.start To:[input LT:-1] Exception:re];
745
746    }
747
748    @finally {
749        /* ruleScopeCleanUp */
750
751    }
752    return retval;
753}
754/* $ANTLR end exp */
755/* ObjC end rules */
756
757@end /* end of PolyParser implementation line 692 */
758