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