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/SimpleCTP.g 5 * - On : 2010-08-23 07:55:04 6 * - for the tree parser : SimpleCTPTreeParser * 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/SimpleCTP.g 2010-08-23 07:55:04 41 42 /* ----------------------------------------- 43 * Include the ANTLR3 generated header file. 44 */ 45 #import "SimpleCTP.h" 46 /* ----------------------------------------- */ 47 48 49 /* ============================================================================= */ 50 51 /* ============================================================================= 52 * Start of recognizer 53 */ 54 55 56 57 #pragma mark Bitsets 58 static ANTLRBitSet *FOLLOW_declaration_in_program56; 59 static const unsigned long long FOLLOW_declaration_in_program56_data[] = { 0x0000000000000192LL}; 60 static ANTLRBitSet *FOLLOW_variable_in_declaration76; 61 static const unsigned long long FOLLOW_variable_in_declaration76_data[] = { 0x0000000000000002LL}; 62 static ANTLRBitSet *FOLLOW_FUNC_DECL_in_declaration87; 63 static const unsigned long long FOLLOW_FUNC_DECL_in_declaration87_data[] = { 0x0000000000000004LL}; 64 static ANTLRBitSet *FOLLOW_functionHeader_in_declaration89; 65 static const unsigned long long FOLLOW_functionHeader_in_declaration89_data[] = { 0x0000000000000008LL}; 66 static ANTLRBitSet *FOLLOW_FUNC_DEF_in_declaration101; 67 static const unsigned long long FOLLOW_FUNC_DEF_in_declaration101_data[] = { 0x0000000000000004LL}; 68 static ANTLRBitSet *FOLLOW_functionHeader_in_declaration103; 69 static const unsigned long long FOLLOW_functionHeader_in_declaration103_data[] = { 0x0000000000000200LL}; 70 static ANTLRBitSet *FOLLOW_block_in_declaration105; 71 static const unsigned long long FOLLOW_block_in_declaration105_data[] = { 0x0000000000000008LL}; 72 static ANTLRBitSet *FOLLOW_VAR_DEF_in_variable126; 73 static const unsigned long long FOLLOW_VAR_DEF_in_variable126_data[] = { 0x0000000000000004LL}; 74 static ANTLRBitSet *FOLLOW_type_in_variable128; 75 static const unsigned long long FOLLOW_type_in_variable128_data[] = { 0x0000000000000400LL}; 76 static ANTLRBitSet *FOLLOW_declarator_in_variable130; 77 static const unsigned long long FOLLOW_declarator_in_variable130_data[] = { 0x0000000000000008LL}; 78 static ANTLRBitSet *FOLLOW_K_ID_in_declarator150; 79 static const unsigned long long FOLLOW_K_ID_in_declarator150_data[] = { 0x0000000000000002LL}; 80 static ANTLRBitSet *FOLLOW_FUNC_HDR_in_functionHeader171; 81 static const unsigned long long FOLLOW_FUNC_HDR_in_functionHeader171_data[] = { 0x0000000000000004LL}; 82 static ANTLRBitSet *FOLLOW_type_in_functionHeader173; 83 static const unsigned long long FOLLOW_type_in_functionHeader173_data[] = { 0x0000000000000400LL}; 84 static ANTLRBitSet *FOLLOW_K_ID_in_functionHeader175; 85 static const unsigned long long FOLLOW_K_ID_in_functionHeader175_data[] = { 0x0000000000000020LL}; 86 static ANTLRBitSet *FOLLOW_formalParameter_in_functionHeader177; 87 static const unsigned long long FOLLOW_formalParameter_in_functionHeader177_data[] = { 0x0000000000000028LL}; 88 static ANTLRBitSet *FOLLOW_ARG_DEF_in_formalParameter199; 89 static const unsigned long long FOLLOW_ARG_DEF_in_formalParameter199_data[] = { 0x0000000000000004LL}; 90 static ANTLRBitSet *FOLLOW_type_in_formalParameter201; 91 static const unsigned long long FOLLOW_type_in_formalParameter201_data[] = { 0x0000000000000400LL}; 92 static ANTLRBitSet *FOLLOW_declarator_in_formalParameter203; 93 static const unsigned long long FOLLOW_declarator_in_formalParameter203_data[] = { 0x0000000000000008LL}; 94 static ANTLRBitSet *FOLLOW_set_in_type0; 95 static const unsigned long long FOLLOW_set_in_type0_data[] = { 0x0000000000000002LL}; 96 static ANTLRBitSet *FOLLOW_BLOCK_in_block286; 97 static const unsigned long long FOLLOW_BLOCK_in_block286_data[] = { 0x0000000000000004LL}; 98 static ANTLRBitSet *FOLLOW_variable_in_block288; 99 static const unsigned long long FOLLOW_variable_in_block288_data[] = { 0x000000000007CE18LL}; 100 static ANTLRBitSet *FOLLOW_stat_in_block291; 101 static const unsigned long long FOLLOW_stat_in_block291_data[] = { 0x000000000007CE08LL}; 102 static ANTLRBitSet *FOLLOW_forStat_in_stat305; 103 static const unsigned long long FOLLOW_forStat_in_stat305_data[] = { 0x0000000000000002LL}; 104 static ANTLRBitSet *FOLLOW_expr_in_stat313; 105 static const unsigned long long FOLLOW_expr_in_stat313_data[] = { 0x0000000000000002LL}; 106 static ANTLRBitSet *FOLLOW_block_in_stat321; 107 static const unsigned long long FOLLOW_block_in_stat321_data[] = { 0x0000000000000002LL}; 108 static ANTLRBitSet *FOLLOW_K_FOR_in_forStat341; 109 static const unsigned long long FOLLOW_K_FOR_in_forStat341_data[] = { 0x0000000000000004LL}; 110 static ANTLRBitSet *FOLLOW_expr_in_forStat343; 111 static const unsigned long long FOLLOW_expr_in_forStat343_data[] = { 0x0000000000078C00LL}; 112 static ANTLRBitSet *FOLLOW_expr_in_forStat345; 113 static const unsigned long long FOLLOW_expr_in_forStat345_data[] = { 0x0000000000078C00LL}; 114 static ANTLRBitSet *FOLLOW_expr_in_forStat347; 115 static const unsigned long long FOLLOW_expr_in_forStat347_data[] = { 0x0000000000000200LL}; 116 static ANTLRBitSet *FOLLOW_block_in_forStat349; 117 static const unsigned long long FOLLOW_block_in_forStat349_data[] = { 0x0000000000000008LL}; 118 static ANTLRBitSet *FOLLOW_K_EQEQ_in_expr365; 119 static const unsigned long long FOLLOW_K_EQEQ_in_expr365_data[] = { 0x0000000000000004LL}; 120 static ANTLRBitSet *FOLLOW_expr_in_expr367; 121 static const unsigned long long FOLLOW_expr_in_expr367_data[] = { 0x0000000000078C00LL}; 122 static ANTLRBitSet *FOLLOW_expr_in_expr369; 123 static const unsigned long long FOLLOW_expr_in_expr369_data[] = { 0x0000000000000008LL}; 124 static ANTLRBitSet *FOLLOW_K_LT_in_expr381; 125 static const unsigned long long FOLLOW_K_LT_in_expr381_data[] = { 0x0000000000000004LL}; 126 static ANTLRBitSet *FOLLOW_expr_in_expr383; 127 static const unsigned long long FOLLOW_expr_in_expr383_data[] = { 0x0000000000078C00LL}; 128 static ANTLRBitSet *FOLLOW_expr_in_expr385; 129 static const unsigned long long FOLLOW_expr_in_expr385_data[] = { 0x0000000000000008LL}; 130 static ANTLRBitSet *FOLLOW_K_PLUS_in_expr397; 131 static const unsigned long long FOLLOW_K_PLUS_in_expr397_data[] = { 0x0000000000000004LL}; 132 static ANTLRBitSet *FOLLOW_expr_in_expr399; 133 static const unsigned long long FOLLOW_expr_in_expr399_data[] = { 0x0000000000078C00LL}; 134 static ANTLRBitSet *FOLLOW_expr_in_expr401; 135 static const unsigned long long FOLLOW_expr_in_expr401_data[] = { 0x0000000000000008LL}; 136 static ANTLRBitSet *FOLLOW_K_EQ_in_expr413; 137 static const unsigned long long FOLLOW_K_EQ_in_expr413_data[] = { 0x0000000000000004LL}; 138 static ANTLRBitSet *FOLLOW_K_ID_in_expr415; 139 static const unsigned long long FOLLOW_K_ID_in_expr415_data[] = { 0x0000000000078C00LL}; 140 static ANTLRBitSet *FOLLOW_expr_in_expr419; 141 static const unsigned long long FOLLOW_expr_in_expr419_data[] = { 0x0000000000000008LL}; 142 static ANTLRBitSet *FOLLOW_atom_in_expr432; 143 static const unsigned long long FOLLOW_atom_in_expr432_data[] = { 0x0000000000000002LL}; 144 static ANTLRBitSet *FOLLOW_set_in_atom0; 145 static const unsigned long long FOLLOW_set_in_atom0_data[] = { 0x0000000000000002LL}; 146 147 148 #pragma mark Dynamic Global Scopes 149 @implementation Symbols_Scope /* globalAttributeScopeImpl */ 150 /* start of synthesize -- OBJC-Line 1750 */ 151 152 @synthesize tree; 153 + (Symbols_Scope *)newSymbols_Scope 154 { 155 return [[[Symbols_Scope alloc] init] retain]; 156 } 157 /* start of iterate get and set functions */ 158 159 - (ANTLRCommonTree *)gettree { return( tree ); } 160 161 - (void)settree:(ANTLRCommonTree *)aVal { tree = aVal; } 162 163 164 165 /* End of iterate get and set functions */ 166 167 @end /* end of Symbols_Scope implementation */ 168 169 170 #pragma mark Dynamic Rule Scopes 171 172 #pragma mark Rule return scopes start 173 @implementation SimpleCTP_expr_return 174 + (SimpleCTP_expr_return *)newSimpleCTP_expr_return 175 { 176 return [[[SimpleCTP_expr_return alloc] init] retain]; 177 } 178 179 180 181 182 @end /* end of returnScope implementation */ 183 184 185 186 @implementation SimpleCTP // line 610 187 188 + (void) initialize 189 { 190 #pragma mark Bitsets 191 FOLLOW_declaration_in_program56 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_declaration_in_program56_data Count:(NSUInteger)1] retain]; 192 FOLLOW_variable_in_declaration76 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_variable_in_declaration76_data Count:(NSUInteger)1] retain]; 193 FOLLOW_FUNC_DECL_in_declaration87 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_FUNC_DECL_in_declaration87_data Count:(NSUInteger)1] retain]; 194 FOLLOW_functionHeader_in_declaration89 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_functionHeader_in_declaration89_data Count:(NSUInteger)1] retain]; 195 FOLLOW_FUNC_DEF_in_declaration101 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_FUNC_DEF_in_declaration101_data Count:(NSUInteger)1] retain]; 196 FOLLOW_functionHeader_in_declaration103 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_functionHeader_in_declaration103_data Count:(NSUInteger)1] retain]; 197 FOLLOW_block_in_declaration105 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_declaration105_data Count:(NSUInteger)1] retain]; 198 FOLLOW_VAR_DEF_in_variable126 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_VAR_DEF_in_variable126_data Count:(NSUInteger)1] retain]; 199 FOLLOW_type_in_variable128 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_variable128_data Count:(NSUInteger)1] retain]; 200 FOLLOW_declarator_in_variable130 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_variable130_data Count:(NSUInteger)1] retain]; 201 FOLLOW_K_ID_in_declarator150 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_ID_in_declarator150_data Count:(NSUInteger)1] retain]; 202 FOLLOW_FUNC_HDR_in_functionHeader171 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_FUNC_HDR_in_functionHeader171_data Count:(NSUInteger)1] retain]; 203 FOLLOW_type_in_functionHeader173 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_functionHeader173_data Count:(NSUInteger)1] retain]; 204 FOLLOW_K_ID_in_functionHeader175 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_ID_in_functionHeader175_data Count:(NSUInteger)1] retain]; 205 FOLLOW_formalParameter_in_functionHeader177 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_formalParameter_in_functionHeader177_data Count:(NSUInteger)1] retain]; 206 FOLLOW_ARG_DEF_in_formalParameter199 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_ARG_DEF_in_formalParameter199_data Count:(NSUInteger)1] retain]; 207 FOLLOW_type_in_formalParameter201 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_formalParameter201_data Count:(NSUInteger)1] retain]; 208 FOLLOW_declarator_in_formalParameter203 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_formalParameter203_data Count:(NSUInteger)1] retain]; 209 FOLLOW_set_in_type0 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_set_in_type0_data Count:(NSUInteger)1] retain]; 210 FOLLOW_BLOCK_in_block286 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_BLOCK_in_block286_data Count:(NSUInteger)1] retain]; 211 FOLLOW_variable_in_block288 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_variable_in_block288_data Count:(NSUInteger)1] retain]; 212 FOLLOW_stat_in_block291 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_stat_in_block291_data Count:(NSUInteger)1] retain]; 213 FOLLOW_forStat_in_stat305 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_forStat_in_stat305_data Count:(NSUInteger)1] retain]; 214 FOLLOW_expr_in_stat313 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_stat313_data Count:(NSUInteger)1] retain]; 215 FOLLOW_block_in_stat321 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_stat321_data Count:(NSUInteger)1] retain]; 216 FOLLOW_K_FOR_in_forStat341 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_FOR_in_forStat341_data Count:(NSUInteger)1] retain]; 217 FOLLOW_expr_in_forStat343 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_forStat343_data Count:(NSUInteger)1] retain]; 218 FOLLOW_expr_in_forStat345 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_forStat345_data Count:(NSUInteger)1] retain]; 219 FOLLOW_expr_in_forStat347 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_forStat347_data Count:(NSUInteger)1] retain]; 220 FOLLOW_block_in_forStat349 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_forStat349_data Count:(NSUInteger)1] retain]; 221 FOLLOW_K_EQEQ_in_expr365 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_EQEQ_in_expr365_data Count:(NSUInteger)1] retain]; 222 FOLLOW_expr_in_expr367 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_expr367_data Count:(NSUInteger)1] retain]; 223 FOLLOW_expr_in_expr369 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_expr369_data Count:(NSUInteger)1] retain]; 224 FOLLOW_K_LT_in_expr381 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_LT_in_expr381_data Count:(NSUInteger)1] retain]; 225 FOLLOW_expr_in_expr383 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_expr383_data Count:(NSUInteger)1] retain]; 226 FOLLOW_expr_in_expr385 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_expr385_data Count:(NSUInteger)1] retain]; 227 FOLLOW_K_PLUS_in_expr397 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_PLUS_in_expr397_data Count:(NSUInteger)1] retain]; 228 FOLLOW_expr_in_expr399 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_expr399_data Count:(NSUInteger)1] retain]; 229 FOLLOW_expr_in_expr401 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_expr401_data Count:(NSUInteger)1] retain]; 230 FOLLOW_K_EQ_in_expr413 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_EQ_in_expr413_data Count:(NSUInteger)1] retain]; 231 FOLLOW_K_ID_in_expr415 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_ID_in_expr415_data Count:(NSUInteger)1] retain]; 232 FOLLOW_expr_in_expr419 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_expr419_data Count:(NSUInteger)1] retain]; 233 FOLLOW_atom_in_expr432 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_atom_in_expr432_data Count:(NSUInteger)1] retain]; 234 FOLLOW_set_in_atom0 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_set_in_atom0_data Count:(NSUInteger)1] retain]; 235 236 [ANTLRBaseRecognizer setTokenNames:[[[NSArray alloc] initWithObjects:@"<invalid>", @"<EOR>", @"<DOWN>", @"<UP>", 237 @"VAR_DEF", @"ARG_DEF", @"FUNC_HDR", @"FUNC_DECL", @"FUNC_DEF", @"BLOCK", 238 @"K_ID", @"K_INT", @"K_CHAR", @"K_VOID", @"K_FOR", @"K_EQ", @"K_EQEQ", 239 @"K_LT", @"K_PLUS", @"K_INT_TYPE", @"WS", @"';'", @"'('", @"','", @"')'", 240 @"'{'", @"'}'", nil] retain]]; 241 } 242 243 + (SimpleCTP *)newSimpleCTP:(id<ANTLRTreeNodeStream>)aStream 244 { 245 246 return [[SimpleCTP alloc] initWithStream:aStream]; 247 248 } 249 250 251 - (id) initWithStream:(id<ANTLRTreeNodeStream>)aStream 252 { 253 if ((self = [super initWithStream:aStream State:[[ANTLRRecognizerSharedState newANTLRRecognizerSharedStateWithRuleLen:12+1] retain]]) != nil) { 254 255 256 257 /* start of actions-actionScope-init */ 258 /* start of init */ 259 } 260 return self; 261 } 262 263 - (void) dealloc 264 { 265 [Symbols_scope release]; 266 [super dealloc]; 267 } 268 // start actions.actionScope.methods 269 // start methods() 270 // start rules 271 /* 272 * $ANTLR start program 273 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:13:1: program : ( declaration )+ ; 274 */ 275 - (void) program 276 { 277 /* ruleScopeSetUp */ 278 279 @try { 280 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:14:5: ( ( declaration )+ ) // ruleBlockSingleAlt 281 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:14:9: ( declaration )+ // alt 282 { 283 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:14:9: ( declaration )+ // positiveClosureBlock 284 NSInteger cnt1=0; 285 do { 286 NSInteger alt1=2; 287 NSInteger LA1_0 = [input LA:1]; 288 if ( (LA1_0==VAR_DEF||(LA1_0>=FUNC_DECL && LA1_0<=FUNC_DEF)) ) { 289 alt1=1; 290 } 291 292 293 switch (alt1) { 294 case 1 : ; 295 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:14:9: declaration // alt 296 { 297 [self pushFollow:FOLLOW_declaration_in_program56]; 298 [self declaration]; 299 [self popFollow]; 300 301 /* element() */ 302 /* elements */ 303 } 304 break; 305 306 default : 307 if ( cnt1 >= 1 ) 308 goto loop1; 309 ANTLREarlyExitException *eee = [ANTLREarlyExitException exceptionWithStream:input decisionNumber:1]; 310 @throw eee; 311 } 312 cnt1++; 313 } while (YES); 314 loop1: ; 315 /* element() */ 316 /* elements */ 317 } 318 319 // token+rule list labels 320 321 } 322 @catch (ANTLRRecognitionException *re) { 323 [self reportError:re]; 324 [self recover:input Exception:re]; 325 } @finally { 326 } 327 return ; 328 } 329 /* $ANTLR end program */ 330 /* 331 * $ANTLR start declaration 332 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:17:1: declaration : ( variable | ^( FUNC_DECL functionHeader ) | ^( FUNC_DEF functionHeader block ) ); 333 */ 334 - (void) declaration 335 { 336 /* ruleScopeSetUp */ 337 338 @try { 339 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:18:5: ( variable | ^( FUNC_DECL functionHeader ) | ^( FUNC_DEF functionHeader block ) ) //ruleblock 340 NSInteger alt2=3; 341 switch ([input LA:1]) { 342 case VAR_DEF: ; 343 { 344 alt2=1; 345 } 346 break; 347 case FUNC_DECL: ; 348 { 349 alt2=2; 350 } 351 break; 352 case FUNC_DEF: ; 353 { 354 alt2=3; 355 } 356 break; 357 358 default: ; 359 ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newANTLRNoViableAltException:2 state:0 stream:input]; 360 @throw nvae; 361 } 362 363 switch (alt2) { 364 case 1 : ; 365 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:18:9: variable // alt 366 { 367 [self pushFollow:FOLLOW_variable_in_declaration76]; 368 [self variable]; 369 [self popFollow]; 370 371 /* element() */ 372 /* elements */ 373 } 374 break; 375 case 2 : ; 376 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:19:9: ^( FUNC_DECL functionHeader ) // alt 377 { 378 [self match:input TokenType:FUNC_DECL Follow:FOLLOW_FUNC_DECL_in_declaration87]; /* element() */ 379 380 [self match:input TokenType:ANTLRTokenTypeDOWN Follow:nil]; 381 [self pushFollow:FOLLOW_functionHeader_in_declaration89]; 382 [self functionHeader]; 383 [self popFollow]; 384 385 /* element() */ 386 387 [self match:input TokenType:ANTLRTokenTypeUP Follow:nil]; /* element() */ 388 /* elements */ 389 } 390 break; 391 case 3 : ; 392 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:20:9: ^( FUNC_DEF functionHeader block ) // alt 393 { 394 [self match:input TokenType:FUNC_DEF Follow:FOLLOW_FUNC_DEF_in_declaration101]; /* element() */ 395 396 [self match:input TokenType:ANTLRTokenTypeDOWN Follow:nil]; 397 [self pushFollow:FOLLOW_functionHeader_in_declaration103]; 398 [self functionHeader]; 399 [self popFollow]; 400 401 /* element() */ 402 [self pushFollow:FOLLOW_block_in_declaration105]; 403 [self block]; 404 [self popFollow]; 405 406 /* element() */ 407 408 [self match:input TokenType:ANTLRTokenTypeUP Follow:nil]; /* element() */ 409 /* elements */ 410 } 411 break; 412 413 } 414 // token+rule list labels 415 416 } 417 @catch (ANTLRRecognitionException *re) { 418 [self reportError:re]; 419 [self recover:input Exception:re]; 420 } @finally { 421 } 422 return ; 423 } 424 /* $ANTLR end declaration */ 425 /* 426 * $ANTLR start variable 427 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:23:1: variable : ^( VAR_DEF type declarator ) ; 428 */ 429 - (void) variable 430 { 431 /* ruleScopeSetUp */ 432 433 @try { 434 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:24:5: ( ^( VAR_DEF type declarator ) ) // ruleBlockSingleAlt 435 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:24:9: ^( VAR_DEF type declarator ) // alt 436 { 437 [self match:input TokenType:VAR_DEF Follow:FOLLOW_VAR_DEF_in_variable126]; /* element() */ 438 439 [self match:input TokenType:ANTLRTokenTypeDOWN Follow:nil]; 440 [self pushFollow:FOLLOW_type_in_variable128]; 441 [self type]; 442 [self popFollow]; 443 444 /* element() */ 445 [self pushFollow:FOLLOW_declarator_in_variable130]; 446 [self declarator]; 447 [self popFollow]; 448 449 /* element() */ 450 451 [self match:input TokenType:ANTLRTokenTypeUP Follow:nil]; /* element() */ 452 /* elements */ 453 } 454 455 // token+rule list labels 456 457 } 458 @catch (ANTLRRecognitionException *re) { 459 [self reportError:re]; 460 [self recover:input Exception:re]; 461 } @finally { 462 } 463 return ; 464 } 465 /* $ANTLR end variable */ 466 /* 467 * $ANTLR start declarator 468 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:27:1: declarator : K_ID ; 469 */ 470 - (void) declarator 471 { 472 /* ruleScopeSetUp */ 473 474 @try { 475 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:28:5: ( K_ID ) // ruleBlockSingleAlt 476 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:28:9: K_ID // alt 477 { 478 [self match:input TokenType:K_ID Follow:FOLLOW_K_ID_in_declarator150]; /* element() */ 479 /* elements */ 480 } 481 482 // token+rule list labels 483 484 } 485 @catch (ANTLRRecognitionException *re) { 486 [self reportError:re]; 487 [self recover:input Exception:re]; 488 } @finally { 489 } 490 return ; 491 } 492 /* $ANTLR end declarator */ 493 /* 494 * $ANTLR start functionHeader 495 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:31:1: functionHeader : ^( FUNC_HDR type K_ID ( formalParameter )+ ) ; 496 */ 497 - (void) functionHeader 498 { 499 /* ruleScopeSetUp */ 500 501 @try { 502 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:32:5: ( ^( FUNC_HDR type K_ID ( formalParameter )+ ) ) // ruleBlockSingleAlt 503 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:32:9: ^( FUNC_HDR type K_ID ( formalParameter )+ ) // alt 504 { 505 [self match:input TokenType:FUNC_HDR Follow:FOLLOW_FUNC_HDR_in_functionHeader171]; /* element() */ 506 507 [self match:input TokenType:ANTLRTokenTypeDOWN Follow:nil]; 508 [self pushFollow:FOLLOW_type_in_functionHeader173]; 509 [self type]; 510 [self popFollow]; 511 512 /* element() */ 513 [self match:input TokenType:K_ID Follow:FOLLOW_K_ID_in_functionHeader175]; /* element() */ 514 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:32:30: ( formalParameter )+ // positiveClosureBlock 515 NSInteger cnt3=0; 516 do { 517 NSInteger alt3=2; 518 NSInteger LA3_0 = [input LA:1]; 519 if ( (LA3_0==ARG_DEF) ) { 520 alt3=1; 521 } 522 523 524 switch (alt3) { 525 case 1 : ; 526 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:32:30: formalParameter // alt 527 { 528 [self pushFollow:FOLLOW_formalParameter_in_functionHeader177]; 529 [self formalParameter]; 530 [self popFollow]; 531 532 /* element() */ 533 /* elements */ 534 } 535 break; 536 537 default : 538 if ( cnt3 >= 1 ) 539 goto loop3; 540 ANTLREarlyExitException *eee = [ANTLREarlyExitException exceptionWithStream:input decisionNumber:3]; 541 @throw eee; 542 } 543 cnt3++; 544 } while (YES); 545 loop3: ; 546 /* element() */ 547 548 [self match:input TokenType:ANTLRTokenTypeUP Follow:nil]; /* element() */ 549 /* elements */ 550 } 551 552 // token+rule list labels 553 554 } 555 @catch (ANTLRRecognitionException *re) { 556 [self reportError:re]; 557 [self recover:input Exception:re]; 558 } @finally { 559 } 560 return ; 561 } 562 /* $ANTLR end functionHeader */ 563 /* 564 * $ANTLR start formalParameter 565 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:35:1: formalParameter : ^( ARG_DEF type declarator ) ; 566 */ 567 - (void) formalParameter 568 { 569 /* ruleScopeSetUp */ 570 571 @try { 572 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:36:5: ( ^( ARG_DEF type declarator ) ) // ruleBlockSingleAlt 573 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:36:9: ^( ARG_DEF type declarator ) // alt 574 { 575 [self match:input TokenType:ARG_DEF Follow:FOLLOW_ARG_DEF_in_formalParameter199]; /* element() */ 576 577 [self match:input TokenType:ANTLRTokenTypeDOWN Follow:nil]; 578 [self pushFollow:FOLLOW_type_in_formalParameter201]; 579 [self type]; 580 [self popFollow]; 581 582 /* element() */ 583 [self pushFollow:FOLLOW_declarator_in_formalParameter203]; 584 [self declarator]; 585 [self popFollow]; 586 587 /* element() */ 588 589 [self match:input TokenType:ANTLRTokenTypeUP Follow:nil]; /* element() */ 590 /* elements */ 591 } 592 593 // token+rule list labels 594 595 } 596 @catch (ANTLRRecognitionException *re) { 597 [self reportError:re]; 598 [self recover:input Exception:re]; 599 } @finally { 600 } 601 return ; 602 } 603 /* $ANTLR end formalParameter */ 604 /* 605 * $ANTLR start type 606 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:39:1: type : ( K_INT | K_CHAR | K_VOID | K_ID ); 607 */ 608 - (void) type 609 { 610 /* ruleScopeSetUp */ 611 612 @try { 613 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:40:5: ( K_INT | K_CHAR | K_VOID | K_ID ) // ruleBlockSingleAlt 614 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g: // alt 615 { 616 if ((([input LA:1] >= K_ID) && ([input LA:1] <= K_VOID))) { 617 [input consume]; 618 [state setIsErrorRecovery:NO]; 619 } else { 620 ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException exceptionWithSet:nil stream:input]; 621 @throw mse; 622 } 623 /* element() */ 624 /* elements */ 625 } 626 627 // token+rule list labels 628 629 } 630 @catch (ANTLRRecognitionException *re) { 631 [self reportError:re]; 632 [self recover:input Exception:re]; 633 } @finally { 634 } 635 return ; 636 } 637 /* $ANTLR end type */ 638 /* 639 * $ANTLR start block 640 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:46:1: block : ^( BLOCK ( variable )* ( stat )* ) ; 641 */ 642 - (void) block 643 { 644 /* ruleScopeSetUp */ 645 646 @try { 647 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:47:5: ( ^( BLOCK ( variable )* ( stat )* ) ) // ruleBlockSingleAlt 648 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:47:9: ^( BLOCK ( variable )* ( stat )* ) // alt 649 { 650 [self match:input TokenType:BLOCK Follow:FOLLOW_BLOCK_in_block286]; /* element() */ 651 652 if ( [input LA:1] == ANTLRTokenTypeDOWN ) { 653 [self match:input TokenType:ANTLRTokenTypeDOWN Follow:nil]; 654 do { 655 NSInteger alt4=2; 656 NSInteger LA4_0 = [input LA:1]; 657 if ( (LA4_0==VAR_DEF) ) { 658 alt4=1; 659 } 660 661 662 switch (alt4) { 663 case 1 : ; 664 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:47:17: variable // alt 665 { 666 [self pushFollow:FOLLOW_variable_in_block288]; 667 [self variable]; 668 [self popFollow]; 669 670 /* element() */ 671 /* elements */ 672 } 673 break; 674 675 default : 676 goto loop4; 677 } 678 } while (YES); 679 loop4: ; 680 /* element() */ 681 do { 682 NSInteger alt5=2; 683 NSInteger LA5_0 = [input LA:1]; 684 if ( ((LA5_0>=BLOCK && LA5_0<=K_INT)||(LA5_0>=K_FOR && LA5_0<=K_PLUS)) ) { 685 alt5=1; 686 } 687 688 689 switch (alt5) { 690 case 1 : ; 691 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:47:27: stat // alt 692 { 693 [self pushFollow:FOLLOW_stat_in_block291]; 694 [self stat]; 695 [self popFollow]; 696 697 /* element() */ 698 /* elements */ 699 } 700 break; 701 702 default : 703 goto loop5; 704 } 705 } while (YES); 706 loop5: ; 707 /* element() */ 708 709 [self match:input TokenType:ANTLRTokenTypeUP Follow:nil]; 710 } /* element() */ 711 /* elements */ 712 } 713 714 // token+rule list labels 715 716 } 717 @catch (ANTLRRecognitionException *re) { 718 [self reportError:re]; 719 [self recover:input Exception:re]; 720 } @finally { 721 } 722 return ; 723 } 724 /* $ANTLR end block */ 725 /* 726 * $ANTLR start stat 727 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:50:1: stat : ( forStat | expr | block ); 728 */ 729 - (void) stat 730 { 731 /* ruleScopeSetUp */ 732 733 @try { 734 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:50:5: ( forStat | expr | block ) //ruleblock 735 NSInteger alt6=3; 736 switch ([input LA:1]) { 737 case K_FOR: ; 738 { 739 alt6=1; 740 } 741 break; 742 case K_ID: ; 743 case K_INT: ; 744 case K_EQ: ; 745 case K_EQEQ: ; 746 case K_LT: ; 747 case K_PLUS: ; 748 { 749 alt6=2; 750 } 751 break; 752 case BLOCK: ; 753 { 754 alt6=3; 755 } 756 break; 757 758 default: ; 759 ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newANTLRNoViableAltException:6 state:0 stream:input]; 760 @throw nvae; 761 } 762 763 switch (alt6) { 764 case 1 : ; 765 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:50:7: forStat // alt 766 { 767 [self pushFollow:FOLLOW_forStat_in_stat305]; 768 [self forStat]; 769 [self popFollow]; 770 771 /* element() */ 772 /* elements */ 773 } 774 break; 775 case 2 : ; 776 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:51:7: expr // alt 777 { 778 [self pushFollow:FOLLOW_expr_in_stat313]; 779 [self expr]; 780 [self popFollow]; 781 782 /* element() */ 783 /* elements */ 784 } 785 break; 786 case 3 : ; 787 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:52:7: block // alt 788 { 789 [self pushFollow:FOLLOW_block_in_stat321]; 790 [self block]; 791 [self popFollow]; 792 793 /* element() */ 794 /* elements */ 795 } 796 break; 797 798 } 799 // token+rule list labels 800 801 } 802 @catch (ANTLRRecognitionException *re) { 803 [self reportError:re]; 804 [self recover:input Exception:re]; 805 } @finally { 806 } 807 return ; 808 } 809 /* $ANTLR end stat */ 810 /* 811 * $ANTLR start forStat 812 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:55:1: forStat : ^( K_FOR expr expr expr block ) ; 813 */ 814 - (void) forStat 815 { 816 /* ruleScopeSetUp */ 817 818 @try { 819 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:56:5: ( ^( K_FOR expr expr expr block ) ) // ruleBlockSingleAlt 820 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:56:9: ^( K_FOR expr expr expr block ) // alt 821 { 822 [self match:input TokenType:K_FOR Follow:FOLLOW_K_FOR_in_forStat341]; /* element() */ 823 824 [self match:input TokenType:ANTLRTokenTypeDOWN Follow:nil]; 825 [self pushFollow:FOLLOW_expr_in_forStat343]; 826 [self expr]; 827 [self popFollow]; 828 829 /* element() */ 830 [self pushFollow:FOLLOW_expr_in_forStat345]; 831 [self expr]; 832 [self popFollow]; 833 834 /* element() */ 835 [self pushFollow:FOLLOW_expr_in_forStat347]; 836 [self expr]; 837 [self popFollow]; 838 839 /* element() */ 840 [self pushFollow:FOLLOW_block_in_forStat349]; 841 [self block]; 842 [self popFollow]; 843 844 /* element() */ 845 846 [self match:input TokenType:ANTLRTokenTypeUP Follow:nil]; /* element() */ 847 /* elements */ 848 } 849 850 // token+rule list labels 851 852 } 853 @catch (ANTLRRecognitionException *re) { 854 [self reportError:re]; 855 [self recover:input Exception:re]; 856 } @finally { 857 } 858 return ; 859 } 860 /* $ANTLR end forStat */ 861 /* 862 * $ANTLR start expr 863 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:59:1: expr : ( ^( K_EQEQ expr expr ) | ^( K_LT expr expr ) | ^( K_PLUS expr expr ) | ^( K_EQ K_ID e= expr ) | atom ); 864 */ 865 - (SimpleCTP_expr_return *) expr 866 { 867 /* ruleScopeSetUp */ 868 869 SimpleCTP_expr_return * retval = [SimpleCTP_expr_return newSimpleCTP_expr_return]; 870 [retval setStart:[input LT:1]]; 871 872 @try { 873 ANTLRCommonTree *K_ID1 = nil; 874 SimpleCTP_expr_return * e = nil; 875 876 877 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:59:5: ( ^( K_EQEQ expr expr ) | ^( K_LT expr expr ) | ^( K_PLUS expr expr ) | ^( K_EQ K_ID e= expr ) | atom ) //ruleblock 878 NSInteger alt7=5; 879 switch ([input LA:1]) { 880 case K_EQEQ: ; 881 { 882 alt7=1; 883 } 884 break; 885 case K_LT: ; 886 { 887 alt7=2; 888 } 889 break; 890 case K_PLUS: ; 891 { 892 alt7=3; 893 } 894 break; 895 case K_EQ: ; 896 { 897 alt7=4; 898 } 899 break; 900 case K_ID: ; 901 case K_INT: ; 902 { 903 alt7=5; 904 } 905 break; 906 907 default: ; 908 ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newANTLRNoViableAltException:7 state:0 stream:input]; 909 @throw nvae; 910 } 911 912 switch (alt7) { 913 case 1 : ; 914 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:59:9: ^( K_EQEQ expr expr ) // alt 915 { 916 [self match:input TokenType:K_EQEQ Follow:FOLLOW_K_EQEQ_in_expr365]; /* element() */ 917 918 [self match:input TokenType:ANTLRTokenTypeDOWN Follow:nil]; 919 [self pushFollow:FOLLOW_expr_in_expr367]; 920 [self expr]; 921 [self popFollow]; 922 923 /* element() */ 924 [self pushFollow:FOLLOW_expr_in_expr369]; 925 [self expr]; 926 [self popFollow]; 927 928 /* element() */ 929 930 [self match:input TokenType:ANTLRTokenTypeUP Follow:nil]; /* element() */ 931 /* elements */ 932 } 933 break; 934 case 2 : ; 935 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:60:9: ^( K_LT expr expr ) // alt 936 { 937 [self match:input TokenType:K_LT Follow:FOLLOW_K_LT_in_expr381]; /* element() */ 938 939 [self match:input TokenType:ANTLRTokenTypeDOWN Follow:nil]; 940 [self pushFollow:FOLLOW_expr_in_expr383]; 941 [self expr]; 942 [self popFollow]; 943 944 /* element() */ 945 [self pushFollow:FOLLOW_expr_in_expr385]; 946 [self expr]; 947 [self popFollow]; 948 949 /* element() */ 950 951 [self match:input TokenType:ANTLRTokenTypeUP Follow:nil]; /* element() */ 952 /* elements */ 953 } 954 break; 955 case 3 : ; 956 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:61:9: ^( K_PLUS expr expr ) // alt 957 { 958 [self match:input TokenType:K_PLUS Follow:FOLLOW_K_PLUS_in_expr397]; /* element() */ 959 960 [self match:input TokenType:ANTLRTokenTypeDOWN Follow:nil]; 961 [self pushFollow:FOLLOW_expr_in_expr399]; 962 [self expr]; 963 [self popFollow]; 964 965 /* element() */ 966 [self pushFollow:FOLLOW_expr_in_expr401]; 967 [self expr]; 968 [self popFollow]; 969 970 /* element() */ 971 972 [self match:input TokenType:ANTLRTokenTypeUP Follow:nil]; /* element() */ 973 /* elements */ 974 } 975 break; 976 case 4 : ; 977 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:62:9: ^( K_EQ K_ID e= expr ) // alt 978 { 979 [self match:input TokenType:K_EQ Follow:FOLLOW_K_EQ_in_expr413]; /* element() */ 980 981 [self match:input TokenType:ANTLRTokenTypeDOWN Follow:nil]; 982 K_ID1=(ANTLRCommonTree *)[self match:input TokenType:K_ID Follow:FOLLOW_K_ID_in_expr415]; /* element() */ 983 [self pushFollow:FOLLOW_expr_in_expr419]; 984 e = [self expr]; 985 [self popFollow]; 986 987 /* element() */ 988 989 [self match:input TokenType:ANTLRTokenTypeUP Follow:nil]; /* element() */ 990 NSLog(@"assigning %@ to variable %@", (e!=nil?[[input getTokenStream] toStringFromStart:[[input getTreeAdaptor] getTokenStartIndex:[e getStart]] 991 ToEnd:[[input getTreeAdaptor] getTokenStopIndex:[e getStart]]]:nil), (K_ID1!=nil?[K_ID1 getText]:0)); /* element() */ 992 /* elements */ 993 } 994 break; 995 case 5 : ; 996 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:63:9: atom // alt 997 { 998 [self pushFollow:FOLLOW_atom_in_expr432]; 999 [self atom]; 1000 [self popFollow]; 1001 1002 /* element() */ 1003 /* elements */ 1004 } 1005 break; 1006 1007 } 1008 // token+rule list labels 1009 1010 } 1011 @catch (ANTLRRecognitionException *re) { 1012 [self reportError:re]; 1013 [self recover:input Exception:re]; 1014 } @finally { 1015 } 1016 return retval; 1017 } 1018 /* $ANTLR end expr */ 1019 /* 1020 * $ANTLR start atom 1021 * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:66:1: atom : ( K_ID | K_INT ); 1022 */ 1023 - (void) atom 1024 { 1025 /* ruleScopeSetUp */ 1026 1027 @try { 1028 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:67:5: ( K_ID | K_INT ) // ruleBlockSingleAlt 1029 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g: // alt 1030 { 1031 if ((([input LA:1] >= K_ID) && ([input LA:1] <= K_INT))) { 1032 [input consume]; 1033 [state setIsErrorRecovery:NO]; 1034 } else { 1035 ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException exceptionWithSet:nil stream:input]; 1036 @throw mse; 1037 } 1038 /* element() */ 1039 /* elements */ 1040 } 1041 1042 // token+rule list labels 1043 1044 } 1045 @catch (ANTLRRecognitionException *re) { 1046 [self reportError:re]; 1047 [self recover:input Exception:re]; 1048 } @finally { 1049 } 1050 return ; 1051 } 1052 /* $ANTLR end atom */ 1053 1054 @end /* end of SimpleCTP implementation line 669 */ 1055 1056 1057 /* End of code 1058 * ============================================================================= 1059 */ 1060