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/simplecTreeParser/SimpleCTP.g 5 * - On : 2012-02-16 17:41:10 6 * - for the tree parser : SimpleCTPTreeParser 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/simplecTreeParser/SimpleCTP.g 2012-02-16 17:41:10 15 16 17/* ----------------------------------------- 18 * Include the ANTLR3 generated header file. 19 */ 20#import "SimpleCTP.h" 21/* ----------------------------------------- */ 22 23 24/* ============================================================================= */ 25/* ============================================================================= 26 * Start of recognizer 27 */ 28 29#pragma mark Bitsets 30static ANTLRBitSet *FOLLOW_declaration_in_program56; 31static const unsigned long long FOLLOW_declaration_in_program56_data[] = { 0x00000000020000C2LL}; 32static ANTLRBitSet *FOLLOW_variable_in_declaration76; 33static const unsigned long long FOLLOW_variable_in_declaration76_data[] = { 0x0000000000000002LL}; 34static ANTLRBitSet *FOLLOW_FUNC_DECL_in_declaration87; 35static const unsigned long long FOLLOW_FUNC_DECL_in_declaration87_data[] = { 0x0000000000000004LL}; 36static ANTLRBitSet *FOLLOW_functionHeader_in_declaration89; 37static const unsigned long long FOLLOW_functionHeader_in_declaration89_data[] = { 0x0000000000000008LL}; 38static ANTLRBitSet *FOLLOW_FUNC_DEF_in_declaration101; 39static const unsigned long long FOLLOW_FUNC_DEF_in_declaration101_data[] = { 0x0000000000000004LL}; 40static ANTLRBitSet *FOLLOW_functionHeader_in_declaration103; 41static const unsigned long long FOLLOW_functionHeader_in_declaration103_data[] = { 0x0000000000000020LL}; 42static ANTLRBitSet *FOLLOW_block_in_declaration105; 43static const unsigned long long FOLLOW_block_in_declaration105_data[] = { 0x0000000000000008LL}; 44static ANTLRBitSet *FOLLOW_VAR_DEF_in_variable126; 45static const unsigned long long FOLLOW_VAR_DEF_in_variable126_data[] = { 0x0000000000000004LL}; 46static ANTLRBitSet *FOLLOW_type_in_variable128; 47static const unsigned long long FOLLOW_type_in_variable128_data[] = { 0x0000000000004000LL}; 48static ANTLRBitSet *FOLLOW_declarator_in_variable130; 49static const unsigned long long FOLLOW_declarator_in_variable130_data[] = { 0x0000000000000008LL}; 50static ANTLRBitSet *FOLLOW_K_ID_in_declarator150; 51static const unsigned long long FOLLOW_K_ID_in_declarator150_data[] = { 0x0000000000000002LL}; 52static ANTLRBitSet *FOLLOW_FUNC_HDR_in_functionHeader171; 53static const unsigned long long FOLLOW_FUNC_HDR_in_functionHeader171_data[] = { 0x0000000000000004LL}; 54static ANTLRBitSet *FOLLOW_type_in_functionHeader173; 55static const unsigned long long FOLLOW_type_in_functionHeader173_data[] = { 0x0000000000004000LL}; 56static ANTLRBitSet *FOLLOW_K_ID_in_functionHeader175; 57static const unsigned long long FOLLOW_K_ID_in_functionHeader175_data[] = { 0x0000000000000010LL}; 58static ANTLRBitSet *FOLLOW_formalParameter_in_functionHeader177; 59static const unsigned long long FOLLOW_formalParameter_in_functionHeader177_data[] = { 0x0000000000000018LL}; 60static ANTLRBitSet *FOLLOW_ARG_DEF_in_formalParameter199; 61static const unsigned long long FOLLOW_ARG_DEF_in_formalParameter199_data[] = { 0x0000000000000004LL}; 62static ANTLRBitSet *FOLLOW_type_in_formalParameter201; 63static const unsigned long long FOLLOW_type_in_formalParameter201_data[] = { 0x0000000000004000LL}; 64static ANTLRBitSet *FOLLOW_declarator_in_formalParameter203; 65static const unsigned long long FOLLOW_declarator_in_formalParameter203_data[] = { 0x0000000000000008LL}; 66static ANTLRBitSet *FOLLOW_BLOCK_in_block283; 67static const unsigned long long FOLLOW_BLOCK_in_block283_data[] = { 0x0000000000000004LL}; 68static ANTLRBitSet *FOLLOW_variable_in_block285; 69static const unsigned long long FOLLOW_variable_in_block285_data[] = { 0x000000000218F828LL}; 70static ANTLRBitSet *FOLLOW_stat_in_block288; 71static const unsigned long long FOLLOW_stat_in_block288_data[] = { 0x000000000018F828LL}; 72static ANTLRBitSet *FOLLOW_forStat_in_stat302; 73static const unsigned long long FOLLOW_forStat_in_stat302_data[] = { 0x0000000000000002LL}; 74static ANTLRBitSet *FOLLOW_expr_in_stat310; 75static const unsigned long long FOLLOW_expr_in_stat310_data[] = { 0x0000000000000002LL}; 76static ANTLRBitSet *FOLLOW_block_in_stat318; 77static const unsigned long long FOLLOW_block_in_stat318_data[] = { 0x0000000000000002LL}; 78static ANTLRBitSet *FOLLOW_K_FOR_in_forStat338; 79static const unsigned long long FOLLOW_K_FOR_in_forStat338_data[] = { 0x0000000000000004LL}; 80static ANTLRBitSet *FOLLOW_expr_in_forStat340; 81static const unsigned long long FOLLOW_expr_in_forStat340_data[] = { 0x000000000018D800LL}; 82static ANTLRBitSet *FOLLOW_expr_in_forStat342; 83static const unsigned long long FOLLOW_expr_in_forStat342_data[] = { 0x000000000018D800LL}; 84static ANTLRBitSet *FOLLOW_expr_in_forStat344; 85static const unsigned long long FOLLOW_expr_in_forStat344_data[] = { 0x0000000000000020LL}; 86static ANTLRBitSet *FOLLOW_block_in_forStat346; 87static const unsigned long long FOLLOW_block_in_forStat346_data[] = { 0x0000000000000008LL}; 88static ANTLRBitSet *FOLLOW_K_EQEQ_in_expr362; 89static const unsigned long long FOLLOW_K_EQEQ_in_expr362_data[] = { 0x0000000000000004LL}; 90static ANTLRBitSet *FOLLOW_expr_in_expr364; 91static const unsigned long long FOLLOW_expr_in_expr364_data[] = { 0x000000000018D800LL}; 92static ANTLRBitSet *FOLLOW_expr_in_expr366; 93static const unsigned long long FOLLOW_expr_in_expr366_data[] = { 0x0000000000000008LL}; 94static ANTLRBitSet *FOLLOW_K_LT_in_expr378; 95static const unsigned long long FOLLOW_K_LT_in_expr378_data[] = { 0x0000000000000004LL}; 96static ANTLRBitSet *FOLLOW_expr_in_expr380; 97static const unsigned long long FOLLOW_expr_in_expr380_data[] = { 0x000000000018D800LL}; 98static ANTLRBitSet *FOLLOW_expr_in_expr382; 99static const unsigned long long FOLLOW_expr_in_expr382_data[] = { 0x0000000000000008LL}; 100static ANTLRBitSet *FOLLOW_K_PLUS_in_expr394; 101static const unsigned long long FOLLOW_K_PLUS_in_expr394_data[] = { 0x0000000000000004LL}; 102static ANTLRBitSet *FOLLOW_expr_in_expr396; 103static const unsigned long long FOLLOW_expr_in_expr396_data[] = { 0x000000000018D800LL}; 104static ANTLRBitSet *FOLLOW_expr_in_expr398; 105static const unsigned long long FOLLOW_expr_in_expr398_data[] = { 0x0000000000000008LL}; 106static ANTLRBitSet *FOLLOW_K_EQ_in_expr410; 107static const unsigned long long FOLLOW_K_EQ_in_expr410_data[] = { 0x0000000000000004LL}; 108static ANTLRBitSet *FOLLOW_K_ID_in_expr412; 109static const unsigned long long FOLLOW_K_ID_in_expr412_data[] = { 0x000000000018D800LL}; 110static ANTLRBitSet *FOLLOW_expr_in_expr416; 111static const unsigned long long FOLLOW_expr_in_expr416_data[] = { 0x0000000000000008LL}; 112static ANTLRBitSet *FOLLOW_atom_in_expr429; 113static const unsigned long long FOLLOW_atom_in_expr429_data[] = { 0x0000000000000002LL}; 114 115 116#pragma mark Dynamic Global globalAttributeScopeImplementation 117@implementation Symbols_Scope /* globalAttributeScopeImplementation */ 118/* start of synthesize -- OBJC-Line 1750 */ 119@synthesize tree; 120 121+ (Symbols_Scope *)newSymbols_Scope 122{ 123return [[Symbols_Scope alloc] init]; 124} 125 126- (id) init 127{ 128self = [super init]; 129return self; 130} 131 132/* start of iterate get and set functions */ 133- (ANTLRCommonTree *)gettree { return( tree ); } 134- (void)settree:(ANTLRCommonTree *)aVal { tree = aVal; } 135 136/* End of iterate get and set functions */ 137@end /* end of Symbols_Scope implementation */ 138 139 140 141#pragma mark Dynamic Rule Scopes ruleAttributeScopeImplementation 142 143#pragma mark Rule Return Scopes returnScopeImplementation 144@implementation SimpleCTP_expr_return /* returnScopeImplementation */ 145 /* start of synthesize -- OBJC-Line 1837 */ 146+ (SimpleCTP_expr_return *)newSimpleCTP_expr_return 147{ 148return [[[SimpleCTP_expr_return alloc] init] retain]; 149} 150 151- (id) init 152{ 153self = [super init]; 154return self; 155} 156 157 158 159@end /* end of returnScope implementation */ 160 161 162 163@implementation SimpleCTP // line 637 164 165/* ObjC start of ruleAttributeScope */ 166#pragma mark Dynamic Rule Scopes ruleAttributeScope 167/* ObjC end of ruleAttributeScope */ 168#pragma mark global Attribute Scopes globalAttributeScope 169/* ObjC start globalAttributeScope */ 170static _stack; 171 172/* ObjC end globalAttributeScope */ 173/* ObjC start actions.(actionScope).synthesize */ 174/* ObjC start synthesize() */ 175 176+ (void) initialize 177{ 178 #pragma mark Bitsets 179 FOLLOW_declaration_in_program56 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_declaration_in_program56_data Count:(NSUInteger)1] retain]; 180 FOLLOW_variable_in_declaration76 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_variable_in_declaration76_data Count:(NSUInteger)1] retain]; 181 FOLLOW_FUNC_DECL_in_declaration87 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_FUNC_DECL_in_declaration87_data Count:(NSUInteger)1] retain]; 182 FOLLOW_functionHeader_in_declaration89 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_functionHeader_in_declaration89_data Count:(NSUInteger)1] retain]; 183 FOLLOW_FUNC_DEF_in_declaration101 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_FUNC_DEF_in_declaration101_data Count:(NSUInteger)1] retain]; 184 FOLLOW_functionHeader_in_declaration103 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_functionHeader_in_declaration103_data Count:(NSUInteger)1] retain]; 185 FOLLOW_block_in_declaration105 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_declaration105_data Count:(NSUInteger)1] retain]; 186 FOLLOW_VAR_DEF_in_variable126 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_VAR_DEF_in_variable126_data Count:(NSUInteger)1] retain]; 187 FOLLOW_type_in_variable128 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_variable128_data Count:(NSUInteger)1] retain]; 188 FOLLOW_declarator_in_variable130 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_variable130_data Count:(NSUInteger)1] retain]; 189 FOLLOW_K_ID_in_declarator150 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_K_ID_in_declarator150_data Count:(NSUInteger)1] retain]; 190 FOLLOW_FUNC_HDR_in_functionHeader171 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_FUNC_HDR_in_functionHeader171_data Count:(NSUInteger)1] retain]; 191 FOLLOW_type_in_functionHeader173 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_functionHeader173_data Count:(NSUInteger)1] retain]; 192 FOLLOW_K_ID_in_functionHeader175 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_K_ID_in_functionHeader175_data Count:(NSUInteger)1] retain]; 193 FOLLOW_formalParameter_in_functionHeader177 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_formalParameter_in_functionHeader177_data Count:(NSUInteger)1] retain]; 194 FOLLOW_ARG_DEF_in_formalParameter199 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_ARG_DEF_in_formalParameter199_data Count:(NSUInteger)1] retain]; 195 FOLLOW_type_in_formalParameter201 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_formalParameter201_data Count:(NSUInteger)1] retain]; 196 FOLLOW_declarator_in_formalParameter203 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_formalParameter203_data Count:(NSUInteger)1] retain]; 197 FOLLOW_BLOCK_in_block283 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_BLOCK_in_block283_data Count:(NSUInteger)1] retain]; 198 FOLLOW_variable_in_block285 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_variable_in_block285_data Count:(NSUInteger)1] retain]; 199 FOLLOW_stat_in_block288 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_stat_in_block288_data Count:(NSUInteger)1] retain]; 200 FOLLOW_forStat_in_stat302 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_forStat_in_stat302_data Count:(NSUInteger)1] retain]; 201 FOLLOW_expr_in_stat310 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_stat310_data Count:(NSUInteger)1] retain]; 202 FOLLOW_block_in_stat318 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_stat318_data Count:(NSUInteger)1] retain]; 203 FOLLOW_K_FOR_in_forStat338 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_K_FOR_in_forStat338_data Count:(NSUInteger)1] retain]; 204 FOLLOW_expr_in_forStat340 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_forStat340_data Count:(NSUInteger)1] retain]; 205 FOLLOW_expr_in_forStat342 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_forStat342_data Count:(NSUInteger)1] retain]; 206 FOLLOW_expr_in_forStat344 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_forStat344_data Count:(NSUInteger)1] retain]; 207 FOLLOW_block_in_forStat346 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_forStat346_data Count:(NSUInteger)1] retain]; 208 FOLLOW_K_EQEQ_in_expr362 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_K_EQEQ_in_expr362_data Count:(NSUInteger)1] retain]; 209 FOLLOW_expr_in_expr364 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_expr364_data Count:(NSUInteger)1] retain]; 210 FOLLOW_expr_in_expr366 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_expr366_data Count:(NSUInteger)1] retain]; 211 FOLLOW_K_LT_in_expr378 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_K_LT_in_expr378_data Count:(NSUInteger)1] retain]; 212 FOLLOW_expr_in_expr380 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_expr380_data Count:(NSUInteger)1] retain]; 213 FOLLOW_expr_in_expr382 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_expr382_data Count:(NSUInteger)1] retain]; 214 FOLLOW_K_PLUS_in_expr394 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_K_PLUS_in_expr394_data Count:(NSUInteger)1] retain]; 215 FOLLOW_expr_in_expr396 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_expr396_data Count:(NSUInteger)1] retain]; 216 FOLLOW_expr_in_expr398 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_expr398_data Count:(NSUInteger)1] retain]; 217 FOLLOW_K_EQ_in_expr410 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_K_EQ_in_expr410_data Count:(NSUInteger)1] retain]; 218 FOLLOW_K_ID_in_expr412 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_K_ID_in_expr412_data Count:(NSUInteger)1] retain]; 219 FOLLOW_expr_in_expr416 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_expr416_data Count:(NSUInteger)1] retain]; 220 FOLLOW_atom_in_expr429 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_atom_in_expr429_data Count:(NSUInteger)1] retain]; 221 222 [BaseRecognizer setTokenNames:[[AMutableArray arrayWithObjects:@"<invalid>", @"<EOR>", @"<DOWN>", @"<UP>", 223 @"ARG_DEF", @"BLOCK", @"FUNC_DECL", @"FUNC_DEF", @"FUNC_HDR", @"K_CHAR", 224 @"K_COMMA", @"K_EQ", @"K_EQEQ", @"K_FOR", @"K_ID", @"K_INT", @"K_INT_TYPE", 225 @"K_LCURLY", @"K_LCURVE", @"K_LT", @"K_PLUS", @"K_RCURLY", @"K_RCURVE", 226 @"K_SEMICOLON", @"K_VOID", @"VAR_DEF", @"WS", nil] retain]]; 227 [BaseRecognizer setGrammarFileName:@"/Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g"]; 228} 229 230+ (SimpleCTP *)newSimpleCTP:(id<TreeNodeStream>)aStream 231{ 232 return [[SimpleCTP alloc] initWithStream:aStream]; 233} 234 235- (id) initWithStream:(id<TreeNodeStream>)aStream 236{ 237 self = [super initWithStream:aStream State:[[RecognizerSharedState newRecognizerSharedStateWithRuleLen:12+1] retain]]; 238 if ( self != nil ) { 239 /* globalAttributeScopeInit */ 240 241 Symbols_scope = [Symbols_Scope newSymbols_Scope]; 242 243 Symbols_stack = [SymbolStack newSymbolStackWithLen:30]; 244 245 /* start of actions-actionScope-init */ 246 /* start of init */ 247 } 248 return self; 249} 250 251- (void) dealloc 252{ 253 [Symbols_stack release]; 254 255 [super dealloc]; 256} 257 258/* ObjC start actions.(actionScope).methods */ 259/* ObjC end actions.(actionScope).methods */ 260/* ObjC start methods() */ 261/* ObjC end methods() */ 262/* ObjC start rules */ 263/* 264 * $ANTLR start program 265 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:13:1: program : ( declaration )+ ; 266 */ 267- (void) program 268{ 269 /* ruleScopeSetUp */ 270 271 /* ruleDeclarations */ 272 273 @try { 274 /* ruleLabelDefs entry */ 275 276 277 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:14:5: ( ( declaration )+ ) // ruleBlockSingleAlt 278 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:14:9: ( declaration )+ // alt 279 { 280 281 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:14:9: ( declaration )+ // positiveClosureBlock 282 NSInteger cnt1 = 0; 283 do { 284 NSInteger alt1 = 2; 285 NSInteger LA1_0 = [input LA:1]; 286 if ( ((LA1_0 >= FUNC_DECL && LA1_0 <= FUNC_DEF)||LA1_0==VAR_DEF) ) { 287 alt1=1; 288 } 289 290 291 switch (alt1) { 292 case 1 : ; 293 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:14:9: declaration // alt 294 { 295 296 /* ruleRef */ 297 [self pushFollow:FOLLOW_declaration_in_program56]; 298 [self declaration]; 299 300 [self popFollow]; 301 302 303 304 } 305 break; 306 307 default : 308 if ( cnt1 >= 1 ) 309 goto loop1; 310 EarlyExitException *eee = 311 [EarlyExitException newException:input decisionNumber:1]; 312 @throw eee; 313 } 314 cnt1++; 315 } while (YES); 316 loop1: ; 317 318 319 } 320 321 /* token+rule list labels */ 322 323 } 324 @catch (RecognitionException *re) { 325 [self reportError:re]; 326 [self recover:input Exception:re]; 327 } 328 329 @finally { 330 /* ruleScopeCleanUp */ 331 332 } 333 return ; 334} 335/* $ANTLR end program */ 336 337/* 338 * $ANTLR start declaration 339 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:17:1: declaration : ( variable | ^( FUNC_DECL functionHeader ) | ^( FUNC_DEF functionHeader block ) ); 340 */ 341- (void) declaration 342{ 343 /* ruleScopeSetUp */ 344 345 /* ruleDeclarations */ 346 347 @try { 348 /* ruleLabelDefs entry */ 349 350 351 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:18:5: ( variable | ^( FUNC_DECL functionHeader ) | ^( FUNC_DEF functionHeader block ) ) //ruleblock 352 NSInteger alt2=3; 353 unichar charLA2 = [input LA:1]; 354 switch (charLA2) { 355 case VAR_DEF: ; 356 { 357 alt2=1; 358 } 359 break; 360 case FUNC_DECL: ; 361 { 362 alt2=2; 363 } 364 break; 365 case FUNC_DEF: ; 366 { 367 alt2=3; 368 } 369 break; 370 371 default: ; 372 NoViableAltException *nvae = [NoViableAltException newException:2 state:0 stream:input]; 373 nvae.c = charLA2; 374 @throw nvae; 375 376 } 377 378 switch (alt2) { 379 case 1 : ; 380 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:18:9: variable // alt 381 { 382 383 /* ruleRef */ 384 [self pushFollow:FOLLOW_variable_in_declaration76]; 385 [self variable]; 386 387 [self popFollow]; 388 389 390 391 } 392 break; 393 case 2 : ; 394 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:19:9: ^( FUNC_DECL functionHeader ) // alt 395 { 396 397 398 [self match:input TokenType:FUNC_DECL Follow:FOLLOW_FUNC_DECL_in_declaration87]; 399 400 [self match:input TokenType:DOWN Follow:nil]; 401 402 /* ruleRef */ 403 [self pushFollow:FOLLOW_functionHeader_in_declaration89]; 404 [self functionHeader]; 405 406 [self popFollow]; 407 408 409 410 [self match:input TokenType:UP Follow:nil]; 411 412 413 } 414 break; 415 case 3 : ; 416 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:20:9: ^( FUNC_DEF functionHeader block ) // alt 417 { 418 419 420 [self match:input TokenType:FUNC_DEF Follow:FOLLOW_FUNC_DEF_in_declaration101]; 421 422 [self match:input TokenType:DOWN Follow:nil]; 423 424 /* ruleRef */ 425 [self pushFollow:FOLLOW_functionHeader_in_declaration103]; 426 [self functionHeader]; 427 428 [self popFollow]; 429 430 431 432 /* ruleRef */ 433 [self pushFollow:FOLLOW_block_in_declaration105]; 434 [self block]; 435 436 [self popFollow]; 437 438 439 440 [self match:input TokenType:UP Follow:nil]; 441 442 443 } 444 break; 445 446 } 447 /* token+rule list labels */ 448 449 } 450 @catch (RecognitionException *re) { 451 [self reportError:re]; 452 [self recover:input Exception:re]; 453 } 454 455 @finally { 456 /* ruleScopeCleanUp */ 457 458 } 459 return ; 460} 461/* $ANTLR end declaration */ 462 463/* 464 * $ANTLR start variable 465 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:23:1: variable : ^( VAR_DEF type declarator ) ; 466 */ 467- (void) variable 468{ 469 /* ruleScopeSetUp */ 470 471 /* ruleDeclarations */ 472 473 @try { 474 /* ruleLabelDefs entry */ 475 476 477 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:24:5: ( ^( VAR_DEF type declarator ) ) // ruleBlockSingleAlt 478 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:24:9: ^( VAR_DEF type declarator ) // alt 479 { 480 481 482 [self match:input TokenType:VAR_DEF Follow:FOLLOW_VAR_DEF_in_variable126]; 483 484 [self match:input TokenType:DOWN Follow:nil]; 485 486 /* ruleRef */ 487 [self pushFollow:FOLLOW_type_in_variable128]; 488 [self type]; 489 490 [self popFollow]; 491 492 493 494 /* ruleRef */ 495 [self pushFollow:FOLLOW_declarator_in_variable130]; 496 [self declarator]; 497 498 [self popFollow]; 499 500 501 502 [self match:input TokenType:UP Follow:nil]; 503 504 505 } 506 507 /* token+rule list labels */ 508 509 } 510 @catch (RecognitionException *re) { 511 [self reportError:re]; 512 [self recover:input Exception:re]; 513 } 514 515 @finally { 516 /* ruleScopeCleanUp */ 517 518 } 519 return ; 520} 521/* $ANTLR end variable */ 522 523/* 524 * $ANTLR start declarator 525 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:27:1: declarator : K_ID ; 526 */ 527- (void) declarator 528{ 529 /* ruleScopeSetUp */ 530 531 /* ruleDeclarations */ 532 533 @try { 534 /* ruleLabelDefs entry */ 535 536 537 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:28:5: ( K_ID ) // ruleBlockSingleAlt 538 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:28:9: K_ID // alt 539 { 540 541 [self match:input TokenType:K_ID Follow:FOLLOW_K_ID_in_declarator150]; 542 543 } 544 545 /* token+rule list labels */ 546 547 } 548 @catch (RecognitionException *re) { 549 [self reportError:re]; 550 [self recover:input Exception:re]; 551 } 552 553 @finally { 554 /* ruleScopeCleanUp */ 555 556 } 557 return ; 558} 559/* $ANTLR end declarator */ 560 561/* 562 * $ANTLR start functionHeader 563 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:31:1: functionHeader : ^( FUNC_HDR type K_ID ( formalParameter )+ ) ; 564 */ 565- (void) functionHeader 566{ 567 /* ruleScopeSetUp */ 568 569 /* ruleDeclarations */ 570 571 @try { 572 /* ruleLabelDefs entry */ 573 574 575 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:32:5: ( ^( FUNC_HDR type K_ID ( formalParameter )+ ) ) // ruleBlockSingleAlt 576 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:32:9: ^( FUNC_HDR type K_ID ( formalParameter )+ ) // alt 577 { 578 579 580 [self match:input TokenType:FUNC_HDR Follow:FOLLOW_FUNC_HDR_in_functionHeader171]; 581 582 [self match:input TokenType:DOWN Follow:nil]; 583 584 /* ruleRef */ 585 [self pushFollow:FOLLOW_type_in_functionHeader173]; 586 [self type]; 587 588 [self popFollow]; 589 590 591 592 [self match:input TokenType:K_ID Follow:FOLLOW_K_ID_in_functionHeader175]; 593 594 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:32:30: ( formalParameter )+ // positiveClosureBlock 595 NSInteger cnt3 = 0; 596 do { 597 NSInteger alt3 = 2; 598 NSInteger LA3_0 = [input LA:1]; 599 if ( (LA3_0==ARG_DEF) ) { 600 alt3=1; 601 } 602 603 604 switch (alt3) { 605 case 1 : ; 606 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:32:30: formalParameter // alt 607 { 608 609 /* ruleRef */ 610 [self pushFollow:FOLLOW_formalParameter_in_functionHeader177]; 611 [self formalParameter]; 612 613 [self popFollow]; 614 615 616 617 } 618 break; 619 620 default : 621 if ( cnt3 >= 1 ) 622 goto loop3; 623 EarlyExitException *eee = 624 [EarlyExitException newException:input decisionNumber:3]; 625 @throw eee; 626 } 627 cnt3++; 628 } while (YES); 629 loop3: ; 630 631 632 [self match:input TokenType:UP Follow:nil]; 633 634 635 } 636 637 /* token+rule list labels */ 638 639 } 640 @catch (RecognitionException *re) { 641 [self reportError:re]; 642 [self recover:input Exception:re]; 643 } 644 645 @finally { 646 /* ruleScopeCleanUp */ 647 648 } 649 return ; 650} 651/* $ANTLR end functionHeader */ 652 653/* 654 * $ANTLR start formalParameter 655 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:35:1: formalParameter : ^( ARG_DEF type declarator ) ; 656 */ 657- (void) formalParameter 658{ 659 /* ruleScopeSetUp */ 660 661 /* ruleDeclarations */ 662 663 @try { 664 /* ruleLabelDefs entry */ 665 666 667 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:36:5: ( ^( ARG_DEF type declarator ) ) // ruleBlockSingleAlt 668 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:36:9: ^( ARG_DEF type declarator ) // alt 669 { 670 671 672 [self match:input TokenType:ARG_DEF Follow:FOLLOW_ARG_DEF_in_formalParameter199]; 673 674 [self match:input TokenType:DOWN Follow:nil]; 675 676 /* ruleRef */ 677 [self pushFollow:FOLLOW_type_in_formalParameter201]; 678 [self type]; 679 680 [self popFollow]; 681 682 683 684 /* ruleRef */ 685 [self pushFollow:FOLLOW_declarator_in_formalParameter203]; 686 [self declarator]; 687 688 [self popFollow]; 689 690 691 692 [self match:input TokenType:UP Follow:nil]; 693 694 695 } 696 697 /* token+rule list labels */ 698 699 } 700 @catch (RecognitionException *re) { 701 [self reportError:re]; 702 [self recover:input Exception:re]; 703 } 704 705 @finally { 706 /* ruleScopeCleanUp */ 707 708 } 709 return ; 710} 711/* $ANTLR end formalParameter */ 712 713/* 714 * $ANTLR start type 715 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:39:1: type : ( K_INT_TYPE | K_CHAR | K_VOID | K_ID ); 716 */ 717- (void) type 718{ 719 /* ruleScopeSetUp */ 720 721 /* ruleDeclarations */ 722 723 @try { 724 /* ruleLabelDefs entry */ 725 726 727 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:40:5: ( K_INT_TYPE | K_CHAR | K_VOID | K_ID ) // ruleBlockSingleAlt 728 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g: // alt 729 { 730 731 if ([input LA:1] == K_CHAR||[input LA:1] == K_ID||[input LA:1] == K_INT_TYPE||[input LA:1] == K_VOID) { 732 [input consume]; 733 [state setIsErrorRecovery:NO]; 734 } else { 735 MismatchedSetException *mse = [MismatchedSetException newException:nil stream:input]; 736 @throw mse; 737 } 738 739 740 } 741 742 /* token+rule list labels */ 743 744 } 745 @catch (RecognitionException *re) { 746 [self reportError:re]; 747 [self recover:input Exception:re]; 748 } 749 750 @finally { 751 /* ruleScopeCleanUp */ 752 753 } 754 return ; 755} 756/* $ANTLR end type */ 757 758/* 759 * $ANTLR start block 760 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:46:1: block : ^( BLOCK ( variable )* ( stat )* ) ; 761 */ 762- (void) block 763{ 764 /* ruleScopeSetUp */ 765 766 /* ruleDeclarations */ 767 768 @try { 769 /* ruleLabelDefs entry */ 770 771 772 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:47:5: ( ^( BLOCK ( variable )* ( stat )* ) ) // ruleBlockSingleAlt 773 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:47:9: ^( BLOCK ( variable )* ( stat )* ) // alt 774 { 775 776 777 [self match:input TokenType:BLOCK Follow:FOLLOW_BLOCK_in_block283]; 778 779 if ( [input LA:1] == DOWN ) { 780 [self match:input TokenType:DOWN Follow:nil]; 781 782 783 do { 784 NSInteger alt4=2; 785 NSInteger LA4_0 = [input LA:1]; 786 if ( (LA4_0==VAR_DEF) ) { 787 alt4=1; 788 } 789 790 791 switch (alt4) { 792 case 1 : ; 793 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:47:17: variable // alt 794 { 795 796 /* ruleRef */ 797 [self pushFollow:FOLLOW_variable_in_block285]; 798 [self variable]; 799 800 [self popFollow]; 801 802 803 804 } 805 break; 806 807 default : 808 goto loop4; 809 } 810 } while (YES); 811 loop4: ; 812 813 814 815 do { 816 NSInteger alt5=2; 817 NSInteger LA5_0 = [input LA:1]; 818 if ( (LA5_0==BLOCK||(LA5_0 >= K_EQ && LA5_0 <= K_INT)||(LA5_0 >= K_LT && LA5_0 <= K_PLUS)) ) { 819 alt5=1; 820 } 821 822 823 switch (alt5) { 824 case 1 : ; 825 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:47:27: stat // alt 826 { 827 828 /* ruleRef */ 829 [self pushFollow:FOLLOW_stat_in_block288]; 830 [self stat]; 831 832 [self popFollow]; 833 834 835 836 } 837 break; 838 839 default : 840 goto loop5; 841 } 842 } while (YES); 843 loop5: ; 844 845 846 [self match:input TokenType:UP Follow:nil]; 847 } 848 849 850 } 851 852 /* token+rule list labels */ 853 854 } 855 @catch (RecognitionException *re) { 856 [self reportError:re]; 857 [self recover:input Exception:re]; 858 } 859 860 @finally { 861 /* ruleScopeCleanUp */ 862 863 } 864 return ; 865} 866/* $ANTLR end block */ 867 868/* 869 * $ANTLR start stat 870 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:50:1: stat : ( forStat | expr | block ); 871 */ 872- (void) stat 873{ 874 /* ruleScopeSetUp */ 875 876 /* ruleDeclarations */ 877 878 @try { 879 /* ruleLabelDefs entry */ 880 881 882 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:50:5: ( forStat | expr | block ) //ruleblock 883 NSInteger alt6=3; 884 unichar charLA6 = [input LA:1]; 885 switch (charLA6) { 886 case K_FOR: ; 887 { 888 alt6=1; 889 } 890 break; 891 case K_EQ: ; 892 case K_EQEQ: ; 893 case K_ID: ; 894 case K_INT: ; 895 case K_LT: ; 896 case K_PLUS: ; 897 { 898 alt6=2; 899 } 900 break; 901 case BLOCK: ; 902 { 903 alt6=3; 904 } 905 break; 906 907 default: ; 908 NoViableAltException *nvae = [NoViableAltException newException:6 state:0 stream:input]; 909 nvae.c = charLA6; 910 @throw nvae; 911 912 } 913 914 switch (alt6) { 915 case 1 : ; 916 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:50:7: forStat // alt 917 { 918 919 /* ruleRef */ 920 [self pushFollow:FOLLOW_forStat_in_stat302]; 921 [self forStat]; 922 923 [self popFollow]; 924 925 926 927 } 928 break; 929 case 2 : ; 930 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:51:7: expr // alt 931 { 932 933 /* ruleRef */ 934 [self pushFollow:FOLLOW_expr_in_stat310]; 935 [self expr]; 936 937 [self popFollow]; 938 939 940 941 } 942 break; 943 case 3 : ; 944 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:52:7: block // alt 945 { 946 947 /* ruleRef */ 948 [self pushFollow:FOLLOW_block_in_stat318]; 949 [self block]; 950 951 [self popFollow]; 952 953 954 955 } 956 break; 957 958 } 959 /* token+rule list labels */ 960 961 } 962 @catch (RecognitionException *re) { 963 [self reportError:re]; 964 [self recover:input Exception:re]; 965 } 966 967 @finally { 968 /* ruleScopeCleanUp */ 969 970 } 971 return ; 972} 973/* $ANTLR end stat */ 974 975/* 976 * $ANTLR start forStat 977 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:55:1: forStat : ^( K_FOR expr expr expr block ) ; 978 */ 979- (void) forStat 980{ 981 /* ruleScopeSetUp */ 982 983 /* ruleDeclarations */ 984 985 @try { 986 /* ruleLabelDefs entry */ 987 988 989 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:56:5: ( ^( K_FOR expr expr expr block ) ) // ruleBlockSingleAlt 990 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:56:9: ^( K_FOR expr expr expr block ) // alt 991 { 992 993 994 [self match:input TokenType:K_FOR Follow:FOLLOW_K_FOR_in_forStat338]; 995 996 [self match:input TokenType:DOWN Follow:nil]; 997 998 /* ruleRef */ 999 [self pushFollow:FOLLOW_expr_in_forStat340]; 1000 [self expr]; 1001 1002 [self popFollow]; 1003 1004 1005 1006 /* ruleRef */ 1007 [self pushFollow:FOLLOW_expr_in_forStat342]; 1008 [self expr]; 1009 1010 [self popFollow]; 1011 1012 1013 1014 /* ruleRef */ 1015 [self pushFollow:FOLLOW_expr_in_forStat344]; 1016 [self expr]; 1017 1018 [self popFollow]; 1019 1020 1021 1022 /* ruleRef */ 1023 [self pushFollow:FOLLOW_block_in_forStat346]; 1024 [self block]; 1025 1026 [self popFollow]; 1027 1028 1029 1030 [self match:input TokenType:UP Follow:nil]; 1031 1032 1033 } 1034 1035 /* token+rule list labels */ 1036 1037 } 1038 @catch (RecognitionException *re) { 1039 [self reportError:re]; 1040 [self recover:input Exception:re]; 1041 } 1042 1043 @finally { 1044 /* ruleScopeCleanUp */ 1045 1046 } 1047 return ; 1048} 1049/* $ANTLR end forStat */ 1050 1051/* 1052 * $ANTLR start expr 1053 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/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 ); 1054 */ 1055- (SimpleCTP_expr_return *) expr 1056{ 1057 /* ruleScopeSetUp */ 1058 1059 /* ruleDeclarations */ 1060 SimpleCTP_expr_return * retval = [SimpleCTP_expr_return newSimpleCTP_expr_return]; 1061 [retval setStart:[input LT:1]]; 1062 1063 1064 @try { 1065 /* ruleLabelDefs entry */ 1066 ANTLRCommonTree *K_ID1 = nil;SimpleCTP_expr_return * e = nil ; 1067 1068 1069 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/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 1070 NSInteger alt7=5; 1071 unichar charLA7 = [input LA:1]; 1072 switch (charLA7) { 1073 case K_EQEQ: ; 1074 { 1075 alt7=1; 1076 } 1077 break; 1078 case K_LT: ; 1079 { 1080 alt7=2; 1081 } 1082 break; 1083 case K_PLUS: ; 1084 { 1085 alt7=3; 1086 } 1087 break; 1088 case K_EQ: ; 1089 { 1090 alt7=4; 1091 } 1092 break; 1093 case K_ID: ; 1094 case K_INT: ; 1095 { 1096 alt7=5; 1097 } 1098 break; 1099 1100 default: ; 1101 NoViableAltException *nvae = [NoViableAltException newException:7 state:0 stream:input]; 1102 nvae.c = charLA7; 1103 @throw nvae; 1104 1105 } 1106 1107 switch (alt7) { 1108 case 1 : ; 1109 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:59:9: ^( K_EQEQ expr expr ) // alt 1110 { 1111 1112 1113 [self match:input TokenType:K_EQEQ Follow:FOLLOW_K_EQEQ_in_expr362]; 1114 1115 [self match:input TokenType:DOWN Follow:nil]; 1116 1117 /* ruleRef */ 1118 [self pushFollow:FOLLOW_expr_in_expr364]; 1119 [self expr]; 1120 1121 [self popFollow]; 1122 1123 1124 1125 /* ruleRef */ 1126 [self pushFollow:FOLLOW_expr_in_expr366]; 1127 [self expr]; 1128 1129 [self popFollow]; 1130 1131 1132 1133 [self match:input TokenType:UP Follow:nil]; 1134 1135 1136 } 1137 break; 1138 case 2 : ; 1139 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:60:9: ^( K_LT expr expr ) // alt 1140 { 1141 1142 1143 [self match:input TokenType:K_LT Follow:FOLLOW_K_LT_in_expr378]; 1144 1145 [self match:input TokenType:DOWN Follow:nil]; 1146 1147 /* ruleRef */ 1148 [self pushFollow:FOLLOW_expr_in_expr380]; 1149 [self expr]; 1150 1151 [self popFollow]; 1152 1153 1154 1155 /* ruleRef */ 1156 [self pushFollow:FOLLOW_expr_in_expr382]; 1157 [self expr]; 1158 1159 [self popFollow]; 1160 1161 1162 1163 [self match:input TokenType:UP Follow:nil]; 1164 1165 1166 } 1167 break; 1168 case 3 : ; 1169 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:61:9: ^( K_PLUS expr expr ) // alt 1170 { 1171 1172 1173 [self match:input TokenType:K_PLUS Follow:FOLLOW_K_PLUS_in_expr394]; 1174 1175 [self match:input TokenType:DOWN Follow:nil]; 1176 1177 /* ruleRef */ 1178 [self pushFollow:FOLLOW_expr_in_expr396]; 1179 [self expr]; 1180 1181 [self popFollow]; 1182 1183 1184 1185 /* ruleRef */ 1186 [self pushFollow:FOLLOW_expr_in_expr398]; 1187 [self expr]; 1188 1189 [self popFollow]; 1190 1191 1192 1193 [self match:input TokenType:UP Follow:nil]; 1194 1195 1196 } 1197 break; 1198 case 4 : ; 1199 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:62:9: ^( K_EQ K_ID e= expr ) // alt 1200 { 1201 1202 1203 [self match:input TokenType:K_EQ Follow:FOLLOW_K_EQ_in_expr410]; 1204 1205 [self match:input TokenType:DOWN Follow:nil]; 1206 1207 K_ID1=(ANTLRCommonTree *)[self match:input TokenType:K_ID Follow:FOLLOW_K_ID_in_expr412]; 1208 1209 /* ruleRef */ 1210 [self pushFollow:FOLLOW_expr_in_expr416]; 1211 e = [self expr]; 1212 1213 [self popFollow]; 1214 1215 1216 1217 [self match:input TokenType:UP Follow:nil]; 1218 1219 1220 1221 NSLog(@"assigning %@ to variable %@", (e!=nil?[[input getTokenStream] toStringFromStart:[[input getTreeAdaptor] getTokenStartIndex:[e getStart]]ToEnd:[[input getTreeAdaptor] getTokenStopIndex:[e getStart]]]:0), (K_ID1!=nil?K_ID1.text:nil)); 1222 1223 1224 } 1225 break; 1226 case 5 : ; 1227 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:63:9: atom // alt 1228 { 1229 1230 /* ruleRef */ 1231 [self pushFollow:FOLLOW_atom_in_expr429]; 1232 [self atom]; 1233 1234 [self popFollow]; 1235 1236 1237 1238 } 1239 break; 1240 1241 } 1242 /* token+rule list labels */ 1243 1244 } 1245 @catch (RecognitionException *re) { 1246 [self reportError:re]; 1247 [self recover:input Exception:re]; 1248 } 1249 1250 @finally { 1251 /* ruleScopeCleanUp */ 1252 1253 } 1254 return retval; 1255} 1256/* $ANTLR end expr */ 1257 1258/* 1259 * $ANTLR start atom 1260 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:66:1: atom : ( K_ID | K_INT ); 1261 */ 1262- (void) atom 1263{ 1264 /* ruleScopeSetUp */ 1265 1266 /* ruleDeclarations */ 1267 1268 @try { 1269 /* ruleLabelDefs entry */ 1270 1271 1272 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:67:5: ( K_ID | K_INT ) // ruleBlockSingleAlt 1273 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g: // alt 1274 { 1275 1276 if ((([input LA:1] >= K_ID) && ([input LA:1] <= K_INT))) { 1277 [input consume]; 1278 [state setIsErrorRecovery:NO]; 1279 } else { 1280 MismatchedSetException *mse = [MismatchedSetException newException:nil stream:input]; 1281 @throw mse; 1282 } 1283 1284 1285 } 1286 1287 /* token+rule list labels */ 1288 1289 } 1290 @catch (RecognitionException *re) { 1291 [self reportError:re]; 1292 [self recover:input Exception:re]; 1293 } 1294 1295 @finally { 1296 /* ruleScopeCleanUp */ 1297 1298 } 1299 return ; 1300} 1301/* $ANTLR end atom */ 1302/* ObjC end rules */ 1303 1304@end /* end of SimpleCTP implementation line 692 */ 1305