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/LL-star/SimpleC.g 5 * - On : 2012-02-16 17:39:18 6 * - for the parser : SimpleCParserParser 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/LL-star/SimpleC.g 2012-02-16 17:39:18 15 16 17/* ----------------------------------------- 18 * Include the ANTLR3 generated header file. 19 */ 20#import "SimpleCParser.h" 21/* ----------------------------------------- */ 22 23 24/* ============================================================================= */ 25/* ============================================================================= 26 * Start of recognizer 27 */ 28#pragma mark Cyclic DFA implementation start DFA2 29 30@implementation DFA2 31const static NSInteger dfa2_eot[13] = 32 {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; 33const static NSInteger dfa2_eof[13] = 34 {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; 35const static unichar dfa2_min[13] = 36 {4,4,7,4,-1,4,11,8,-1,-1,4,4,8}; 37const static unichar dfa2_max[13] = 38 {18,4,11,18,-1,4,19,10,-1,-1,18,4,10}; 39const static NSInteger dfa2_accept[13] = 40 {-1,-1,-1,-1,1,-1,-1,-1,2,3,-1,-1,-1}; 41const static NSInteger dfa2_special[13] = 42 {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; 43 44/** Used when there is no transition table entry for a particular state */ 45#define dfa2_T_empty nil 46 47const static NSInteger dfa2_T0[] = 48{ 49 3, -1, -1, -1, 4 50}; 51const static NSInteger dfa2_T1[] = 52{ 53 6, -1, 10 54}; 55const static NSInteger dfa2_T2[] = 56{ 57 8, -1, -1, -1, -1, -1, -1, -1, 9 58}; 59const static NSInteger dfa2_T3[] = 60{ 61 2 62}; 63const static NSInteger dfa2_T4[] = 64{ 65 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1 66}; 67const static NSInteger dfa2_T5[] = 68{ 69 7 70}; 71const static NSInteger dfa2_T6[] = 72{ 73 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, -1, 11, 11 74}; 75const static NSInteger dfa2_T7[] = 76{ 77 12 78}; 79const static NSInteger dfa2_T8[] = 80{ 81 5, -1, -1, -1, 6, -1, -1, -1, -1, -1, -1, 5, -1, 5, 5 82}; 83 84 85const static NSInteger *dfa2_transition[] = 86{ 87 dfa2_T4, dfa2_T3, dfa2_T0, dfa2_T8, nil, dfa2_T5, dfa2_T2, dfa2_T1, 88 nil, nil, dfa2_T6, dfa2_T7, dfa2_T1 89}; 90 91//const static NSInteger dfa2_transition[] = {}; 92 93+ (DFA2 *) newDFA2WithRecognizer:(BaseRecognizer *)aRecognizer 94{ 95 return [[[DFA2 alloc] initWithRecognizer:aRecognizer] retain]; 96} 97 98- (id) initWithRecognizer:(BaseRecognizer *) theRecognizer 99{ 100 self = [super initWithRecognizer:theRecognizer]; 101 if ( self != nil ) { 102 decisionNumber = 2; 103 eot = dfa2_eot; 104 eof = dfa2_eof; 105 min = dfa2_min; 106 max = dfa2_max; 107 accept = dfa2_accept; 108 special = dfa2_special; 109 transition = dfa2_transition; 110/* 111 if (!(transition = calloc(13, sizeof(void*)))) { 112 [self release]; 113 return nil; 114 } 115 len = 13; 116 transition[0] = dfa2_transition4; 117 transition[1] = dfa2_transition3; 118 transition[2] = dfa2_transition0; 119 transition[3] = dfa2_transition8; 120 121 transition[4] = dfa2_transition5; 122 transition[5] = dfa2_transition2; 123 transition[6] = dfa2_transition1; 124 125 126 transition[7] = dfa2_transition6; 127 transition[8] = dfa2_transition7; 128 transition[9] = dfa2_transition1; 129 */ 130 } 131 return self; 132} 133 134- (void) dealloc 135{ 136 free(transition); 137 [super dealloc]; 138} 139 140- (NSString *) description 141{ 142 return @"20:1: declaration : ( variable | functionHeader ';' | functionHeader block );"; 143} 144 145 146@end /* end DFA2 implementation */ 147 148#pragma mark Cyclic DFA implementation end DFA2 149 150 151 152#pragma mark Bitsets 153static ANTLRBitSet *FOLLOW_declaration_in_program28; 154static const unsigned long long FOLLOW_declaration_in_program28_data[] = { 0x0000000000068012LL}; 155static ANTLRBitSet *FOLLOW_variable_in_declaration50; 156static const unsigned long long FOLLOW_variable_in_declaration50_data[] = { 0x0000000000000002LL}; 157static ANTLRBitSet *FOLLOW_functionHeader_in_declaration60; 158static const unsigned long long FOLLOW_functionHeader_in_declaration60_data[] = { 0x0000000000000800LL}; 159static ANTLRBitSet *FOLLOW_11_in_declaration62; 160static const unsigned long long FOLLOW_11_in_declaration62_data[] = { 0x0000000000000002LL}; 161static ANTLRBitSet *FOLLOW_functionHeader_in_declaration75; 162static const unsigned long long FOLLOW_functionHeader_in_declaration75_data[] = { 0x0000000000080000LL}; 163static ANTLRBitSet *FOLLOW_block_in_declaration77; 164static const unsigned long long FOLLOW_block_in_declaration77_data[] = { 0x0000000000000002LL}; 165static ANTLRBitSet *FOLLOW_type_in_variable99; 166static const unsigned long long FOLLOW_type_in_variable99_data[] = { 0x0000000000000010LL}; 167static ANTLRBitSet *FOLLOW_declarator_in_variable101; 168static const unsigned long long FOLLOW_declarator_in_variable101_data[] = { 0x0000000000000800LL}; 169static ANTLRBitSet *FOLLOW_11_in_variable103; 170static const unsigned long long FOLLOW_11_in_variable103_data[] = { 0x0000000000000002LL}; 171static ANTLRBitSet *FOLLOW_ID_in_declarator122; 172static const unsigned long long FOLLOW_ID_in_declarator122_data[] = { 0x0000000000000002LL}; 173static ANTLRBitSet *FOLLOW_type_in_functionHeader151; 174static const unsigned long long FOLLOW_type_in_functionHeader151_data[] = { 0x0000000000000010LL}; 175static ANTLRBitSet *FOLLOW_ID_in_functionHeader153; 176static const unsigned long long FOLLOW_ID_in_functionHeader153_data[] = { 0x0000000000000080LL}; 177static ANTLRBitSet *FOLLOW_7_in_functionHeader155; 178static const unsigned long long FOLLOW_7_in_functionHeader155_data[] = { 0x0000000000068110LL}; 179static ANTLRBitSet *FOLLOW_formalParameter_in_functionHeader159; 180static const unsigned long long FOLLOW_formalParameter_in_functionHeader159_data[] = { 0x0000000000000500LL}; 181static ANTLRBitSet *FOLLOW_10_in_functionHeader163; 182static const unsigned long long FOLLOW_10_in_functionHeader163_data[] = { 0x0000000000068010LL}; 183static ANTLRBitSet *FOLLOW_formalParameter_in_functionHeader165; 184static const unsigned long long FOLLOW_formalParameter_in_functionHeader165_data[] = { 0x0000000000000500LL}; 185static ANTLRBitSet *FOLLOW_8_in_functionHeader173; 186static const unsigned long long FOLLOW_8_in_functionHeader173_data[] = { 0x0000000000000002LL}; 187static ANTLRBitSet *FOLLOW_type_in_formalParameter195; 188static const unsigned long long FOLLOW_type_in_formalParameter195_data[] = { 0x0000000000000010LL}; 189static ANTLRBitSet *FOLLOW_declarator_in_formalParameter197; 190static const unsigned long long FOLLOW_declarator_in_formalParameter197_data[] = { 0x0000000000000002LL}; 191static ANTLRBitSet *FOLLOW_19_in_block286; 192static const unsigned long long FOLLOW_19_in_block286_data[] = { 0x00000000001F88B0LL}; 193static ANTLRBitSet *FOLLOW_variable_in_block300; 194static const unsigned long long FOLLOW_variable_in_block300_data[] = { 0x00000000001F88B0LL}; 195static ANTLRBitSet *FOLLOW_stat_in_block315; 196static const unsigned long long FOLLOW_stat_in_block315_data[] = { 0x00000000001908B0LL}; 197static ANTLRBitSet *FOLLOW_20_in_block326; 198static const unsigned long long FOLLOW_20_in_block326_data[] = { 0x0000000000000002LL}; 199static ANTLRBitSet *FOLLOW_forStat_in_stat338; 200static const unsigned long long FOLLOW_forStat_in_stat338_data[] = { 0x0000000000000002LL}; 201static ANTLRBitSet *FOLLOW_expr_in_stat346; 202static const unsigned long long FOLLOW_expr_in_stat346_data[] = { 0x0000000000000800LL}; 203static ANTLRBitSet *FOLLOW_11_in_stat348; 204static const unsigned long long FOLLOW_11_in_stat348_data[] = { 0x0000000000000002LL}; 205static ANTLRBitSet *FOLLOW_block_in_stat362; 206static const unsigned long long FOLLOW_block_in_stat362_data[] = { 0x0000000000000002LL}; 207static ANTLRBitSet *FOLLOW_assignStat_in_stat370; 208static const unsigned long long FOLLOW_assignStat_in_stat370_data[] = { 0x0000000000000800LL}; 209static ANTLRBitSet *FOLLOW_11_in_stat372; 210static const unsigned long long FOLLOW_11_in_stat372_data[] = { 0x0000000000000002LL}; 211static ANTLRBitSet *FOLLOW_11_in_stat380; 212static const unsigned long long FOLLOW_11_in_stat380_data[] = { 0x0000000000000002LL}; 213static ANTLRBitSet *FOLLOW_16_in_forStat399; 214static const unsigned long long FOLLOW_16_in_forStat399_data[] = { 0x0000000000000080LL}; 215static ANTLRBitSet *FOLLOW_7_in_forStat401; 216static const unsigned long long FOLLOW_7_in_forStat401_data[] = { 0x0000000000000010LL}; 217static ANTLRBitSet *FOLLOW_assignStat_in_forStat403; 218static const unsigned long long FOLLOW_assignStat_in_forStat403_data[] = { 0x0000000000000800LL}; 219static ANTLRBitSet *FOLLOW_11_in_forStat405; 220static const unsigned long long FOLLOW_11_in_forStat405_data[] = { 0x00000000000000B0LL}; 221static ANTLRBitSet *FOLLOW_expr_in_forStat407; 222static const unsigned long long FOLLOW_expr_in_forStat407_data[] = { 0x0000000000000800LL}; 223static ANTLRBitSet *FOLLOW_11_in_forStat409; 224static const unsigned long long FOLLOW_11_in_forStat409_data[] = { 0x0000000000000010LL}; 225static ANTLRBitSet *FOLLOW_assignStat_in_forStat411; 226static const unsigned long long FOLLOW_assignStat_in_forStat411_data[] = { 0x0000000000000100LL}; 227static ANTLRBitSet *FOLLOW_8_in_forStat413; 228static const unsigned long long FOLLOW_8_in_forStat413_data[] = { 0x0000000000080000LL}; 229static ANTLRBitSet *FOLLOW_block_in_forStat415; 230static const unsigned long long FOLLOW_block_in_forStat415_data[] = { 0x0000000000000002LL}; 231static ANTLRBitSet *FOLLOW_ID_in_assignStat442; 232static const unsigned long long FOLLOW_ID_in_assignStat442_data[] = { 0x0000000000002000LL}; 233static ANTLRBitSet *FOLLOW_13_in_assignStat444; 234static const unsigned long long FOLLOW_13_in_assignStat444_data[] = { 0x00000000000000B0LL}; 235static ANTLRBitSet *FOLLOW_expr_in_assignStat446; 236static const unsigned long long FOLLOW_expr_in_assignStat446_data[] = { 0x0000000000000002LL}; 237static ANTLRBitSet *FOLLOW_condExpr_in_expr468; 238static const unsigned long long FOLLOW_condExpr_in_expr468_data[] = { 0x0000000000000002LL}; 239static ANTLRBitSet *FOLLOW_aexpr_in_condExpr487; 240static const unsigned long long FOLLOW_aexpr_in_condExpr487_data[] = { 0x0000000000005002LL}; 241static ANTLRBitSet *FOLLOW_set_in_condExpr491; 242static const unsigned long long FOLLOW_set_in_condExpr491_data[] = { 0x00000000000000B0LL}; 243static ANTLRBitSet *FOLLOW_aexpr_in_condExpr499; 244static const unsigned long long FOLLOW_aexpr_in_condExpr499_data[] = { 0x0000000000000002LL}; 245static ANTLRBitSet *FOLLOW_atom_in_aexpr521; 246static const unsigned long long FOLLOW_atom_in_aexpr521_data[] = { 0x0000000000000202LL}; 247static ANTLRBitSet *FOLLOW_9_in_aexpr525; 248static const unsigned long long FOLLOW_9_in_aexpr525_data[] = { 0x00000000000000B0LL}; 249static ANTLRBitSet *FOLLOW_atom_in_aexpr527; 250static const unsigned long long FOLLOW_atom_in_aexpr527_data[] = { 0x0000000000000202LL}; 251static ANTLRBitSet *FOLLOW_ID_in_atom547; 252static const unsigned long long FOLLOW_ID_in_atom547_data[] = { 0x0000000000000002LL}; 253static ANTLRBitSet *FOLLOW_INT_in_atom561; 254static const unsigned long long FOLLOW_INT_in_atom561_data[] = { 0x0000000000000002LL}; 255static ANTLRBitSet *FOLLOW_7_in_atom575; 256static const unsigned long long FOLLOW_7_in_atom575_data[] = { 0x00000000000000B0LL}; 257static ANTLRBitSet *FOLLOW_expr_in_atom577; 258static const unsigned long long FOLLOW_expr_in_atom577_data[] = { 0x0000000000000100LL}; 259static ANTLRBitSet *FOLLOW_8_in_atom579; 260static const unsigned long long FOLLOW_8_in_atom579_data[] = { 0x0000000000000002LL}; 261 262 263#pragma mark Dynamic Global globalAttributeScopeImplementation 264 265#pragma mark Dynamic Rule Scopes ruleAttributeScopeImplementation 266 267#pragma mark Rule Return Scopes returnScopeImplementation 268 269@implementation SimpleCParser // line 637 270 271/* ObjC start of ruleAttributeScope */ 272#pragma mark Dynamic Rule Scopes ruleAttributeScope 273/* ObjC end of ruleAttributeScope */ 274#pragma mark global Attribute Scopes globalAttributeScope 275/* ObjC start globalAttributeScope */ 276/* ObjC end globalAttributeScope */ 277/* ObjC start actions.(actionScope).synthesize */ 278/* ObjC start synthesize() */ 279 280+ (void) initialize 281{ 282 #pragma mark Bitsets 283 FOLLOW_declaration_in_program28 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_declaration_in_program28_data Count:(NSUInteger)1] retain]; 284 FOLLOW_variable_in_declaration50 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_variable_in_declaration50_data Count:(NSUInteger)1] retain]; 285 FOLLOW_functionHeader_in_declaration60 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_functionHeader_in_declaration60_data Count:(NSUInteger)1] retain]; 286 FOLLOW_11_in_declaration62 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_declaration62_data Count:(NSUInteger)1] retain]; 287 FOLLOW_functionHeader_in_declaration75 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_functionHeader_in_declaration75_data Count:(NSUInteger)1] retain]; 288 FOLLOW_block_in_declaration77 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_declaration77_data Count:(NSUInteger)1] retain]; 289 FOLLOW_type_in_variable99 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_variable99_data Count:(NSUInteger)1] retain]; 290 FOLLOW_declarator_in_variable101 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_variable101_data Count:(NSUInteger)1] retain]; 291 FOLLOW_11_in_variable103 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_variable103_data Count:(NSUInteger)1] retain]; 292 FOLLOW_ID_in_declarator122 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_declarator122_data Count:(NSUInteger)1] retain]; 293 FOLLOW_type_in_functionHeader151 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_functionHeader151_data Count:(NSUInteger)1] retain]; 294 FOLLOW_ID_in_functionHeader153 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_functionHeader153_data Count:(NSUInteger)1] retain]; 295 FOLLOW_7_in_functionHeader155 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_7_in_functionHeader155_data Count:(NSUInteger)1] retain]; 296 FOLLOW_formalParameter_in_functionHeader159 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_formalParameter_in_functionHeader159_data Count:(NSUInteger)1] retain]; 297 FOLLOW_10_in_functionHeader163 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_10_in_functionHeader163_data Count:(NSUInteger)1] retain]; 298 FOLLOW_formalParameter_in_functionHeader165 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_formalParameter_in_functionHeader165_data Count:(NSUInteger)1] retain]; 299 FOLLOW_8_in_functionHeader173 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_8_in_functionHeader173_data Count:(NSUInteger)1] retain]; 300 FOLLOW_type_in_formalParameter195 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_formalParameter195_data Count:(NSUInteger)1] retain]; 301 FOLLOW_declarator_in_formalParameter197 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_formalParameter197_data Count:(NSUInteger)1] retain]; 302 FOLLOW_19_in_block286 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_19_in_block286_data Count:(NSUInteger)1] retain]; 303 FOLLOW_variable_in_block300 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_variable_in_block300_data Count:(NSUInteger)1] retain]; 304 FOLLOW_stat_in_block315 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_stat_in_block315_data Count:(NSUInteger)1] retain]; 305 FOLLOW_20_in_block326 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_20_in_block326_data Count:(NSUInteger)1] retain]; 306 FOLLOW_forStat_in_stat338 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_forStat_in_stat338_data Count:(NSUInteger)1] retain]; 307 FOLLOW_expr_in_stat346 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_stat346_data Count:(NSUInteger)1] retain]; 308 FOLLOW_11_in_stat348 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_stat348_data Count:(NSUInteger)1] retain]; 309 FOLLOW_block_in_stat362 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_stat362_data Count:(NSUInteger)1] retain]; 310 FOLLOW_assignStat_in_stat370 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_stat370_data Count:(NSUInteger)1] retain]; 311 FOLLOW_11_in_stat372 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_stat372_data Count:(NSUInteger)1] retain]; 312 FOLLOW_11_in_stat380 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_stat380_data Count:(NSUInteger)1] retain]; 313 FOLLOW_16_in_forStat399 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_16_in_forStat399_data Count:(NSUInteger)1] retain]; 314 FOLLOW_7_in_forStat401 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_7_in_forStat401_data Count:(NSUInteger)1] retain]; 315 FOLLOW_assignStat_in_forStat403 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_forStat403_data Count:(NSUInteger)1] retain]; 316 FOLLOW_11_in_forStat405 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_forStat405_data Count:(NSUInteger)1] retain]; 317 FOLLOW_expr_in_forStat407 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_forStat407_data Count:(NSUInteger)1] retain]; 318 FOLLOW_11_in_forStat409 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_forStat409_data Count:(NSUInteger)1] retain]; 319 FOLLOW_assignStat_in_forStat411 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_forStat411_data Count:(NSUInteger)1] retain]; 320 FOLLOW_8_in_forStat413 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_8_in_forStat413_data Count:(NSUInteger)1] retain]; 321 FOLLOW_block_in_forStat415 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_forStat415_data Count:(NSUInteger)1] retain]; 322 FOLLOW_ID_in_assignStat442 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_assignStat442_data Count:(NSUInteger)1] retain]; 323 FOLLOW_13_in_assignStat444 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_13_in_assignStat444_data Count:(NSUInteger)1] retain]; 324 FOLLOW_expr_in_assignStat446 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_assignStat446_data Count:(NSUInteger)1] retain]; 325 FOLLOW_condExpr_in_expr468 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_condExpr_in_expr468_data Count:(NSUInteger)1] retain]; 326 FOLLOW_aexpr_in_condExpr487 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_aexpr_in_condExpr487_data Count:(NSUInteger)1] retain]; 327 FOLLOW_set_in_condExpr491 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_set_in_condExpr491_data Count:(NSUInteger)1] retain]; 328 FOLLOW_aexpr_in_condExpr499 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_aexpr_in_condExpr499_data Count:(NSUInteger)1] retain]; 329 FOLLOW_atom_in_aexpr521 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_atom_in_aexpr521_data Count:(NSUInteger)1] retain]; 330 FOLLOW_9_in_aexpr525 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_9_in_aexpr525_data Count:(NSUInteger)1] retain]; 331 FOLLOW_atom_in_aexpr527 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_atom_in_aexpr527_data Count:(NSUInteger)1] retain]; 332 FOLLOW_ID_in_atom547 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_atom547_data Count:(NSUInteger)1] retain]; 333 FOLLOW_INT_in_atom561 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_INT_in_atom561_data Count:(NSUInteger)1] retain]; 334 FOLLOW_7_in_atom575 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_7_in_atom575_data Count:(NSUInteger)1] retain]; 335 FOLLOW_expr_in_atom577 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_atom577_data Count:(NSUInteger)1] retain]; 336 FOLLOW_8_in_atom579 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_8_in_atom579_data Count:(NSUInteger)1] retain]; 337 338 [BaseRecognizer setTokenNames:[[AMutableArray arrayWithObjects:@"<invalid>", @"<EOR>", @"<DOWN>", @"<UP>", 339 @"ID", @"INT", @"WS", @"'('", @"')'", @"'+'", @"','", @"';'", @"'<'", @"'='", 340 @"'=='", @"'char'", @"'for'", @"'int'", @"'void'", @"'{'", @"'}'", nil] retain]]; 341 [BaseRecognizer setGrammarFileName:@"/Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g"]; 342} 343 344+ (SimpleCParser *)newSimpleCParser:(id<TokenStream>)aStream 345{ 346 return [[SimpleCParser alloc] initWithTokenStream:aStream]; 347} 348 349- (id) initWithTokenStream:(id<TokenStream>)aStream 350{ 351 self = [super initWithTokenStream:aStream State:[[RecognizerSharedState newRecognizerSharedStateWithRuleLen:15+1] retain]]; 352 if ( self != nil ) { 353 dfa2 = [DFA2 newDFA2WithRecognizer:self]; 354 /* start of actions-actionScope-init */ 355 /* start of init */ 356 } 357 return self; 358} 359 360- (void) dealloc 361{ 362 [dfa2 release]; 363 [super dealloc]; 364} 365 366/* ObjC start actions.(actionScope).methods */ 367/* ObjC end actions.(actionScope).methods */ 368/* ObjC start methods() */ 369/* ObjC end methods() */ 370/* ObjC start rules */ 371/* 372 * $ANTLR start program 373 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:7:1: program : ( declaration )+ ; 374 */ 375- (void) program 376{ 377 /* ruleScopeSetUp */ 378 379 /* ruleDeclarations */ 380 381 @try { 382 /* ruleLabelDefs entry */ 383 384 385 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:8:5: ( ( declaration )+ ) // ruleBlockSingleAlt 386 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:8:9: ( declaration )+ // alt 387 { 388 389 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:8:9: ( declaration )+ // positiveClosureBlock 390 NSInteger cnt1 = 0; 391 do { 392 NSInteger alt1 = 2; 393 NSInteger LA1_0 = [input LA:1]; 394 if ( (LA1_0==ID||LA1_0==15||(LA1_0 >= 17 && LA1_0 <= 18)) ) { 395 alt1=1; 396 } 397 398 399 switch (alt1) { 400 case 1 : ; 401 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:8:9: declaration // alt 402 { 403 404 /* ruleRef */ 405 [self pushFollow:FOLLOW_declaration_in_program28]; 406 [self declaration]; 407 408 [self popFollow]; 409 410 411 412 } 413 break; 414 415 default : 416 if ( cnt1 >= 1 ) 417 goto loop1; 418 EarlyExitException *eee = 419 [EarlyExitException newException:input decisionNumber:1]; 420 @throw eee; 421 } 422 cnt1++; 423 } while (YES); 424 loop1: ; 425 426 427 } 428 429 /* token+rule list labels */ 430 431 } 432 @catch (RecognitionException *re) { 433 [self reportError:re]; 434 [self recover:input Exception:re]; 435 } 436 437 @finally { 438 /* ruleScopeCleanUp */ 439 440 } 441 return ; 442} 443/* $ANTLR end program */ 444 445/* 446 * $ANTLR start declaration 447 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:20:1: declaration : ( variable | functionHeader ';' | functionHeader block ); 448 */ 449- (void) declaration 450{ 451 /* ruleScopeSetUp */ 452 453 /* ruleDeclarations */ 454 455 @try { 456 /* ruleLabelDefs entry */ 457 NSString * functionHeader1 = nil ; 458 459 NSString * functionHeader2 = nil ; 460 461 462 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:21:5: ( variable | functionHeader ';' | functionHeader block ) //ruleblock 463 NSInteger alt2=3; 464 alt2 = [dfa2 predict:input]; 465 switch (alt2) { 466 case 1 : ; 467 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:21:9: variable // alt 468 { 469 470 /* ruleRef */ 471 [self pushFollow:FOLLOW_variable_in_declaration50]; 472 [self variable]; 473 474 [self popFollow]; 475 476 477 478 } 479 break; 480 case 2 : ; 481 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:22:9: functionHeader ';' // alt 482 { 483 484 /* ruleRef */ 485 [self pushFollow:FOLLOW_functionHeader_in_declaration60]; 486 functionHeader1 = [self functionHeader]; 487 488 [self popFollow]; 489 490 491 492 [self match:input TokenType:11 Follow:FOLLOW_11_in_declaration62]; 493 494 495 NSLog(@"%@ is a declaration\n", functionHeader1 496 ); 497 498 499 } 500 break; 501 case 3 : ; 502 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:24:9: functionHeader block // alt 503 { 504 505 /* ruleRef */ 506 [self pushFollow:FOLLOW_functionHeader_in_declaration75]; 507 functionHeader2 = [self functionHeader]; 508 509 [self popFollow]; 510 511 512 513 /* ruleRef */ 514 [self pushFollow:FOLLOW_block_in_declaration77]; 515 [self block]; 516 517 [self popFollow]; 518 519 520 521 522 NSLog(@"%@ is a definition\n", functionHeader2 523 ); 524 525 526 } 527 break; 528 529 } 530 /* token+rule list labels */ 531 532 } 533 @catch (RecognitionException *re) { 534 [self reportError:re]; 535 [self recover:input Exception:re]; 536 } 537 538 @finally { 539 /* ruleScopeCleanUp */ 540 541 } 542 return ; 543} 544/* $ANTLR end declaration */ 545 546/* 547 * $ANTLR start variable 548 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:28:1: variable : type declarator ';' ; 549 */ 550- (void) variable 551{ 552 /* ruleScopeSetUp */ 553 554 /* ruleDeclarations */ 555 556 @try { 557 /* ruleLabelDefs entry */ 558 559 560 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:29:5: ( type declarator ';' ) // ruleBlockSingleAlt 561 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:29:9: type declarator ';' // alt 562 { 563 564 /* ruleRef */ 565 [self pushFollow:FOLLOW_type_in_variable99]; 566 [self type]; 567 568 [self popFollow]; 569 570 571 572 /* ruleRef */ 573 [self pushFollow:FOLLOW_declarator_in_variable101]; 574 [self declarator]; 575 576 [self popFollow]; 577 578 579 580 [self match:input TokenType:11 Follow:FOLLOW_11_in_variable103]; 581 582 } 583 584 /* token+rule list labels */ 585 586 } 587 @catch (RecognitionException *re) { 588 [self reportError:re]; 589 [self recover:input Exception:re]; 590 } 591 592 @finally { 593 /* ruleScopeCleanUp */ 594 595 } 596 return ; 597} 598/* $ANTLR end variable */ 599 600/* 601 * $ANTLR start declarator 602 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:32:1: declarator : ID ; 603 */ 604- (void) declarator 605{ 606 /* ruleScopeSetUp */ 607 608 /* ruleDeclarations */ 609 610 @try { 611 /* ruleLabelDefs entry */ 612 613 614 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:33:5: ( ID ) // ruleBlockSingleAlt 615 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:33:9: ID // alt 616 { 617 618 [self match:input TokenType:ID Follow:FOLLOW_ID_in_declarator122]; 619 620 } 621 622 /* token+rule list labels */ 623 624 } 625 @catch (RecognitionException *re) { 626 [self reportError:re]; 627 [self recover:input Exception:re]; 628 } 629 630 @finally { 631 /* ruleScopeCleanUp */ 632 633 } 634 return ; 635} 636/* $ANTLR end declarator */ 637 638/* 639 * $ANTLR start functionHeader 640 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:36:1: functionHeader returns [NSString *name] : type ID '(' ( formalParameter ( ',' formalParameter )* )? ')' ; 641 */ 642- (NSString *) functionHeader 643{ 644 /* ruleScopeSetUp */ 645 646 /* ruleDeclarations */ 647 NSString * name = nil ; 648 649 650 651 name=nil; // for now you must init here rather than in 'returns' 652 653 @try { 654 /* ruleLabelDefs entry */ 655 CommonToken *ID3 = nil; 656 657 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:40:5: ( type ID '(' ( formalParameter ( ',' formalParameter )* )? ')' ) // ruleBlockSingleAlt 658 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:40:9: type ID '(' ( formalParameter ( ',' formalParameter )* )? ')' // alt 659 { 660 661 /* ruleRef */ 662 [self pushFollow:FOLLOW_type_in_functionHeader151]; 663 [self type]; 664 665 [self popFollow]; 666 667 668 669 ID3=(CommonToken *)[self match:input TokenType:ID Follow:FOLLOW_ID_in_functionHeader153]; 670 671 [self match:input TokenType:7 Follow:FOLLOW_7_in_functionHeader155]; 672 673 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:40:21: ( formalParameter ( ',' formalParameter )* )? // block 674 NSInteger alt4=2; 675 NSInteger LA4_0 = [input LA:1]; 676 677 if ( (LA4_0==ID||LA4_0==15||(LA4_0 >= 17 && LA4_0 <= 18)) ) { 678 alt4=1; 679 } 680 switch (alt4) { 681 case 1 : ; 682 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:40:23: formalParameter ( ',' formalParameter )* // alt 683 { 684 685 /* ruleRef */ 686 [self pushFollow:FOLLOW_formalParameter_in_functionHeader159]; 687 [self formalParameter]; 688 689 [self popFollow]; 690 691 692 693 694 do { 695 NSInteger alt3=2; 696 NSInteger LA3_0 = [input LA:1]; 697 if ( (LA3_0==10) ) { 698 alt3=1; 699 } 700 701 702 switch (alt3) { 703 case 1 : ; 704 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:40:41: ',' formalParameter // alt 705 { 706 707 [self match:input TokenType:10 Follow:FOLLOW_10_in_functionHeader163]; 708 709 /* ruleRef */ 710 [self pushFollow:FOLLOW_formalParameter_in_functionHeader165]; 711 [self formalParameter]; 712 713 [self popFollow]; 714 715 716 717 } 718 break; 719 720 default : 721 goto loop3; 722 } 723 } while (YES); 724 loop3: ; 725 726 727 } 728 break; 729 730 } 731 732 733 [self match:input TokenType:8 Follow:FOLLOW_8_in_functionHeader173]; 734 735 736 name = (ID3!=nil?ID3.text:nil); 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 name; 755} 756/* $ANTLR end functionHeader */ 757 758/* 759 * $ANTLR start formalParameter 760 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:44:1: formalParameter : type declarator ; 761 */ 762- (void) formalParameter 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/LL-star/SimpleC.g:45:5: ( type declarator ) // ruleBlockSingleAlt 773 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:45:9: type declarator // alt 774 { 775 776 /* ruleRef */ 777 [self pushFollow:FOLLOW_type_in_formalParameter195]; 778 [self type]; 779 780 [self popFollow]; 781 782 783 784 /* ruleRef */ 785 [self pushFollow:FOLLOW_declarator_in_formalParameter197]; 786 [self declarator]; 787 788 [self popFollow]; 789 790 791 792 } 793 794 /* token+rule list labels */ 795 796 } 797 @catch (RecognitionException *re) { 798 [self reportError:re]; 799 [self recover:input Exception:re]; 800 } 801 802 @finally { 803 /* ruleScopeCleanUp */ 804 805 } 806 return ; 807} 808/* $ANTLR end formalParameter */ 809 810/* 811 * $ANTLR start type 812 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:48:1: type : ( 'int' | 'char' | 'void' | ID ); 813 */ 814- (void) type 815{ 816 /* ruleScopeSetUp */ 817 818 /* ruleDeclarations */ 819 820 @try { 821 /* ruleLabelDefs entry */ 822 823 824 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:49:5: ( 'int' | 'char' | 'void' | ID ) // ruleBlockSingleAlt 825 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g: // alt 826 { 827 828 if ([input LA:1] == ID||[input LA:1] == 15||(([input LA:1] >= 17) && ([input LA:1] <= 18))) { 829 [input consume]; 830 [state setIsErrorRecovery:NO]; 831 } else { 832 MismatchedSetException *mse = [MismatchedSetException newException:nil stream:input]; 833 @throw mse; 834 } 835 836 837 } 838 839 /* token+rule list labels */ 840 841 } 842 @catch (RecognitionException *re) { 843 [self reportError:re]; 844 [self recover:input Exception:re]; 845 } 846 847 @finally { 848 /* ruleScopeCleanUp */ 849 850 } 851 return ; 852} 853/* $ANTLR end type */ 854 855/* 856 * $ANTLR start block 857 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:55:1: block : '{' ( variable )* ( stat )* '}' ; 858 */ 859- (void) block 860{ 861 /* ruleScopeSetUp */ 862 863 /* ruleDeclarations */ 864 865 @try { 866 /* ruleLabelDefs entry */ 867 868 869 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:56:5: ( '{' ( variable )* ( stat )* '}' ) // ruleBlockSingleAlt 870 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:56:9: '{' ( variable )* ( stat )* '}' // alt 871 { 872 873 [self match:input TokenType:19 Follow:FOLLOW_19_in_block286]; 874 875 876 do { 877 NSInteger alt5=2; 878 NSInteger LA5_0 = [input LA:1]; 879 if ( (LA5_0==ID) ) { 880 NSInteger LA5_2 = [input LA:2]; 881 if ( (LA5_2==ID) ) { 882 alt5=1; 883 } 884 885 886 } 887 else if ( (LA5_0==15||(LA5_0 >= 17 && LA5_0 <= 18)) ) { 888 alt5=1; 889 } 890 891 892 switch (alt5) { 893 case 1 : ; 894 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:57:13: variable // alt 895 { 896 897 /* ruleRef */ 898 [self pushFollow:FOLLOW_variable_in_block300]; 899 [self variable]; 900 901 [self popFollow]; 902 903 904 905 } 906 break; 907 908 default : 909 goto loop5; 910 } 911 } while (YES); 912 loop5: ; 913 914 915 916 do { 917 NSInteger alt6=2; 918 NSInteger LA6_0 = [input LA:1]; 919 if ( ((LA6_0 >= ID && LA6_0 <= INT)||LA6_0==7||LA6_0==11||LA6_0==16||LA6_0==19) ) { 920 alt6=1; 921 } 922 923 924 switch (alt6) { 925 case 1 : ; 926 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:58:13: stat // alt 927 { 928 929 /* ruleRef */ 930 [self pushFollow:FOLLOW_stat_in_block315]; 931 [self stat]; 932 933 [self popFollow]; 934 935 936 937 } 938 break; 939 940 default : 941 goto loop6; 942 } 943 } while (YES); 944 loop6: ; 945 946 947 [self match:input TokenType:20 Follow:FOLLOW_20_in_block326]; 948 949 } 950 951 /* token+rule list labels */ 952 953 } 954 @catch (RecognitionException *re) { 955 [self reportError:re]; 956 [self recover:input Exception:re]; 957 } 958 959 @finally { 960 /* ruleScopeCleanUp */ 961 962 } 963 return ; 964} 965/* $ANTLR end block */ 966 967/* 968 * $ANTLR start stat 969 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:62:1: stat : ( forStat | expr ';' | block | assignStat ';' | ';' ); 970 */ 971- (void) stat 972{ 973 /* ruleScopeSetUp */ 974 975 /* ruleDeclarations */ 976 977 @try { 978 /* ruleLabelDefs entry */ 979 980 981 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:62:5: ( forStat | expr ';' | block | assignStat ';' | ';' ) //ruleblock 982 NSInteger alt7=5; 983 unichar charLA7 = [input LA:1]; 984 switch (charLA7) { 985 case 16: ; 986 { 987 alt7=1; 988 } 989 break; 990 case ID: ; 991 { 992 NSInteger LA7_2 = [input LA:2]; 993 994 if ( (LA7_2==13) ) { 995 alt7=4; 996 } 997 else if ( (LA7_2==9||(LA7_2 >= 11 && LA7_2 <= 12)||LA7_2==14) ) { 998 alt7=2; 999 } 1000 else { 1001 NoViableAltException *nvae = [NoViableAltException newException:7 state:2 stream:input]; 1002 nvae.c = LA7_2; 1003 @throw nvae; 1004 1005 } 1006 } 1007 break; 1008 case INT: ; 1009 case 7: ; 1010 { 1011 alt7=2; 1012 } 1013 break; 1014 case 19: ; 1015 { 1016 alt7=3; 1017 } 1018 break; 1019 case 11: ; 1020 { 1021 alt7=5; 1022 } 1023 break; 1024 1025 default: ; 1026 NoViableAltException *nvae = [NoViableAltException newException:7 state:0 stream:input]; 1027 nvae.c = charLA7; 1028 @throw nvae; 1029 1030 } 1031 1032 switch (alt7) { 1033 case 1 : ; 1034 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:62:7: forStat // alt 1035 { 1036 1037 /* ruleRef */ 1038 [self pushFollow:FOLLOW_forStat_in_stat338]; 1039 [self forStat]; 1040 1041 [self popFollow]; 1042 1043 1044 1045 } 1046 break; 1047 case 2 : ; 1048 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:63:7: expr ';' // alt 1049 { 1050 1051 /* ruleRef */ 1052 [self pushFollow:FOLLOW_expr_in_stat346]; 1053 [self expr]; 1054 1055 [self popFollow]; 1056 1057 1058 1059 [self match:input TokenType:11 Follow:FOLLOW_11_in_stat348]; 1060 1061 } 1062 break; 1063 case 3 : ; 1064 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:64:7: block // alt 1065 { 1066 1067 /* ruleRef */ 1068 [self pushFollow:FOLLOW_block_in_stat362]; 1069 [self block]; 1070 1071 [self popFollow]; 1072 1073 1074 1075 } 1076 break; 1077 case 4 : ; 1078 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:65:7: assignStat ';' // alt 1079 { 1080 1081 /* ruleRef */ 1082 [self pushFollow:FOLLOW_assignStat_in_stat370]; 1083 [self assignStat]; 1084 1085 [self popFollow]; 1086 1087 1088 1089 [self match:input TokenType:11 Follow:FOLLOW_11_in_stat372]; 1090 1091 } 1092 break; 1093 case 5 : ; 1094 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:66:7: ';' // alt 1095 { 1096 1097 [self match:input TokenType:11 Follow:FOLLOW_11_in_stat380]; 1098 1099 } 1100 break; 1101 1102 } 1103 /* token+rule list labels */ 1104 1105 } 1106 @catch (RecognitionException *re) { 1107 [self reportError:re]; 1108 [self recover:input Exception:re]; 1109 } 1110 1111 @finally { 1112 /* ruleScopeCleanUp */ 1113 1114 } 1115 return ; 1116} 1117/* $ANTLR end stat */ 1118 1119/* 1120 * $ANTLR start forStat 1121 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:69:1: forStat : 'for' '(' assignStat ';' expr ';' assignStat ')' block ; 1122 */ 1123- (void) forStat 1124{ 1125 /* ruleScopeSetUp */ 1126 1127 /* ruleDeclarations */ 1128 1129 @try { 1130 /* ruleLabelDefs entry */ 1131 1132 1133 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:70:5: ( 'for' '(' assignStat ';' expr ';' assignStat ')' block ) // ruleBlockSingleAlt 1134 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:70:9: 'for' '(' assignStat ';' expr ';' assignStat ')' block // alt 1135 { 1136 1137 [self match:input TokenType:16 Follow:FOLLOW_16_in_forStat399]; 1138 1139 [self match:input TokenType:7 Follow:FOLLOW_7_in_forStat401]; 1140 1141 /* ruleRef */ 1142 [self pushFollow:FOLLOW_assignStat_in_forStat403]; 1143 [self assignStat]; 1144 1145 [self popFollow]; 1146 1147 1148 1149 [self match:input TokenType:11 Follow:FOLLOW_11_in_forStat405]; 1150 1151 /* ruleRef */ 1152 [self pushFollow:FOLLOW_expr_in_forStat407]; 1153 [self expr]; 1154 1155 [self popFollow]; 1156 1157 1158 1159 [self match:input TokenType:11 Follow:FOLLOW_11_in_forStat409]; 1160 1161 /* ruleRef */ 1162 [self pushFollow:FOLLOW_assignStat_in_forStat411]; 1163 [self assignStat]; 1164 1165 [self popFollow]; 1166 1167 1168 1169 [self match:input TokenType:8 Follow:FOLLOW_8_in_forStat413]; 1170 1171 /* ruleRef */ 1172 [self pushFollow:FOLLOW_block_in_forStat415]; 1173 [self block]; 1174 1175 [self popFollow]; 1176 1177 1178 1179 } 1180 1181 /* token+rule list labels */ 1182 1183 } 1184 @catch (RecognitionException *re) { 1185 [self reportError:re]; 1186 [self recover:input Exception:re]; 1187 } 1188 1189 @finally { 1190 /* ruleScopeCleanUp */ 1191 1192 } 1193 return ; 1194} 1195/* $ANTLR end forStat */ 1196 1197/* 1198 * $ANTLR start assignStat 1199 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:73:1: assignStat : ID '=' expr ; 1200 */ 1201- (void) assignStat 1202{ 1203 /* ruleScopeSetUp */ 1204 1205 /* ruleDeclarations */ 1206 1207 @try { 1208 /* ruleLabelDefs entry */ 1209 1210 1211 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:74:5: ( ID '=' expr ) // ruleBlockSingleAlt 1212 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:74:9: ID '=' expr // alt 1213 { 1214 1215 [self match:input TokenType:ID Follow:FOLLOW_ID_in_assignStat442]; 1216 1217 [self match:input TokenType:13 Follow:FOLLOW_13_in_assignStat444]; 1218 1219 /* ruleRef */ 1220 [self pushFollow:FOLLOW_expr_in_assignStat446]; 1221 [self expr]; 1222 1223 [self popFollow]; 1224 1225 1226 1227 } 1228 1229 /* token+rule list labels */ 1230 1231 } 1232 @catch (RecognitionException *re) { 1233 [self reportError:re]; 1234 [self recover:input Exception:re]; 1235 } 1236 1237 @finally { 1238 /* ruleScopeCleanUp */ 1239 1240 } 1241 return ; 1242} 1243/* $ANTLR end assignStat */ 1244 1245/* 1246 * $ANTLR start expr 1247 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:77:1: expr : condExpr ; 1248 */ 1249- (void) expr 1250{ 1251 /* ruleScopeSetUp */ 1252 1253 /* ruleDeclarations */ 1254 1255 @try { 1256 /* ruleLabelDefs entry */ 1257 1258 1259 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:77:5: ( condExpr ) // ruleBlockSingleAlt 1260 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:77:9: condExpr // alt 1261 { 1262 1263 /* ruleRef */ 1264 [self pushFollow:FOLLOW_condExpr_in_expr468]; 1265 [self condExpr]; 1266 1267 [self popFollow]; 1268 1269 1270 1271 } 1272 1273 /* token+rule list labels */ 1274 1275 } 1276 @catch (RecognitionException *re) { 1277 [self reportError:re]; 1278 [self recover:input Exception:re]; 1279 } 1280 1281 @finally { 1282 /* ruleScopeCleanUp */ 1283 1284 } 1285 return ; 1286} 1287/* $ANTLR end expr */ 1288 1289/* 1290 * $ANTLR start condExpr 1291 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:80:1: condExpr : aexpr ( ( '==' | '<' ) aexpr )? ; 1292 */ 1293- (void) condExpr 1294{ 1295 /* ruleScopeSetUp */ 1296 1297 /* ruleDeclarations */ 1298 1299 @try { 1300 /* ruleLabelDefs entry */ 1301 1302 1303 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:81:5: ( aexpr ( ( '==' | '<' ) aexpr )? ) // ruleBlockSingleAlt 1304 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:81:9: aexpr ( ( '==' | '<' ) aexpr )? // alt 1305 { 1306 1307 /* ruleRef */ 1308 [self pushFollow:FOLLOW_aexpr_in_condExpr487]; 1309 [self aexpr]; 1310 1311 [self popFollow]; 1312 1313 1314 1315 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:81:15: ( ( '==' | '<' ) aexpr )? // block 1316 NSInteger alt8=2; 1317 NSInteger LA8_0 = [input LA:1]; 1318 1319 if ( (LA8_0==12||LA8_0==14) ) { 1320 alt8=1; 1321 } 1322 switch (alt8) { 1323 case 1 : ; 1324 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:81:17: ( '==' | '<' ) aexpr // alt 1325 { 1326 1327 if ([input LA:1] == 12||[input LA:1] == 14) { 1328 [input consume]; 1329 [state setIsErrorRecovery:NO]; 1330 } else { 1331 MismatchedSetException *mse = [MismatchedSetException newException:nil stream:input]; 1332 @throw mse; 1333 } 1334 1335 1336 /* ruleRef */ 1337 [self pushFollow:FOLLOW_aexpr_in_condExpr499]; 1338 [self aexpr]; 1339 1340 [self popFollow]; 1341 1342 1343 1344 } 1345 break; 1346 1347 } 1348 1349 1350 } 1351 1352 /* token+rule list labels */ 1353 1354 } 1355 @catch (RecognitionException *re) { 1356 [self reportError:re]; 1357 [self recover:input Exception:re]; 1358 } 1359 1360 @finally { 1361 /* ruleScopeCleanUp */ 1362 1363 } 1364 return ; 1365} 1366/* $ANTLR end condExpr */ 1367 1368/* 1369 * $ANTLR start aexpr 1370 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:84:1: aexpr : atom ( '+' atom )* ; 1371 */ 1372- (void) aexpr 1373{ 1374 /* ruleScopeSetUp */ 1375 1376 /* ruleDeclarations */ 1377 1378 @try { 1379 /* ruleLabelDefs entry */ 1380 1381 1382 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:85:5: ( atom ( '+' atom )* ) // ruleBlockSingleAlt 1383 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:85:9: atom ( '+' atom )* // alt 1384 { 1385 1386 /* ruleRef */ 1387 [self pushFollow:FOLLOW_atom_in_aexpr521]; 1388 [self atom]; 1389 1390 [self popFollow]; 1391 1392 1393 1394 1395 do { 1396 NSInteger alt9=2; 1397 NSInteger LA9_0 = [input LA:1]; 1398 if ( (LA9_0==9) ) { 1399 alt9=1; 1400 } 1401 1402 1403 switch (alt9) { 1404 case 1 : ; 1405 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:85:16: '+' atom // alt 1406 { 1407 1408 [self match:input TokenType:9 Follow:FOLLOW_9_in_aexpr525]; 1409 1410 /* ruleRef */ 1411 [self pushFollow:FOLLOW_atom_in_aexpr527]; 1412 [self atom]; 1413 1414 [self popFollow]; 1415 1416 1417 1418 } 1419 break; 1420 1421 default : 1422 goto loop9; 1423 } 1424 } while (YES); 1425 loop9: ; 1426 1427 1428 } 1429 1430 /* token+rule list labels */ 1431 1432 } 1433 @catch (RecognitionException *re) { 1434 [self reportError:re]; 1435 [self recover:input Exception:re]; 1436 } 1437 1438 @finally { 1439 /* ruleScopeCleanUp */ 1440 1441 } 1442 return ; 1443} 1444/* $ANTLR end aexpr */ 1445 1446/* 1447 * $ANTLR start atom 1448 * /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:88:1: atom : ( ID | INT | '(' expr ')' ); 1449 */ 1450- (void) atom 1451{ 1452 /* ruleScopeSetUp */ 1453 1454 /* ruleDeclarations */ 1455 1456 @try { 1457 /* ruleLabelDefs entry */ 1458 1459 1460 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:89:5: ( ID | INT | '(' expr ')' ) //ruleblock 1461 NSInteger alt10=3; 1462 unichar charLA10 = [input LA:1]; 1463 switch (charLA10) { 1464 case ID: ; 1465 { 1466 alt10=1; 1467 } 1468 break; 1469 case INT: ; 1470 { 1471 alt10=2; 1472 } 1473 break; 1474 case 7: ; 1475 { 1476 alt10=3; 1477 } 1478 break; 1479 1480 default: ; 1481 NoViableAltException *nvae = [NoViableAltException newException:10 state:0 stream:input]; 1482 nvae.c = charLA10; 1483 @throw nvae; 1484 1485 } 1486 1487 switch (alt10) { 1488 case 1 : ; 1489 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:89:7: ID // alt 1490 { 1491 1492 [self match:input TokenType:ID Follow:FOLLOW_ID_in_atom547]; 1493 1494 } 1495 break; 1496 case 2 : ; 1497 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:90:7: INT // alt 1498 { 1499 1500 [self match:input TokenType:INT Follow:FOLLOW_INT_in_atom561]; 1501 1502 } 1503 break; 1504 case 3 : ; 1505 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:91:7: '(' expr ')' // alt 1506 { 1507 1508 [self match:input TokenType:7 Follow:FOLLOW_7_in_atom575]; 1509 1510 /* ruleRef */ 1511 [self pushFollow:FOLLOW_expr_in_atom577]; 1512 [self expr]; 1513 1514 [self popFollow]; 1515 1516 1517 1518 [self match:input TokenType:8 Follow:FOLLOW_8_in_atom579]; 1519 1520 } 1521 break; 1522 1523 } 1524 /* token+rule list labels */ 1525 1526 } 1527 @catch (RecognitionException *re) { 1528 [self reportError:re]; 1529 [self recover:input Exception:re]; 1530 } 1531 1532 @finally { 1533 /* ruleScopeCleanUp */ 1534 1535 } 1536 return ; 1537} 1538/* $ANTLR end atom */ 1539/* ObjC end rules */ 1540 1541@end /* end of SimpleCParser implementation line 692 */ 1542