/projects/antlr-3.4/runtime/ObjC/Framework/examples/LL-star/SimpleCParser.m
Objective C | 1438 lines | 842 code | 327 blank | 269 comment | 51 complexity | 7f1d5856e31a3fd0f67ed860ce10d0d1 MD5 | raw file
- /** \file
- * This OBJC source file was generated by $ANTLR version ${project.version} ${buildNumber}
- *
- * - From the grammar source file : SimpleC.g
- * - On : 2011-05-06 13:53:12
- * - for the parser : SimpleCParserParser
- *
- * Editing it, at least manually, is not wise.
- *
- * ObjC language generator and runtime by Alan Condit, acondit|hereisanat|ipns|dotgoeshere|com.
- *
- *
- */
- // $ANTLR ${project.version} ${buildNumber} SimpleC.g 2011-05-06 13:53:12
- /* -----------------------------------------
- * Include the ANTLR3 generated header file.
- */
- #import "SimpleCParser.h"
- /* ----------------------------------------- */
- /* ============================================================================= */
- /* =============================================================================
- * Start of recognizer
- */
- #pragma mark Cyclic DFA implementation start DFA2
- @implementation DFA2
- const static NSInteger dfa2_eot[13] =
- {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
- const static NSInteger dfa2_eof[13] =
- {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
- const static unichar dfa2_min[13] =
- {4,4,7,4,0,4,11,8,0,0,4,4,8};
- const static unichar dfa2_max[13] =
- {18,4,11,18,0,4,19,10,0,0,18,4,10};
- const static NSInteger dfa2_accept[13] =
- {-1,-1,-1,-1,1,-1,-1,-1,2,3,-1,-1,-1};
- const static NSInteger dfa2_special[13] =
- {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
- const static NSInteger dfa2_transition[] = {};
- const static NSInteger dfa2_transition0[] = {3, -1, -1, -1, 4};
- const static NSInteger dfa2_transition1[] = {6, -1, 10};
- const static NSInteger dfa2_transition2[] = {8, -1, -1, -1, -1, -1, -1,
- -1, 9};
- const static NSInteger dfa2_transition3[] = {2};
- const static NSInteger dfa2_transition4[] = {1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 1, -1, 1, 1};
- const static NSInteger dfa2_transition5[] = {7};
- const static NSInteger dfa2_transition6[] = {11, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 11, -1, 11, 11};
- const static NSInteger dfa2_transition7[] = {12};
- const static NSInteger dfa2_transition8[] = {5, -1, -1, -1, 6, -1, -1, -1,
- -1, -1, -1, 5, -1, 5, 5};
- + (id) newDFA2WithRecognizer:(ANTLRBaseRecognizer *)aRecognizer
- {
- return [[[DFA2 alloc] initWithRecognizer:aRecognizer] retain];
- }
- - (id) initWithRecognizer:(ANTLRBaseRecognizer *) theRecognizer
- {
- self = [super initWithRecognizer:theRecognizer];
- if ( self != nil ) {
- decisionNumber = 2;
- eot = dfa2_eot;
- eof = dfa2_eof;
- min = dfa2_min;
- max = dfa2_max;
- accept = dfa2_accept;
- special = dfa2_special;
- if (!(transition = calloc(13, sizeof(void*)))) {
- [self release];
- return nil;
- }
- len = 13;
- transition[0] = dfa2_transition4;
- transition[1] = dfa2_transition3;
- transition[2] = dfa2_transition0;
- transition[3] = dfa2_transition8;
- transition[4] = dfa2_transition5;
- transition[5] = dfa2_transition2;
- transition[6] = dfa2_transition1;
- transition[7] = dfa2_transition6;
- transition[8] = dfa2_transition7;
- transition[9] = dfa2_transition1;
- }
- return self;
- }
- - (void) dealloc
- {
- free(transition);
- [super dealloc];
- }
- - (NSString *) description
- {
- return @"20:1: declaration : ( variable | functionHeader ';' | functionHeader block );";
- }
- @end /* end DFA2 implementation */
- #pragma mark Cyclic DFA implementation end DFA2
- #pragma mark Bitsets
- static ANTLRBitSet *FOLLOW_declaration_in_program28;
- static const unsigned long long FOLLOW_declaration_in_program28_data[] = { 0x0000000000068012LL};
- static ANTLRBitSet *FOLLOW_variable_in_declaration50;
- static const unsigned long long FOLLOW_variable_in_declaration50_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_functionHeader_in_declaration60;
- static const unsigned long long FOLLOW_functionHeader_in_declaration60_data[] = { 0x0000000000000800LL};
- static ANTLRBitSet *FOLLOW_11_in_declaration62;
- static const unsigned long long FOLLOW_11_in_declaration62_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_functionHeader_in_declaration75;
- static const unsigned long long FOLLOW_functionHeader_in_declaration75_data[] = { 0x0000000000080000LL};
- static ANTLRBitSet *FOLLOW_block_in_declaration77;
- static const unsigned long long FOLLOW_block_in_declaration77_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_type_in_variable99;
- static const unsigned long long FOLLOW_type_in_variable99_data[] = { 0x0000000000000010LL};
- static ANTLRBitSet *FOLLOW_declarator_in_variable101;
- static const unsigned long long FOLLOW_declarator_in_variable101_data[] = { 0x0000000000000800LL};
- static ANTLRBitSet *FOLLOW_11_in_variable103;
- static const unsigned long long FOLLOW_11_in_variable103_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_ID_in_declarator122;
- static const unsigned long long FOLLOW_ID_in_declarator122_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_type_in_functionHeader151;
- static const unsigned long long FOLLOW_type_in_functionHeader151_data[] = { 0x0000000000000010LL};
- static ANTLRBitSet *FOLLOW_ID_in_functionHeader153;
- static const unsigned long long FOLLOW_ID_in_functionHeader153_data[] = { 0x0000000000000080LL};
- static ANTLRBitSet *FOLLOW_7_in_functionHeader155;
- static const unsigned long long FOLLOW_7_in_functionHeader155_data[] = { 0x0000000000068110LL};
- static ANTLRBitSet *FOLLOW_formalParameter_in_functionHeader159;
- static const unsigned long long FOLLOW_formalParameter_in_functionHeader159_data[] = { 0x0000000000000500LL};
- static ANTLRBitSet *FOLLOW_10_in_functionHeader163;
- static const unsigned long long FOLLOW_10_in_functionHeader163_data[] = { 0x0000000000068010LL};
- static ANTLRBitSet *FOLLOW_formalParameter_in_functionHeader165;
- static const unsigned long long FOLLOW_formalParameter_in_functionHeader165_data[] = { 0x0000000000000500LL};
- static ANTLRBitSet *FOLLOW_8_in_functionHeader173;
- static const unsigned long long FOLLOW_8_in_functionHeader173_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_type_in_formalParameter195;
- static const unsigned long long FOLLOW_type_in_formalParameter195_data[] = { 0x0000000000000010LL};
- static ANTLRBitSet *FOLLOW_declarator_in_formalParameter197;
- static const unsigned long long FOLLOW_declarator_in_formalParameter197_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_19_in_block286;
- static const unsigned long long FOLLOW_19_in_block286_data[] = { 0x00000000001F88B0LL};
- static ANTLRBitSet *FOLLOW_variable_in_block300;
- static const unsigned long long FOLLOW_variable_in_block300_data[] = { 0x00000000001F88B0LL};
- static ANTLRBitSet *FOLLOW_stat_in_block315;
- static const unsigned long long FOLLOW_stat_in_block315_data[] = { 0x00000000001908B0LL};
- static ANTLRBitSet *FOLLOW_20_in_block326;
- static const unsigned long long FOLLOW_20_in_block326_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_forStat_in_stat338;
- static const unsigned long long FOLLOW_forStat_in_stat338_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_expr_in_stat346;
- static const unsigned long long FOLLOW_expr_in_stat346_data[] = { 0x0000000000000800LL};
- static ANTLRBitSet *FOLLOW_11_in_stat348;
- static const unsigned long long FOLLOW_11_in_stat348_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_block_in_stat362;
- static const unsigned long long FOLLOW_block_in_stat362_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_assignStat_in_stat370;
- static const unsigned long long FOLLOW_assignStat_in_stat370_data[] = { 0x0000000000000800LL};
- static ANTLRBitSet *FOLLOW_11_in_stat372;
- static const unsigned long long FOLLOW_11_in_stat372_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_11_in_stat380;
- static const unsigned long long FOLLOW_11_in_stat380_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_16_in_forStat399;
- static const unsigned long long FOLLOW_16_in_forStat399_data[] = { 0x0000000000000080LL};
- static ANTLRBitSet *FOLLOW_7_in_forStat401;
- static const unsigned long long FOLLOW_7_in_forStat401_data[] = { 0x0000000000000010LL};
- static ANTLRBitSet *FOLLOW_assignStat_in_forStat403;
- static const unsigned long long FOLLOW_assignStat_in_forStat403_data[] = { 0x0000000000000800LL};
- static ANTLRBitSet *FOLLOW_11_in_forStat405;
- static const unsigned long long FOLLOW_11_in_forStat405_data[] = { 0x00000000000000B0LL};
- static ANTLRBitSet *FOLLOW_expr_in_forStat407;
- static const unsigned long long FOLLOW_expr_in_forStat407_data[] = { 0x0000000000000800LL};
- static ANTLRBitSet *FOLLOW_11_in_forStat409;
- static const unsigned long long FOLLOW_11_in_forStat409_data[] = { 0x0000000000000010LL};
- static ANTLRBitSet *FOLLOW_assignStat_in_forStat411;
- static const unsigned long long FOLLOW_assignStat_in_forStat411_data[] = { 0x0000000000000100LL};
- static ANTLRBitSet *FOLLOW_8_in_forStat413;
- static const unsigned long long FOLLOW_8_in_forStat413_data[] = { 0x0000000000080000LL};
- static ANTLRBitSet *FOLLOW_block_in_forStat415;
- static const unsigned long long FOLLOW_block_in_forStat415_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_ID_in_assignStat442;
- static const unsigned long long FOLLOW_ID_in_assignStat442_data[] = { 0x0000000000002000LL};
- static ANTLRBitSet *FOLLOW_13_in_assignStat444;
- static const unsigned long long FOLLOW_13_in_assignStat444_data[] = { 0x00000000000000B0LL};
- static ANTLRBitSet *FOLLOW_expr_in_assignStat446;
- static const unsigned long long FOLLOW_expr_in_assignStat446_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_condExpr_in_expr468;
- static const unsigned long long FOLLOW_condExpr_in_expr468_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_aexpr_in_condExpr487;
- static const unsigned long long FOLLOW_aexpr_in_condExpr487_data[] = { 0x0000000000005002LL};
- static ANTLRBitSet *FOLLOW_set_in_condExpr491;
- static const unsigned long long FOLLOW_set_in_condExpr491_data[] = { 0x00000000000000B0LL};
- static ANTLRBitSet *FOLLOW_aexpr_in_condExpr499;
- static const unsigned long long FOLLOW_aexpr_in_condExpr499_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_atom_in_aexpr521;
- static const unsigned long long FOLLOW_atom_in_aexpr521_data[] = { 0x0000000000000202LL};
- static ANTLRBitSet *FOLLOW_9_in_aexpr525;
- static const unsigned long long FOLLOW_9_in_aexpr525_data[] = { 0x00000000000000B0LL};
- static ANTLRBitSet *FOLLOW_atom_in_aexpr527;
- static const unsigned long long FOLLOW_atom_in_aexpr527_data[] = { 0x0000000000000202LL};
- static ANTLRBitSet *FOLLOW_ID_in_atom547;
- static const unsigned long long FOLLOW_ID_in_atom547_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_INT_in_atom561;
- static const unsigned long long FOLLOW_INT_in_atom561_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_7_in_atom575;
- static const unsigned long long FOLLOW_7_in_atom575_data[] = { 0x00000000000000B0LL};
- static ANTLRBitSet *FOLLOW_expr_in_atom577;
- static const unsigned long long FOLLOW_expr_in_atom577_data[] = { 0x0000000000000100LL};
- static ANTLRBitSet *FOLLOW_8_in_atom579;
- static const unsigned long long FOLLOW_8_in_atom579_data[] = { 0x0000000000000002LL};
- #pragma mark Dynamic Global Scopes
- #pragma mark Dynamic Rule Scopes
- #pragma mark Rule Return Scopes start
- //#pragma mark Rule return scopes start
- //
- #pragma mark Rule return scopes start
- @implementation SimpleCParser // line 637
- /* ObjC start of ruleAttributeScope */
- #pragma mark Dynamic Rule Scopes
- /* ObjC end of ruleAttributeScope */
- #pragma mark global Attribute Scopes
- /* ObjC start globalAttributeScope */
- /* ObjC end globalAttributeScope */
- /* ObjC start actions.(actionScope).synthesize */
- /* ObjC end actions.(actionScope).synthesize */
- /* ObjC start synthesize() */
- /* ObjC end synthesize() */
- + (void) initialize
- {
- #pragma mark Bitsets
- FOLLOW_declaration_in_program28 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_declaration_in_program28_data Count:(NSUInteger)1] retain];
- FOLLOW_variable_in_declaration50 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_variable_in_declaration50_data Count:(NSUInteger)1] retain];
- FOLLOW_functionHeader_in_declaration60 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_functionHeader_in_declaration60_data Count:(NSUInteger)1] retain];
- FOLLOW_11_in_declaration62 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_declaration62_data Count:(NSUInteger)1] retain];
- FOLLOW_functionHeader_in_declaration75 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_functionHeader_in_declaration75_data Count:(NSUInteger)1] retain];
- FOLLOW_block_in_declaration77 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_declaration77_data Count:(NSUInteger)1] retain];
- FOLLOW_type_in_variable99 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_variable99_data Count:(NSUInteger)1] retain];
- FOLLOW_declarator_in_variable101 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_variable101_data Count:(NSUInteger)1] retain];
- FOLLOW_11_in_variable103 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_variable103_data Count:(NSUInteger)1] retain];
- FOLLOW_ID_in_declarator122 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_declarator122_data Count:(NSUInteger)1] retain];
- FOLLOW_type_in_functionHeader151 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_functionHeader151_data Count:(NSUInteger)1] retain];
- FOLLOW_ID_in_functionHeader153 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_functionHeader153_data Count:(NSUInteger)1] retain];
- FOLLOW_7_in_functionHeader155 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_7_in_functionHeader155_data Count:(NSUInteger)1] retain];
- FOLLOW_formalParameter_in_functionHeader159 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_formalParameter_in_functionHeader159_data Count:(NSUInteger)1] retain];
- FOLLOW_10_in_functionHeader163 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_10_in_functionHeader163_data Count:(NSUInteger)1] retain];
- FOLLOW_formalParameter_in_functionHeader165 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_formalParameter_in_functionHeader165_data Count:(NSUInteger)1] retain];
- FOLLOW_8_in_functionHeader173 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_8_in_functionHeader173_data Count:(NSUInteger)1] retain];
- FOLLOW_type_in_formalParameter195 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_formalParameter195_data Count:(NSUInteger)1] retain];
- FOLLOW_declarator_in_formalParameter197 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_formalParameter197_data Count:(NSUInteger)1] retain];
- FOLLOW_19_in_block286 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_19_in_block286_data Count:(NSUInteger)1] retain];
- FOLLOW_variable_in_block300 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_variable_in_block300_data Count:(NSUInteger)1] retain];
- FOLLOW_stat_in_block315 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_stat_in_block315_data Count:(NSUInteger)1] retain];
- FOLLOW_20_in_block326 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_20_in_block326_data Count:(NSUInteger)1] retain];
- FOLLOW_forStat_in_stat338 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_forStat_in_stat338_data Count:(NSUInteger)1] retain];
- FOLLOW_expr_in_stat346 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_stat346_data Count:(NSUInteger)1] retain];
- FOLLOW_11_in_stat348 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_stat348_data Count:(NSUInteger)1] retain];
- FOLLOW_block_in_stat362 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_stat362_data Count:(NSUInteger)1] retain];
- FOLLOW_assignStat_in_stat370 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_stat370_data Count:(NSUInteger)1] retain];
- FOLLOW_11_in_stat372 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_stat372_data Count:(NSUInteger)1] retain];
- FOLLOW_11_in_stat380 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_stat380_data Count:(NSUInteger)1] retain];
- FOLLOW_16_in_forStat399 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_16_in_forStat399_data Count:(NSUInteger)1] retain];
- FOLLOW_7_in_forStat401 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_7_in_forStat401_data Count:(NSUInteger)1] retain];
- FOLLOW_assignStat_in_forStat403 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_forStat403_data Count:(NSUInteger)1] retain];
- FOLLOW_11_in_forStat405 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_forStat405_data Count:(NSUInteger)1] retain];
- FOLLOW_expr_in_forStat407 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_forStat407_data Count:(NSUInteger)1] retain];
- FOLLOW_11_in_forStat409 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_forStat409_data Count:(NSUInteger)1] retain];
- FOLLOW_assignStat_in_forStat411 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_forStat411_data Count:(NSUInteger)1] retain];
- FOLLOW_8_in_forStat413 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_8_in_forStat413_data Count:(NSUInteger)1] retain];
- FOLLOW_block_in_forStat415 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_forStat415_data Count:(NSUInteger)1] retain];
- FOLLOW_ID_in_assignStat442 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_assignStat442_data Count:(NSUInteger)1] retain];
- FOLLOW_13_in_assignStat444 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_13_in_assignStat444_data Count:(NSUInteger)1] retain];
- FOLLOW_expr_in_assignStat446 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_assignStat446_data Count:(NSUInteger)1] retain];
- FOLLOW_condExpr_in_expr468 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_condExpr_in_expr468_data Count:(NSUInteger)1] retain];
- FOLLOW_aexpr_in_condExpr487 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_aexpr_in_condExpr487_data Count:(NSUInteger)1] retain];
- FOLLOW_set_in_condExpr491 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_set_in_condExpr491_data Count:(NSUInteger)1] retain];
- FOLLOW_aexpr_in_condExpr499 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_aexpr_in_condExpr499_data Count:(NSUInteger)1] retain];
- FOLLOW_atom_in_aexpr521 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_atom_in_aexpr521_data Count:(NSUInteger)1] retain];
- FOLLOW_9_in_aexpr525 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_9_in_aexpr525_data Count:(NSUInteger)1] retain];
- FOLLOW_atom_in_aexpr527 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_atom_in_aexpr527_data Count:(NSUInteger)1] retain];
- FOLLOW_ID_in_atom547 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_atom547_data Count:(NSUInteger)1] retain];
- FOLLOW_INT_in_atom561 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_INT_in_atom561_data Count:(NSUInteger)1] retain];
- FOLLOW_7_in_atom575 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_7_in_atom575_data Count:(NSUInteger)1] retain];
- FOLLOW_expr_in_atom577 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_atom577_data Count:(NSUInteger)1] retain];
- FOLLOW_8_in_atom579 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_8_in_atom579_data Count:(NSUInteger)1] retain];
- [ANTLRBaseRecognizer setTokenNames:[[AMutableArray arrayWithObjects:@"<invalid>", @"<EOR>", @"<DOWN>", @"<UP>",
- @"ID", @"INT", @"WS", @"'('", @"')'", @"'+'", @"','", @"';'", @"'<'", @"'='",
- @"'=='", @"'char'", @"'for'", @"'int'", @"'void'", @"'{'", @"'}'", nil] retain]];
- [ANTLRBaseRecognizer setGrammarFileName:@"SimpleC.g"];
- }
- + (SimpleCParser *)newSimpleCParser:(id<ANTLRTokenStream>)aStream
- {
- return [[SimpleCParser alloc] initWithTokenStream:aStream];
- }
- - (id) initWithTokenStream:(id<ANTLRTokenStream>)aStream
- {
- self = [super initWithTokenStream:aStream State:[[ANTLRRecognizerSharedState newANTLRRecognizerSharedStateWithRuleLen:15+1] retain]];
- if ( self != nil ) {
- dfa2 = [DFA2 newDFA2WithRecognizer:self];
- /* start of actions-actionScope-init */
- /* start of init */
- }
- return self;
- }
- - (void) dealloc
- {
- [dfa2 release];
- [super dealloc];
- }
- /* ObjC start members */
- /* ObjC end members */
- /* ObjC start actions.(actionScope).methods */
- /* ObjC end actions.(actionScope).methods */
- /* ObjC start methods() */
- /* ObjC end methods() */
- /* ObjC start rules */
- /*
- * $ANTLR start program
- * SimpleC.g:7:1: program : ( declaration )+ ;
- */
- - (void) program
- {
- /* my ruleScopeSetUp */
- /* Terence's stuff */
- @try {
- // SimpleC.g:8:5: ( ( declaration )+ ) // ruleBlockSingleAlt
- // SimpleC.g:8:9: ( declaration )+ // alt
- {
- // SimpleC.g:8:9: ( declaration )+ // positiveClosureBlock
- NSInteger cnt1 = 0;
- do {
- NSInteger alt1 = 2;
- NSInteger LA1_0 = [input LA:1];
- if ( (LA1_0==ID||LA1_0==15||(LA1_0 >= 17 && LA1_0 <= 18)) ) {
- alt1=1;
- }
- switch (alt1) {
- case 1 : ;
- // SimpleC.g:8:9: declaration // alt
- {
- /* ruleRef */
- [self pushFollow:FOLLOW_declaration_in_program28];
- [self declaration];
- [self popFollow];
- }
- break;
- default :
- if ( cnt1 >= 1 )
- goto loop1;
- ANTLREarlyExitException *eee =
- [ANTLREarlyExitException newException:input decisionNumber:1];
- @throw eee;
- }
- cnt1++;
- } while (YES);
- loop1: ;
- }
- // token+rule list labels
- }
- @catch (ANTLRRecognitionException *re) {
- [self reportError:re];
- [self recover:input Exception:re];
- }
- @finally {
- /* my stuff */
- /* Terence's stuff */
- }
- return ;
- }
- /* $ANTLR end program */
- /*
- * $ANTLR start declaration
- * SimpleC.g:20:1: declaration : ( variable | functionHeader ';' | functionHeader block );
- */
- - (void) declaration
- {
- /* my ruleScopeSetUp */
- /* Terence's stuff */
- @try {
- NSString * functionHeader1 = nil ;
-
- NSString * functionHeader2 = nil ;
-
- // SimpleC.g:21:5: ( variable | functionHeader ';' | functionHeader block ) //ruleblock
- NSInteger alt2=3;
- alt2 = [dfa2 predict:input];
- switch (alt2) {
- case 1 : ;
- // SimpleC.g:21:9: variable // alt
- {
- /* ruleRef */
- [self pushFollow:FOLLOW_variable_in_declaration50];
- [self variable];
- [self popFollow];
- }
- break;
- case 2 : ;
- // SimpleC.g:22:9: functionHeader ';' // alt
- {
- /* ruleRef */
- [self pushFollow:FOLLOW_functionHeader_in_declaration60];
- functionHeader1 = [self functionHeader];
- [self popFollow];
- [self match:input TokenType:11 Follow:FOLLOW_11_in_declaration62];
- NSLog(@"%@ is a declaration\n", functionHeader1
- );
- }
- break;
- case 3 : ;
- // SimpleC.g:24:9: functionHeader block // alt
- {
- /* ruleRef */
- [self pushFollow:FOLLOW_functionHeader_in_declaration75];
- functionHeader2 = [self functionHeader];
- [self popFollow];
- /* ruleRef */
- [self pushFollow:FOLLOW_block_in_declaration77];
- [self block];
- [self popFollow];
- NSLog(@"%@ is a definition\n", functionHeader2
- );
- }
- break;
- }
- // token+rule list labels
- }
- @catch (ANTLRRecognitionException *re) {
- [self reportError:re];
- [self recover:input Exception:re];
- }
- @finally {
- /* my stuff */
- /* Terence's stuff */
- }
- return ;
- }
- /* $ANTLR end declaration */
- /*
- * $ANTLR start variable
- * SimpleC.g:28:1: variable : type declarator ';' ;
- */
- - (void) variable
- {
- /* my ruleScopeSetUp */
- /* Terence's stuff */
- @try {
- // SimpleC.g:29:5: ( type declarator ';' ) // ruleBlockSingleAlt
- // SimpleC.g:29:9: type declarator ';' // alt
- {
- /* ruleRef */
- [self pushFollow:FOLLOW_type_in_variable99];
- [self type];
- [self popFollow];
- /* ruleRef */
- [self pushFollow:FOLLOW_declarator_in_variable101];
- [self declarator];
- [self popFollow];
- [self match:input TokenType:11 Follow:FOLLOW_11_in_variable103];
- }
- // token+rule list labels
- }
- @catch (ANTLRRecognitionException *re) {
- [self reportError:re];
- [self recover:input Exception:re];
- }
- @finally {
- /* my stuff */
- /* Terence's stuff */
- }
- return ;
- }
- /* $ANTLR end variable */
- /*
- * $ANTLR start declarator
- * SimpleC.g:32:1: declarator : ID ;
- */
- - (void) declarator
- {
- /* my ruleScopeSetUp */
- /* Terence's stuff */
- @try {
- // SimpleC.g:33:5: ( ID ) // ruleBlockSingleAlt
- // SimpleC.g:33:9: ID // alt
- {
- [self match:input TokenType:ID Follow:FOLLOW_ID_in_declarator122];
- }
- // token+rule list labels
- }
- @catch (ANTLRRecognitionException *re) {
- [self reportError:re];
- [self recover:input Exception:re];
- }
- @finally {
- /* my stuff */
- /* Terence's stuff */
- }
- return ;
- }
- /* $ANTLR end declarator */
- /*
- * $ANTLR start functionHeader
- * SimpleC.g:36:1: functionHeader returns [NSString *name] : type ID '(' ( formalParameter ( ',' formalParameter )* )? ')' ;
- */
- - (NSString *) functionHeader
- {
- /* my ruleScopeSetUp */
- /* Terence's stuff */
- NSString * name = nil ;
- name=nil; // for now you must init here rather than in 'returns'
- @try {
- ANTLRCommonToken *ID3 = nil;
- // SimpleC.g:40:5: ( type ID '(' ( formalParameter ( ',' formalParameter )* )? ')' ) // ruleBlockSingleAlt
- // SimpleC.g:40:9: type ID '(' ( formalParameter ( ',' formalParameter )* )? ')' // alt
- {
- /* ruleRef */
- [self pushFollow:FOLLOW_type_in_functionHeader151];
- [self type];
- [self popFollow];
- ID3=(ANTLRCommonToken *)[self match:input TokenType:ID Follow:FOLLOW_ID_in_functionHeader153];
- [self match:input TokenType:7 Follow:FOLLOW_7_in_functionHeader155];
- // SimpleC.g:40:21: ( formalParameter ( ',' formalParameter )* )? // block
- NSInteger alt4=2;
- NSInteger LA4_0 = [input LA:1];
- if ( (LA4_0==ID||LA4_0==15||(LA4_0 >= 17 && LA4_0 <= 18)) ) {
- alt4=1;
- }
- switch (alt4) {
- case 1 : ;
- // SimpleC.g:40:23: formalParameter ( ',' formalParameter )* // alt
- {
- /* ruleRef */
- [self pushFollow:FOLLOW_formalParameter_in_functionHeader159];
- [self formalParameter];
- [self popFollow];
- do {
- NSInteger alt3=2;
- NSInteger LA3_0 = [input LA:1];
- if ( (LA3_0==10) ) {
- alt3=1;
- }
- switch (alt3) {
- case 1 : ;
- // SimpleC.g:40:41: ',' formalParameter // alt
- {
- [self match:input TokenType:10 Follow:FOLLOW_10_in_functionHeader163];
- /* ruleRef */
- [self pushFollow:FOLLOW_formalParameter_in_functionHeader165];
- [self formalParameter];
- [self popFollow];
- }
- break;
- default :
- goto loop3;
- }
- } while (YES);
- loop3: ;
- }
- break;
- }
- [self match:input TokenType:8 Follow:FOLLOW_8_in_functionHeader173];
- name = (ID3!=nil?ID3.text:nil);
- }
- // token+rule list labels
- }
- @catch (ANTLRRecognitionException *re) {
- [self reportError:re];
- [self recover:input Exception:re];
- }
- @finally {
- /* my stuff */
- /* Terence's stuff */
- }
- return name;
- }
- /* $ANTLR end functionHeader */
- /*
- * $ANTLR start formalParameter
- * SimpleC.g:44:1: formalParameter : type declarator ;
- */
- - (void) formalParameter
- {
- /* my ruleScopeSetUp */
- /* Terence's stuff */
- @try {
- // SimpleC.g:45:5: ( type declarator ) // ruleBlockSingleAlt
- // SimpleC.g:45:9: type declarator // alt
- {
- /* ruleRef */
- [self pushFollow:FOLLOW_type_in_formalParameter195];
- [self type];
- [self popFollow];
- /* ruleRef */
- [self pushFollow:FOLLOW_declarator_in_formalParameter197];
- [self declarator];
- [self popFollow];
- }
- // token+rule list labels
- }
- @catch (ANTLRRecognitionException *re) {
- [self reportError:re];
- [self recover:input Exception:re];
- }
- @finally {
- /* my stuff */
- /* Terence's stuff */
- }
- return ;
- }
- /* $ANTLR end formalParameter */
- /*
- * $ANTLR start type
- * SimpleC.g:48:1: type : ( 'int' | 'char' | 'void' | ID );
- */
- - (void) type
- {
- /* my ruleScopeSetUp */
- /* Terence's stuff */
- @try {
- // SimpleC.g:49:5: ( 'int' | 'char' | 'void' | ID ) // ruleBlockSingleAlt
- // SimpleC.g: // alt
- {
- if ([input LA:1] == ID||[input LA:1] == 15||(([input LA:1] >= 17) && ([input LA:1] <= 18))) {
- [input consume];
- [state setIsErrorRecovery:NO];
- } else {
- ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException newException:nil stream:input];
- @throw mse;
- }
- }
- // token+rule list labels
- }
- @catch (ANTLRRecognitionException *re) {
- [self reportError:re];
- [self recover:input Exception:re];
- }
- @finally {
- /* my stuff */
- /* Terence's stuff */
- }
- return ;
- }
- /* $ANTLR end type */
- /*
- * $ANTLR start block
- * SimpleC.g:55:1: block : '{' ( variable )* ( stat )* '}' ;
- */
- - (void) block
- {
- /* my ruleScopeSetUp */
- /* Terence's stuff */
- @try {
- // SimpleC.g:56:5: ( '{' ( variable )* ( stat )* '}' ) // ruleBlockSingleAlt
- // SimpleC.g:56:9: '{' ( variable )* ( stat )* '}' // alt
- {
- [self match:input TokenType:19 Follow:FOLLOW_19_in_block286];
- do {
- NSInteger alt5=2;
- NSInteger LA5_0 = [input LA:1];
- if ( (LA5_0==ID) ) {
- NSInteger LA5_2 = [input LA:2];
- if ( (LA5_2==ID) ) {
- alt5=1;
- }
- }
- else if ( (LA5_0==15||(LA5_0 >= 17 && LA5_0 <= 18)) ) {
- alt5=1;
- }
- switch (alt5) {
- case 1 : ;
- // SimpleC.g:57:13: variable // alt
- {
- /* ruleRef */
- [self pushFollow:FOLLOW_variable_in_block300];
- [self variable];
- [self popFollow];
- }
- break;
- default :
- goto loop5;
- }
- } while (YES);
- loop5: ;
- do {
- NSInteger alt6=2;
- NSInteger LA6_0 = [input LA:1];
- if ( ((LA6_0 >= ID && LA6_0 <= INT)||LA6_0==7||LA6_0==11||LA6_0==16||LA6_0==19) ) {
- alt6=1;
- }
- switch (alt6) {
- case 1 : ;
- // SimpleC.g:58:13: stat // alt
- {
- /* ruleRef */
- [self pushFollow:FOLLOW_stat_in_block315];
- [self stat];
- [self popFollow];
- }
- break;
- default :
- goto loop6;
- }
- } while (YES);
- loop6: ;
- [self match:input TokenType:20 Follow:FOLLOW_20_in_block326];
- }
- // token+rule list labels
- }
- @catch (ANTLRRecognitionException *re) {
- [self reportError:re];
- [self recover:input Exception:re];
- }
- @finally {
- /* my stuff */
- /* Terence's stuff */
- }
- return ;
- }
- /* $ANTLR end block */
- /*
- * $ANTLR start stat
- * SimpleC.g:62:1: stat : ( forStat | expr ';' | block | assignStat ';' | ';' );
- */
- - (void) stat
- {
- /* my ruleScopeSetUp */
- /* Terence's stuff */
- @try {
- // SimpleC.g:62:5: ( forStat | expr ';' | block | assignStat ';' | ';' ) //ruleblock
- NSInteger alt7=5;
- unichar charLA7 = [input LA:1];
- switch (charLA7) {
- case 16: ;
- {
- alt7=1;
- }
- break;
- case ID: ;
- {
- NSInteger LA7_2 = [input LA:2];
- if ( (LA7_2==13) ) {
- alt7=4;
- }
- else if ( (LA7_2==9||(LA7_2 >= 11 && LA7_2 <= 12)||LA7_2==14) ) {
- alt7=2;
- }
- else {
- ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:7 state:2 stream:input];
- nvae.c = LA7_2;
- @throw nvae;
- }
- }
- break;
- case INT: ;
- case 7: ;
- {
- alt7=2;
- }
- break;
- case 19: ;
- {
- alt7=3;
- }
- break;
- case 11: ;
- {
- alt7=5;
- }
- break;
- default: ;
- ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:7 state:0 stream:input];
- nvae.c = charLA7;
- @throw nvae;
- }
- switch (alt7) {
- case 1 : ;
- // SimpleC.g:62:7: forStat // alt
- {
- /* ruleRef */
- [self pushFollow:FOLLOW_forStat_in_stat338];
- [self forStat];
- [self popFollow];
- }
- break;
- case 2 : ;
- // SimpleC.g:63:7: expr ';' // alt
- {
- /* ruleRef */
- [self pushFollow:FOLLOW_expr_in_stat346];
- [self expr];
- [self popFollow];
- [self match:input TokenType:11 Follow:FOLLOW_11_in_stat348];
- }
- break;
- case 3 : ;
- // SimpleC.g:64:7: block // alt
- {
- /* ruleRef */
- [self pushFollow:FOLLOW_block_in_stat362];
- [self block];
- [self popFollow];
- }
- break;
- case 4 : ;
- // SimpleC.g:65:7: assignStat ';' // alt
- {
- /* ruleRef */
- [self pushFollow:FOLLOW_assignStat_in_stat370];
- [self assignStat];
- [self popFollow];
- [self match:input TokenType:11 Follow:FOLLOW_11_in_stat372];
- }
- break;
- case 5 : ;
- // SimpleC.g:66:7: ';' // alt
- {
- [self match:input TokenType:11 Follow:FOLLOW_11_in_stat380];
- }
- break;
- }
- // token+rule list labels
- }
- @catch (ANTLRRecognitionException *re) {
- [self reportError:re];
- [self recover:input Exception:re];
- }
- @finally {
- /* my stuff */
- /* Terence's stuff */
- }
- return ;
- }
- /* $ANTLR end stat */
- /*
- * $ANTLR start forStat
- * SimpleC.g:69:1: forStat : 'for' '(' assignStat ';' expr ';' assignStat ')' block ;
- */
- - (void) forStat
- {
- /* my ruleScopeSetUp */
- /* Terence's stuff */
- @try {
- // SimpleC.g:70:5: ( 'for' '(' assignStat ';' expr ';' assignStat ')' block ) // ruleBlockSingleAlt
- // SimpleC.g:70:9: 'for' '(' assignStat ';' expr ';' assignStat ')' block // alt
- {
- [self match:input TokenType:16 Follow:FOLLOW_16_in_forStat399];
- [self match:input TokenType:7 Follow:FOLLOW_7_in_forStat401];
- /* ruleRef */
- [self pushFollow:FOLLOW_assignStat_in_forStat403];
- [self assignStat];
- [self popFollow];
- [self match:input TokenType:11 Follow:FOLLOW_11_in_forStat405];
- /* ruleRef */
- [self pushFollow:FOLLOW_expr_in_forStat407];
- [self expr];
- [self popFollow];
- [self match:input TokenType:11 Follow:FOLLOW_11_in_forStat409];
- /* ruleRef */
- [self pushFollow:FOLLOW_assignStat_in_forStat411];
- [self assignStat];
- [self popFollow];
- [self match:input TokenType:8 Follow:FOLLOW_8_in_forStat413];
- /* ruleRef */
- [self pushFollow:FOLLOW_block_in_forStat415];
- [self block];
- [self popFollow];
- }
- // token+rule list labels
- }
- @catch (ANTLRRecognitionException *re) {
- [self reportError:re];
- [self recover:input Exception:re];
- }
- @finally {
- /* my stuff */
- /* Terence's stuff */
- }
- return ;
- }
- /* $ANTLR end forStat */
- /*
- * $ANTLR start assignStat
- * SimpleC.g:73:1: assignStat : ID '=' expr ;
- */
- - (void) assignStat
- {
- /* my ruleScopeSetUp */
- /* Terence's stuff */
- @try {
- // SimpleC.g:74:5: ( ID '=' expr ) // ruleBlockSingleAlt
- // SimpleC.g:74:9: ID '=' expr // alt
- {
- [self match:input TokenType:ID Follow:FOLLOW_ID_in_assignStat442];
- [self match:input TokenType:13 Follow:FOLLOW_13_in_assignStat444];
- /* ruleRef */
- [self pushFollow:FOLLOW_expr_in_assignStat446];
- [self expr];
- [self popFollow];
- }
- // token+rule list labels
- }
- @catch (ANTLRRecognitionException *re) {
- [self reportError:re];
- [self recover:input Exception:re];
- }
- @finally {
- /* my stuff */
- /* Terence's stuff */
- }
- return ;
- }
- /* $ANTLR end assignStat */
- /*
- * $ANTLR start expr
- * SimpleC.g:77:1: expr : condExpr ;
- */
- - (void) expr
- {
- /* my ruleScopeSetUp */
- /* Terence's stuff */
- @try {
- // SimpleC.g:77:5: ( condExpr ) // ruleBlockSingleAlt
- // SimpleC.g:77:9: condExpr // alt
- {
- /* ruleRef */
- [self pushFollow:FOLLOW_condExpr_in_expr468];
- [self condExpr];
- [self popFollow];
- }
- // token+rule list labels
- }
- @catch (ANTLRRecognitionException *re) {
- [self reportError:re];
- [self recover:input Exception:re];
- }
- @finally {
- /* my stuff */
- /* Terence's stuff */
- }
- return ;
- }
- /* $ANTLR end expr */
- /*
- * $ANTLR start condExpr
- * SimpleC.g:80:1: condExpr : aexpr ( ( '==' | '<' ) aexpr )? ;
- */
- - (void) condExpr
- {
- /* my ruleScopeSetUp */
- /* Terence's stuff */
- @try {
- // SimpleC.g:81:5: ( aexpr ( ( '==' | '<' ) aexpr )? ) // ruleBlockSingleAlt
- // SimpleC.g:81:9: aexpr ( ( '==' | '<' ) aexpr )? // alt
- {
- /* ruleRef */
- [self pushFollow:FOLLOW_aexpr_in_condExpr487];
- [self aexpr];
- [self popFollow];
- // SimpleC.g:81:15: ( ( '==' | '<' ) aexpr )? // block
- NSInteger alt8=2;
- NSInteger LA8_0 = [input LA:1];
- if ( (LA8_0==12||LA8_0==14) ) {
- alt8=1;
- }
- switch (alt8) {
- case 1 : ;
- // SimpleC.g:81:17: ( '==' | '<' ) aexpr // alt
- {
- if ([input LA:1] == 12||[input LA:1] == 14) {
- [input consume];
- [state setIsErrorRecovery:NO];
- } else {
- ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException newException:nil stream:input];
- @throw mse;
- }
- /* ruleRef */
- [self pushFollow:FOLLOW_aexpr_in_condExpr499];
- [self aexpr];
- [self popFollow];
- }
- break;
- }
- }
- // token+rule list labels
- }
- @catch (ANTLRRecognitionException *re) {
- [self reportError:re];
- [self recover:input Exception:re];
- }
- @finally {
- /* my stuff */
- /* Terence's stuff */
- }
- return ;
- }
- /* $ANTLR end condExpr */
- /*
- * $ANTLR start aexpr
- * SimpleC.g:84:1: aexpr : atom ( '+' atom )* ;
- */
- - (void) aexpr
- {
- /* my ruleScopeSetUp */
- /* Terence's stuff */
- @try {
- // SimpleC.g:85:5: ( atom ( '+' atom )* ) // ruleBlockSingleAlt
- // SimpleC.g:85:9: atom ( '+' atom )* // alt
- {
- /* ruleRef */
- [self pushFollow:FOLLOW_atom_in_aexpr521];
- [self atom];
- [self popFollow];
- do {
- NSInteger alt9=2;
- NSInteger LA9_0 = [input LA:1];
- if ( (LA9_0==9) ) {
- alt9=1;
- }
- switch (alt9) {
- case 1 : ;
- // SimpleC.g:85:16: '+' atom // alt
- {
- [self match:input TokenType:9 Follow:FOLLOW_9_in_aexpr525];
- /* ruleRef */
- [self pushFollow:FOLLOW_atom_in_aexpr527];
- [self atom];
- [self popFollow];
- }
- break;
- default :
- goto loop9;
- }
- } while (YES);
- loop9: ;
- }
- // token+rule list labels
- }
- @catch (ANTLRRecognitionException *re) {
- [self reportError:re];
- [self recover:input Exception:re];
- }
- @finally {
- /* my stuff */
- /* Terence's stuff */
- }
- return ;
- }
- /* $ANTLR end aexpr */
- /*
- * $ANTLR start atom
- * SimpleC.g:88:1: atom : ( ID | INT | '(' expr ')' );
- */
- - (void) atom
- {
- /* my ruleScopeSetUp */
- /* Terence's stuff */
- @try {
- // SimpleC.g:89:5: ( ID | INT | '(' expr ')' ) //ruleblock
- NSInteger alt10=3;
- unichar charLA10 = [input LA:1];
- switch (charLA10) {
- case ID: ;
- {
- alt10=1;
- }
- break;
- case INT: ;
- {
- alt10=2;
- }
- break;
- case 7: ;
- {
- alt10=3;
- }
- break;
- default: ;
- ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:10 state:0 stream:input];
- nvae.c = charLA10;
- @throw nvae;
- }
- switch (alt10) {
- case 1 : ;
- // SimpleC.g:89:7: ID // alt
- {
- [self match:input TokenType:ID Follow:FOLLOW_ID_in_atom547];
- }
- break;
- case 2 : ;
- // SimpleC.g:90:7: INT // alt
- {
- [self match:input TokenType:INT Follow:FOLLOW_INT_in_atom561];
- }
- break;
- case 3 : ;
- // SimpleC.g:91:7: '(' expr ')' // alt
- {
- [self match:input TokenType:7 Follow:FOLLOW_7_in_atom575];
- /* ruleRef */
- [self pushFollow:FOLLOW_expr_in_atom577];
- [self expr];
- [self popFollow];
- [self match:input TokenType:8 Follow:FOLLOW_8_in_atom579];
- }
- break;
- }
- // token+rule list labels
- }
- @catch (ANTLRRecognitionException *re) {
- [self reportError:re];
- [self recover:input Exception:re];
- }
- @finally {
- /* my stuff */
- /* Terence's stuff */
- }
- return ;
- }
- /* $ANTLR end atom */
- /* ObjC end rules */
- @end /* end of SimpleCParser implementation line 692 */