Home | History | Annotate | Download | only in combined
      1 /** \file
      2  *  This OBJC source file was generated by $ANTLR version 3.2 Aug 24, 2010 10:45:57
      3  *
      4  *     -  From the grammar source file : Combined.g
      5  *     -                            On : 2010-08-24 13:53:42
      6  *     -                for the parser : CombinedParserParser *
      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 24, 2010 10:45:57 Combined.g 2010-08-24 13:53:42
     41 
     42 /* -----------------------------------------
     43  * Include the ANTLR3 generated header file.
     44  */
     45 #import "CombinedParser.h"
     46 /* ----------------------------------------- */
     47 
     48 
     49 /* ============================================================================= */
     50 
     51 /* =============================================================================
     52  * Start of recognizer
     53  */
     54 
     55 
     56 
     57 #pragma mark Bitsets
     58 static ANTLRBitSet *FOLLOW_identifier_in_stat20;
     59 static const unsigned long long FOLLOW_identifier_in_stat20_data[] = { 0x0000000000000012LL};
     60 static ANTLRBitSet *FOLLOW_ID_in_identifier35;
     61 static const unsigned long long FOLLOW_ID_in_identifier35_data[] = { 0x0000000000000002LL};
     62 
     63 
     64 #pragma mark Dynamic Global Scopes
     65 
     66 #pragma mark Dynamic Rule Scopes
     67 
     68 #pragma mark Rule return scopes start
     69 /* returnScope */
     70 
     71 /* returnScope */
     72 
     73 
     74 
     75 @implementation CombinedParser  // line 637
     76 
     77 + (void) initialize
     78 {
     79     #pragma mark Bitsets
     80     FOLLOW_identifier_in_stat20 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_identifier_in_stat20_data Count:(NSUInteger)1] retain];
     81     FOLLOW_ID_in_identifier35 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_identifier35_data Count:(NSUInteger)1] retain];
     82 
     83     [ANTLRBaseRecognizer setTokenNames:[[[NSArray alloc] initWithObjects:@"<invalid>", @"<EOR>", @"<DOWN>", @"<UP>",
     84  @"ID", @"INT", @"WS", nil] retain]];
     85 }
     86 
     87 + (CombinedParser *)newCombinedParser:(id<ANTLRTokenStream>)aStream
     88 {
     89     return [[CombinedParser alloc] initWithTokenStream:aStream];
     90 
     91 }
     92 
     93 - (id) initWithTokenStream:(id<ANTLRTokenStream>)aStream
     94 {
     95     if ((self = [super initWithTokenStream:aStream State:[[ANTLRRecognizerSharedState newANTLRRecognizerSharedStateWithRuleLen:2+1] retain]]) != nil) {
     96 
     97 
     98 
     99         /* start of actions-actionScope-init */
    100         /* start of init */
    101     }
    102     return self;
    103 }
    104 
    105 - (void) dealloc
    106 {
    107     [super dealloc];
    108 }
    109 // start actions.actionScope.methods
    110 // start methods()
    111 // start rules
    112 /*
    113  * $ANTLR start stat
    114  * Combined.g:7:1: stat : ( identifier )+ ;
    115  */
    116 - (void) stat
    117 {
    118     /* ruleScopeSetUp */
    119 
    120     @try {
    121         // Combined.g:7:5: ( ( identifier )+ ) // ruleBlockSingleAlt
    122         // Combined.g:7:7: ( identifier )+ // alt
    123         {
    124         // Combined.g:7:7: ( identifier )+ // positiveClosureBlock
    125         NSInteger cnt1=0;
    126         do {
    127             NSInteger alt1=2;
    128             NSInteger LA1_0 = [input LA:1];
    129             if ( (LA1_0==ID) ) {
    130                 alt1=1;
    131             }
    132 
    133 
    134             switch (alt1) {
    135                 case 1 : ;
    136                     // Combined.g:7:7: identifier // alt
    137                     {
    138                     [self pushFollow:FOLLOW_identifier_in_stat20];
    139                     [self identifier];
    140                     [self popFollow];
    141 
    142                       /* element() */
    143                      /* elements */
    144                     }
    145                     break;
    146 
    147                 default :
    148                     if ( cnt1 >= 1 )
    149                         goto loop1;
    150                     ANTLREarlyExitException *eee = [ANTLREarlyExitException exceptionWithStream:input decisionNumber:1];
    151                     @throw eee;
    152             }
    153             cnt1++;
    154         } while (YES);
    155         loop1: ;
    156           /* element() */
    157          /* elements */
    158         }
    159 
    160         // token+rule list labels
    161 
    162     }
    163     @catch (ANTLRRecognitionException *re) {
    164         [self reportError:re];
    165         [self recover:input Exception:re];
    166     }    @finally {
    167     }
    168     return ;
    169 }
    170 /* $ANTLR end stat */
    171 /*
    172  * $ANTLR start identifier
    173  * Combined.g:9:1: identifier : ID ;
    174  */
    175 - (void) identifier
    176 {
    177     /* ruleScopeSetUp */
    178 
    179     @try {
    180         // Combined.g:10:5: ( ID ) // ruleBlockSingleAlt
    181         // Combined.g:10:7: ID // alt
    182         {
    183         [self match:input TokenType:ID Follow:FOLLOW_ID_in_identifier35];   /* element() */
    184          /* elements */
    185         }
    186 
    187         // token+rule list labels
    188 
    189     }
    190     @catch (ANTLRRecognitionException *re) {
    191         [self reportError:re];
    192         [self recover:input Exception:re];
    193     }    @finally {
    194     }
    195     return ;
    196 }
    197 /* $ANTLR end identifier */
    198 
    199 @end /* end of CombinedParser implementation line 692 */
    200 
    201 
    202 /* End of code
    203  * =============================================================================
    204  */
    205