/** \file * This OBJC source file was generated by $ANTLR version 3.2 Aug 23, 2010 07:48:06 * * - From the grammar source file : /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g * - On : 2010-08-23 07:54:46 * - 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. * * */ // [The "BSD licence"] // Copyright (c) 2010 Alan Condit // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // 3. The name of the author may not be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ANTLR 3.2 Aug 23, 2010 07:48:06 /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g 2010-08-23 07:54:46 /* ----------------------------------------- * 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] = {10,10,21,10,0,10,21,23,0,0,10,10,23}; const static unichar dfa2_max[13] = {13,10,22,24,0,10,25,24,0,0,13,10,24}; const static NSInteger dfa2_accept[13] = {-1,-1,-1,-1,1,-1,-1,-1,3,2,-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[] = {9, -1, -1, -1, 8}; const static NSInteger dfa2_transition1[] = {10, 6}; const static NSInteger dfa2_transition2[] = {5, 5, 5, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6}; const static NSInteger dfa2_transition3[] = {11, 11, 11, 11}; const static NSInteger dfa2_transition4[] = {4, 3}; const static NSInteger dfa2_transition5[] = {1, 1, 1, 1}; const static NSInteger dfa2_transition6[] = {7}; const static NSInteger dfa2_transition7[] = {12}; const static NSInteger dfa2_transition8[] = {2}; + () newDFA2WithRecognizer:(ANTLRBaseRecognizer *)aRecognizer { return [[[DFA2 alloc] initWithRecognizer:aRecognizer] retain]; } - (id) initWithRecognizer:(ANTLRBaseRecognizer *) theRecognizer { if ((self = [super initWithRecognizer:theRecognizer]) != 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_transition5; transition[1] = dfa2_transition8; transition[2] = dfa2_transition4; transition[3] = dfa2_transition2; transition[4] = dfa2_transition; transition[5] = dfa2_transition6; transition[6] = dfa2_transition0; transition[7] = dfa2_transition1; transition[8] = dfa2_transition; transition[9] = dfa2_transition; transition[10] = dfa2_transition3; transition[11] = dfa2_transition7; transition[12] = dfa2_transition1; } return self; } - (void) dealloc { free(transition); [super dealloc]; } - (NSString *) description { return @"20:1: declaration : ( variable | functionHeader ';' -> ^( FUNC_DECL functionHeader ) | functionHeader block -> ^( FUNC_DEF functionHeader block ) );"; } @end /* end DFA2 implementation */ #pragma mark Cyclic DFA implementation end DFA2 #pragma mark Bitsets static ANTLRBitSet *FOLLOW_declaration_in_program85; static const unsigned long long FOLLOW_declaration_in_program85_data[] = { 0x0000000000003C02LL}; static ANTLRBitSet *FOLLOW_variable_in_declaration105; static const unsigned long long FOLLOW_variable_in_declaration105_data[] = { 0x0000000000000002LL}; static ANTLRBitSet *FOLLOW_functionHeader_in_declaration115; static const unsigned long long FOLLOW_functionHeader_in_declaration115_data[] = { 0x0000000000200000LL}; static ANTLRBitSet *FOLLOW_21_in_declaration117; static const unsigned long long FOLLOW_21_in_declaration117_data[] = { 0x0000000000000002LL}; static ANTLRBitSet *FOLLOW_functionHeader_in_declaration135; static const unsigned long long FOLLOW_functionHeader_in_declaration135_data[] = { 0x0000000002000000LL}; static ANTLRBitSet *FOLLOW_block_in_declaration137; static const unsigned long long FOLLOW_block_in_declaration137_data[] = { 0x0000000000000002LL}; static ANTLRBitSet *FOLLOW_type_in_variable166; static const unsigned long long FOLLOW_type_in_variable166_data[] = { 0x0000000000000400LL}; static ANTLRBitSet *FOLLOW_declarator_in_variable168; static const unsigned long long FOLLOW_declarator_in_variable168_data[] = { 0x0000000000200000LL}; static ANTLRBitSet *FOLLOW_21_in_variable170; static const unsigned long long FOLLOW_21_in_variable170_data[] = { 0x0000000000000002LL}; static ANTLRBitSet *FOLLOW_K_ID_in_declarator199; static const unsigned long long FOLLOW_K_ID_in_declarator199_data[] = { 0x0000000000000002LL}; static ANTLRBitSet *FOLLOW_type_in_functionHeader219; static const unsigned long long FOLLOW_type_in_functionHeader219_data[] = { 0x0000000000000400LL}; static ANTLRBitSet *FOLLOW_K_ID_in_functionHeader221; static const unsigned long long FOLLOW_K_ID_in_functionHeader221_data[] = { 0x0000000000400000LL}; static ANTLRBitSet *FOLLOW_22_in_functionHeader223; static const unsigned long long FOLLOW_22_in_functionHeader223_data[] = { 0x0000000001003C00LL}; static ANTLRBitSet *FOLLOW_formalParameter_in_functionHeader227; static const unsigned long long FOLLOW_formalParameter_in_functionHeader227_data[] = { 0x0000000001800000LL}; static ANTLRBitSet *FOLLOW_23_in_functionHeader231; static const unsigned long long FOLLOW_23_in_functionHeader231_data[] = { 0x0000000000003C00LL}; static ANTLRBitSet *FOLLOW_formalParameter_in_functionHeader233; static const unsigned long long FOLLOW_formalParameter_in_functionHeader233_data[] = { 0x0000000001800000LL}; static ANTLRBitSet *FOLLOW_24_in_functionHeader241; static const unsigned long long FOLLOW_24_in_functionHeader241_data[] = { 0x0000000000000002LL}; static ANTLRBitSet *FOLLOW_type_in_formalParameter281; static const unsigned long long FOLLOW_type_in_formalParameter281_data[] = { 0x0000000000000400LL}; static ANTLRBitSet *FOLLOW_declarator_in_formalParameter283; static const unsigned long long FOLLOW_declarator_in_formalParameter283_data[] = { 0x0000000000000002LL}; static ANTLRBitSet *FOLLOW_set_in_type0; static const unsigned long long FOLLOW_set_in_type0_data[] = { 0x0000000000000002LL}; static ANTLRBitSet *FOLLOW_25_in_block376; static const unsigned long long FOLLOW_25_in_block376_data[] = { 0x0000000006607C00LL}; static ANTLRBitSet *FOLLOW_variable_in_block390; static const unsigned long long FOLLOW_variable_in_block390_data[] = { 0x0000000006607C00LL}; static ANTLRBitSet *FOLLOW_stat_in_block405; static const unsigned long long FOLLOW_stat_in_block405_data[] = { 0x0000000006604C00LL}; static ANTLRBitSet *FOLLOW_26_in_block416; static const unsigned long long FOLLOW_26_in_block416_data[] = { 0x0000000000000002LL}; static ANTLRBitSet *FOLLOW_forStat_in_stat449; static const unsigned long long FOLLOW_forStat_in_stat449_data[] = { 0x0000000000000002LL}; static ANTLRBitSet *FOLLOW_expr_in_stat457; static const unsigned long long FOLLOW_expr_in_stat457_data[] = { 0x0000000000200000LL}; static ANTLRBitSet *FOLLOW_21_in_stat459; static const unsigned long long FOLLOW_21_in_stat459_data[] = { 0x0000000000000002LL}; static ANTLRBitSet *FOLLOW_block_in_stat468; static const unsigned long long FOLLOW_block_in_stat468_data[] = { 0x0000000000000002LL}; static ANTLRBitSet *FOLLOW_assignStat_in_stat476; static const unsigned long long FOLLOW_assignStat_in_stat476_data[] = { 0x0000000000200000LL}; static ANTLRBitSet *FOLLOW_21_in_stat478; static const unsigned long long FOLLOW_21_in_stat478_data[] = { 0x0000000000000002LL}; static ANTLRBitSet *FOLLOW_21_in_stat487; static const unsigned long long FOLLOW_21_in_stat487_data[] = { 0x0000000000000002LL}; static ANTLRBitSet *FOLLOW_K_FOR_in_forStat507; static const unsigned long long FOLLOW_K_FOR_in_forStat507_data[] = { 0x0000000000400000LL}; static ANTLRBitSet *FOLLOW_22_in_forStat509; static const unsigned long long FOLLOW_22_in_forStat509_data[] = { 0x0000000000000400LL}; static ANTLRBitSet *FOLLOW_assignStat_in_forStat513; static const unsigned long long FOLLOW_assignStat_in_forStat513_data[] = { 0x0000000000200000LL}; static ANTLRBitSet *FOLLOW_21_in_forStat515; static const unsigned long long FOLLOW_21_in_forStat515_data[] = { 0x0000000000400C00LL}; static ANTLRBitSet *FOLLOW_expr_in_forStat517; static const unsigned long long FOLLOW_expr_in_forStat517_data[] = { 0x0000000000200000LL}; static ANTLRBitSet *FOLLOW_21_in_forStat519; static const unsigned long long FOLLOW_21_in_forStat519_data[] = { 0x0000000000000400LL}; static ANTLRBitSet *FOLLOW_assignStat_in_forStat523; static const unsigned long long FOLLOW_assignStat_in_forStat523_data[] = { 0x0000000001000000LL}; static ANTLRBitSet *FOLLOW_24_in_forStat525; static const unsigned long long FOLLOW_24_in_forStat525_data[] = { 0x0000000002000000LL}; static ANTLRBitSet *FOLLOW_block_in_forStat527; static const unsigned long long FOLLOW_block_in_forStat527_data[] = { 0x0000000000000002LL}; static ANTLRBitSet *FOLLOW_K_ID_in_assignStat570; static const unsigned long long FOLLOW_K_ID_in_assignStat570_data[] = { 0x0000000000008000LL}; static ANTLRBitSet *FOLLOW_K_EQ_in_assignStat572; static const unsigned long long FOLLOW_K_EQ_in_assignStat572_data[] = { 0x0000000000400C00LL}; static ANTLRBitSet *FOLLOW_expr_in_assignStat574; static const unsigned long long FOLLOW_expr_in_assignStat574_data[] = { 0x0000000000000002LL}; static ANTLRBitSet *FOLLOW_condExpr_in_expr598; static const unsigned long long FOLLOW_condExpr_in_expr598_data[] = { 0x0000000000000002LL}; static ANTLRBitSet *FOLLOW_aexpr_in_condExpr617; static const unsigned long long FOLLOW_aexpr_in_condExpr617_data[] = { 0x0000000000030002LL}; static ANTLRBitSet *FOLLOW_K_EQEQ_in_condExpr622; static const unsigned long long FOLLOW_K_EQEQ_in_condExpr622_data[] = { 0x0000000000400C00LL}; static ANTLRBitSet *FOLLOW_K_LT_in_condExpr627; static const unsigned long long FOLLOW_K_LT_in_condExpr627_data[] = { 0x0000000000400C00LL}; static ANTLRBitSet *FOLLOW_aexpr_in_condExpr631; static const unsigned long long FOLLOW_aexpr_in_condExpr631_data[] = { 0x0000000000000002LL}; static ANTLRBitSet *FOLLOW_atom_in_aexpr653; static const unsigned long long FOLLOW_atom_in_aexpr653_data[] = { 0x0000000000040002LL}; static ANTLRBitSet *FOLLOW_K_PLUS_in_aexpr657; static const unsigned long long FOLLOW_K_PLUS_in_aexpr657_data[] = { 0x0000000000400C00LL}; static ANTLRBitSet *FOLLOW_atom_in_aexpr660; static const unsigned long long FOLLOW_atom_in_aexpr660_data[] = { 0x0000000000040002LL}; static ANTLRBitSet *FOLLOW_K_ID_in_atom680; static const unsigned long long FOLLOW_K_ID_in_atom680_data[] = { 0x0000000000000002LL}; static ANTLRBitSet *FOLLOW_K_INT_in_atom694; static const unsigned long long FOLLOW_K_INT_in_atom694_data[] = { 0x0000000000000002LL}; static ANTLRBitSet *FOLLOW_22_in_atom708; static const unsigned long long FOLLOW_22_in_atom708_data[] = { 0x0000000000400C00LL}; static ANTLRBitSet *FOLLOW_expr_in_atom710; static const unsigned long long FOLLOW_expr_in_atom710_data[] = { 0x0000000001000000LL}; static ANTLRBitSet *FOLLOW_24_in_atom712; static const unsigned long long FOLLOW_24_in_atom712_data[] = { 0x0000000000000002LL}; #pragma mark Dynamic Global Scopes #pragma mark Dynamic Rule Scopes #pragma mark Rule return scopes start @implementation SimpleCParser_program_return + (SimpleCParser_program_return *)newSimpleCParser_program_return { return [[[SimpleCParser_program_return alloc] init] retain]; } /* AST returnScope.methods */ - (ANTLRCommonTree *)getTree { return tree; } - (void) setTree:(ANTLRCommonTree *)aTree { if (tree != aTree) { if (tree != nil) [tree release]; if (aTree != nil) [aTree retain]; tree = aTree; } } - (void) dealloc { [self setTree:nil]; [super dealloc]; } @end /* end of returnScope implementation */ @implementation SimpleCParser_declaration_return + (SimpleCParser_declaration_return *)newSimpleCParser_declaration_return { return [[[SimpleCParser_declaration_return alloc] init] retain]; } /* AST returnScope.methods */ - (ANTLRCommonTree *)getTree { return tree; } - (void) setTree:(ANTLRCommonTree *)aTree { if (tree != aTree) { if (tree != nil) [tree release]; if (aTree != nil) [aTree retain]; tree = aTree; } } - (void) dealloc { [self setTree:nil]; [super dealloc]; } @end /* end of returnScope implementation */ @implementation SimpleCParser_variable_return + (SimpleCParser_variable_return *)newSimpleCParser_variable_return { return [[[SimpleCParser_variable_return alloc] init] retain]; } /* AST returnScope.methods */ - (ANTLRCommonTree *)getTree { return tree; } - (void) setTree:(ANTLRCommonTree *)aTree { if (tree != aTree) { if (tree != nil) [tree release]; if (aTree != nil) [aTree retain]; tree = aTree; } } - (void) dealloc { [self setTree:nil]; [super dealloc]; } @end /* end of returnScope implementation */ @implementation SimpleCParser_declarator_return + (SimpleCParser_declarator_return *)newSimpleCParser_declarator_return { return [[[SimpleCParser_declarator_return alloc] init] retain]; } /* AST returnScope.methods */ - (ANTLRCommonTree *)getTree { return tree; } - (void) setTree:(ANTLRCommonTree *)aTree { if (tree != aTree) { if (tree != nil) [tree release]; if (aTree != nil) [aTree retain]; tree = aTree; } } - (void) dealloc { [self setTree:nil]; [super dealloc]; } @end /* end of returnScope implementation */ @implementation SimpleCParser_functionHeader_return + (SimpleCParser_functionHeader_return *)newSimpleCParser_functionHeader_return { return [[[SimpleCParser_functionHeader_return alloc] init] retain]; } /* AST returnScope.methods */ - (ANTLRCommonTree *)getTree { return tree; } - (void) setTree:(ANTLRCommonTree *)aTree { if (tree != aTree) { if (tree != nil) [tree release]; if (aTree != nil) [aTree retain]; tree = aTree; } } - (void) dealloc { [self setTree:nil]; [super dealloc]; } @end /* end of returnScope implementation */ @implementation SimpleCParser_formalParameter_return + (SimpleCParser_formalParameter_return *)newSimpleCParser_formalParameter_return { return [[[SimpleCParser_formalParameter_return alloc] init] retain]; } /* AST returnScope.methods */ - (ANTLRCommonTree *)getTree { return tree; } - (void) setTree:(ANTLRCommonTree *)aTree { if (tree != aTree) { if (tree != nil) [tree release]; if (aTree != nil) [aTree retain]; tree = aTree; } } - (void) dealloc { [self setTree:nil]; [super dealloc]; } @end /* end of returnScope implementation */ @implementation SimpleCParser_type_return + (SimpleCParser_type_return *)newSimpleCParser_type_return { return [[[SimpleCParser_type_return alloc] init] retain]; } /* AST returnScope.methods */ - (ANTLRCommonTree *)getTree { return tree; } - (void) setTree:(ANTLRCommonTree *)aTree { if (tree != aTree) { if (tree != nil) [tree release]; if (aTree != nil) [aTree retain]; tree = aTree; } } - (void) dealloc { [self setTree:nil]; [super dealloc]; } @end /* end of returnScope implementation */ @implementation SimpleCParser_block_return + (SimpleCParser_block_return *)newSimpleCParser_block_return { return [[[SimpleCParser_block_return alloc] init] retain]; } /* AST returnScope.methods */ - (ANTLRCommonTree *)getTree { return tree; } - (void) setTree:(ANTLRCommonTree *)aTree { if (tree != aTree) { if (tree != nil) [tree release]; if (aTree != nil) [aTree retain]; tree = aTree; } } - (void) dealloc { [self setTree:nil]; [super dealloc]; } @end /* end of returnScope implementation */ @implementation SimpleCParser_stat_return + (SimpleCParser_stat_return *)newSimpleCParser_stat_return { return [[[SimpleCParser_stat_return alloc] init] retain]; } /* AST returnScope.methods */ - (ANTLRCommonTree *)getTree { return tree; } - (void) setTree:(ANTLRCommonTree *)aTree { if (tree != aTree) { if (tree != nil) [tree release]; if (aTree != nil) [aTree retain]; tree = aTree; } } - (void) dealloc { [self setTree:nil]; [super dealloc]; } @end /* end of returnScope implementation */ @implementation SimpleCParser_forStat_return + (SimpleCParser_forStat_return *)newSimpleCParser_forStat_return { return [[[SimpleCParser_forStat_return alloc] init] retain]; } /* AST returnScope.methods */ - (ANTLRCommonTree *)getTree { return tree; } - (void) setTree:(ANTLRCommonTree *)aTree { if (tree != aTree) { if (tree != nil) [tree release]; if (aTree != nil) [aTree retain]; tree = aTree; } } - (void) dealloc { [self setTree:nil]; [super dealloc]; } @end /* end of returnScope implementation */ @implementation SimpleCParser_assignStat_return + (SimpleCParser_assignStat_return *)newSimpleCParser_assignStat_return { return [[[SimpleCParser_assignStat_return alloc] init] retain]; } /* AST returnScope.methods */ - (ANTLRCommonTree *)getTree { return tree; } - (void) setTree:(ANTLRCommonTree *)aTree { if (tree != aTree) { if (tree != nil) [tree release]; if (aTree != nil) [aTree retain]; tree = aTree; } } - (void) dealloc { [self setTree:nil]; [super dealloc]; } @end /* end of returnScope implementation */ @implementation SimpleCParser_expr_return + (SimpleCParser_expr_return *)newSimpleCParser_expr_return { return [[[SimpleCParser_expr_return alloc] init] retain]; } /* AST returnScope.methods */ - (ANTLRCommonTree *)getTree { return tree; } - (void) setTree:(ANTLRCommonTree *)aTree { if (tree != aTree) { if (tree != nil) [tree release]; if (aTree != nil) [aTree retain]; tree = aTree; } } - (void) dealloc { [self setTree:nil]; [super dealloc]; } @end /* end of returnScope implementation */ @implementation SimpleCParser_condExpr_return + (SimpleCParser_condExpr_return *)newSimpleCParser_condExpr_return { return [[[SimpleCParser_condExpr_return alloc] init] retain]; } /* AST returnScope.methods */ - (ANTLRCommonTree *)getTree { return tree; } - (void) setTree:(ANTLRCommonTree *)aTree { if (tree != aTree) { if (tree != nil) [tree release]; if (aTree != nil) [aTree retain]; tree = aTree; } } - (void) dealloc { [self setTree:nil]; [super dealloc]; } @end /* end of returnScope implementation */ @implementation SimpleCParser_aexpr_return + (SimpleCParser_aexpr_return *)newSimpleCParser_aexpr_return { return [[[SimpleCParser_aexpr_return alloc] init] retain]; } /* AST returnScope.methods */ - (ANTLRCommonTree *)getTree { return tree; } - (void) setTree:(ANTLRCommonTree *)aTree { if (tree != aTree) { if (tree != nil) [tree release]; if (aTree != nil) [aTree retain]; tree = aTree; } } - (void) dealloc { [self setTree:nil]; [super dealloc]; } @end /* end of returnScope implementation */ @implementation SimpleCParser_atom_return + (SimpleCParser_atom_return *)newSimpleCParser_atom_return { return [[[SimpleCParser_atom_return alloc] init] retain]; } /* AST returnScope.methods */ - (ANTLRCommonTree *)getTree { return tree; } - (void) setTree:(ANTLRCommonTree *)aTree { if (tree != aTree) { if (tree != nil) [tree release]; if (aTree != nil) [aTree retain]; tree = aTree; } } - (void) dealloc { [self setTree:nil]; [super dealloc]; } @end /* end of returnScope implementation */ @implementation SimpleCParser // line 610 + (void) initialize { #pragma mark Bitsets FOLLOW_declaration_in_program85 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_declaration_in_program85_data Count:(NSUInteger)1] retain]; FOLLOW_variable_in_declaration105 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_variable_in_declaration105_data Count:(NSUInteger)1] retain]; FOLLOW_functionHeader_in_declaration115 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_functionHeader_in_declaration115_data Count:(NSUInteger)1] retain]; FOLLOW_21_in_declaration117 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_21_in_declaration117_data Count:(NSUInteger)1] retain]; FOLLOW_functionHeader_in_declaration135 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_functionHeader_in_declaration135_data Count:(NSUInteger)1] retain]; FOLLOW_block_in_declaration137 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_declaration137_data Count:(NSUInteger)1] retain]; FOLLOW_type_in_variable166 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_variable166_data Count:(NSUInteger)1] retain]; FOLLOW_declarator_in_variable168 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_variable168_data Count:(NSUInteger)1] retain]; FOLLOW_21_in_variable170 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_21_in_variable170_data Count:(NSUInteger)1] retain]; FOLLOW_K_ID_in_declarator199 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_ID_in_declarator199_data Count:(NSUInteger)1] retain]; FOLLOW_type_in_functionHeader219 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_functionHeader219_data Count:(NSUInteger)1] retain]; FOLLOW_K_ID_in_functionHeader221 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_ID_in_functionHeader221_data Count:(NSUInteger)1] retain]; FOLLOW_22_in_functionHeader223 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_22_in_functionHeader223_data Count:(NSUInteger)1] retain]; FOLLOW_formalParameter_in_functionHeader227 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_formalParameter_in_functionHeader227_data Count:(NSUInteger)1] retain]; FOLLOW_23_in_functionHeader231 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_23_in_functionHeader231_data Count:(NSUInteger)1] retain]; FOLLOW_formalParameter_in_functionHeader233 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_formalParameter_in_functionHeader233_data Count:(NSUInteger)1] retain]; FOLLOW_24_in_functionHeader241 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_24_in_functionHeader241_data Count:(NSUInteger)1] retain]; FOLLOW_type_in_formalParameter281 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_formalParameter281_data Count:(NSUInteger)1] retain]; FOLLOW_declarator_in_formalParameter283 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_formalParameter283_data Count:(NSUInteger)1] retain]; FOLLOW_set_in_type0 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_set_in_type0_data Count:(NSUInteger)1] retain]; FOLLOW_25_in_block376 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_25_in_block376_data Count:(NSUInteger)1] retain]; FOLLOW_variable_in_block390 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_variable_in_block390_data Count:(NSUInteger)1] retain]; FOLLOW_stat_in_block405 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_stat_in_block405_data Count:(NSUInteger)1] retain]; FOLLOW_26_in_block416 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_26_in_block416_data Count:(NSUInteger)1] retain]; FOLLOW_forStat_in_stat449 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_forStat_in_stat449_data Count:(NSUInteger)1] retain]; FOLLOW_expr_in_stat457 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_stat457_data Count:(NSUInteger)1] retain]; FOLLOW_21_in_stat459 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_21_in_stat459_data Count:(NSUInteger)1] retain]; FOLLOW_block_in_stat468 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_stat468_data Count:(NSUInteger)1] retain]; FOLLOW_assignStat_in_stat476 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_stat476_data Count:(NSUInteger)1] retain]; FOLLOW_21_in_stat478 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_21_in_stat478_data Count:(NSUInteger)1] retain]; FOLLOW_21_in_stat487 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_21_in_stat487_data Count:(NSUInteger)1] retain]; FOLLOW_K_FOR_in_forStat507 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_FOR_in_forStat507_data Count:(NSUInteger)1] retain]; FOLLOW_22_in_forStat509 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_22_in_forStat509_data Count:(NSUInteger)1] retain]; FOLLOW_assignStat_in_forStat513 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_forStat513_data Count:(NSUInteger)1] retain]; FOLLOW_21_in_forStat515 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_21_in_forStat515_data Count:(NSUInteger)1] retain]; FOLLOW_expr_in_forStat517 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_forStat517_data Count:(NSUInteger)1] retain]; FOLLOW_21_in_forStat519 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_21_in_forStat519_data Count:(NSUInteger)1] retain]; FOLLOW_assignStat_in_forStat523 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_forStat523_data Count:(NSUInteger)1] retain]; FOLLOW_24_in_forStat525 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_24_in_forStat525_data Count:(NSUInteger)1] retain]; FOLLOW_block_in_forStat527 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_forStat527_data Count:(NSUInteger)1] retain]; FOLLOW_K_ID_in_assignStat570 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_ID_in_assignStat570_data Count:(NSUInteger)1] retain]; FOLLOW_K_EQ_in_assignStat572 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_EQ_in_assignStat572_data Count:(NSUInteger)1] retain]; FOLLOW_expr_in_assignStat574 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_assignStat574_data Count:(NSUInteger)1] retain]; FOLLOW_condExpr_in_expr598 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_condExpr_in_expr598_data Count:(NSUInteger)1] retain]; FOLLOW_aexpr_in_condExpr617 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_aexpr_in_condExpr617_data Count:(NSUInteger)1] retain]; FOLLOW_K_EQEQ_in_condExpr622 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_EQEQ_in_condExpr622_data Count:(NSUInteger)1] retain]; FOLLOW_K_LT_in_condExpr627 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_LT_in_condExpr627_data Count:(NSUInteger)1] retain]; FOLLOW_aexpr_in_condExpr631 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_aexpr_in_condExpr631_data Count:(NSUInteger)1] retain]; FOLLOW_atom_in_aexpr653 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_atom_in_aexpr653_data Count:(NSUInteger)1] retain]; FOLLOW_K_PLUS_in_aexpr657 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_PLUS_in_aexpr657_data Count:(NSUInteger)1] retain]; FOLLOW_atom_in_aexpr660 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_atom_in_aexpr660_data Count:(NSUInteger)1] retain]; FOLLOW_K_ID_in_atom680 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_ID_in_atom680_data Count:(NSUInteger)1] retain]; FOLLOW_K_INT_in_atom694 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_INT_in_atom694_data Count:(NSUInteger)1] retain]; FOLLOW_22_in_atom708 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_22_in_atom708_data Count:(NSUInteger)1] retain]; FOLLOW_expr_in_atom710 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_atom710_data Count:(NSUInteger)1] retain]; FOLLOW_24_in_atom712 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_24_in_atom712_data Count:(NSUInteger)1] retain]; [ANTLRBaseRecognizer setTokenNames:[[[NSArray alloc] initWithObjects:@"", @"", @"", @"", @"VAR_DEF", @"ARG_DEF", @"FUNC_HDR", @"FUNC_DECL", @"FUNC_DEF", @"BLOCK", @"K_ID", @"K_INT", @"K_CHAR", @"K_VOID", @"K_FOR", @"K_EQ", @"K_EQEQ", @"K_LT", @"K_PLUS", @"K_INT_TYPE", @"WS", @"';'", @"'('", @"','", @"')'", @"'{'", @"'}'", nil] retain]]; } + (SimpleCParser *)newSimpleCParser:(id)aStream { return [[SimpleCParser alloc] initWithTokenStream:aStream]; } - (id) initWithTokenStream:(id)aStream { if ((self = [super initWithTokenStream:aStream State:[[ANTLRRecognizerSharedState newANTLRRecognizerSharedStateWithRuleLen:15+1] retain]]) != nil) { dfa2 = [DFA2 newDFA2WithRecognizer:self]; /* start of actions-actionScope-init */ /* start of init */ /* AST genericParser.init */ [self setTreeAdaptor:[[ANTLRCommonTreeAdaptor newANTLRCommonTreeAdaptor] retain]]; } return self; } - (void) dealloc { [dfa2 release]; /* AST genericParser.dealloc */ [self setTreeAdaptor:nil]; [super dealloc]; } // start actions.actionScope.methods // start methods() /* AST genericParser.methods */ /* AST parserMethods */ - (id) getTreeAdaptor { return treeAdaptor; } - (void) setTreeAdaptor:(id)aTreeAdaptor { if (aTreeAdaptor != treeAdaptor) { treeAdaptor = aTreeAdaptor; } } // start rules /* * $ANTLR start program * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:16:1: program : ( declaration )+ ; */ - (SimpleCParser_program_return *) program { /* ruleScopeSetUp */ /* AST ruleDeclarations */ SimpleCParser_program_return * retval = [SimpleCParser_program_return newSimpleCParser_program_return]; [retval setStart:[input LT:1]]; ANTLRCommonTree *root_0 = nil; @try { /* AST ruleLabelDefs */ SimpleCParser_declaration_return * declaration1 = nil; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:17:5: ( ( declaration )+ ) // ruleBlockSingleAlt // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:17:9: ( declaration )+ // alt { root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:17:9: ( declaration )+ // positiveClosureBlock NSInteger cnt1=0; do { NSInteger alt1=2; NSInteger LA1_0 = [input LA:1]; if ( ((LA1_0>=K_ID && LA1_0<=K_VOID)) ) { alt1=1; } switch (alt1) { case 1 : ; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:17:9: declaration // alt { /* ASTParser ruleRef */ [self pushFollow:FOLLOW_declaration_in_program85]; declaration1 = [self declaration]; [self popFollow]; [treeAdaptor addChild:[declaration1 getTree] toTree:root_0]; /* element() */ /* elements */ } break; default : if ( cnt1 >= 1 ) goto loop1; ANTLREarlyExitException *eee = [ANTLREarlyExitException exceptionWithStream:input decisionNumber:1]; @throw eee; } cnt1++; } while (YES); loop1: ; /* element() */ /* elements */ } /* ASTParser ruleCleanUp */ /* AST ruleCleanUp */ // token+rule list labels [retval setStop:[input LT:-1]]; retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0]; [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken]; } @catch (ANTLRRecognitionException *re) { [self reportError:re]; [self recover:input Exception:re]; /* ASTParser rule.setErrorReturnValue */ retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re]; } @finally { } return retval; } /* $ANTLR end program */ /* * $ANTLR start declaration * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:20:1: declaration : ( variable | functionHeader ';' -> ^( FUNC_DECL functionHeader ) | functionHeader block -> ^( FUNC_DEF functionHeader block ) ); */ - (SimpleCParser_declaration_return *) declaration { /* ruleScopeSetUp */ /* AST ruleDeclarations */ SimpleCParser_declaration_return * retval = [SimpleCParser_declaration_return newSimpleCParser_declaration_return]; [retval setStart:[input LT:1]]; ANTLRCommonTree *root_0 = nil; @try { /* AST ruleLabelDefs */ ANTLRCommonToken *char_literal4 = nil; SimpleCParser_variable_return * variable2 = nil; SimpleCParser_functionHeader_return * functionHeader3 = nil; SimpleCParser_functionHeader_return * functionHeader5 = nil; SimpleCParser_block_return * block6 = nil; ANTLRCommonTree *char_literal4_tree=nil; ANTLRRewriteRuleTokenStream *stream_21 = [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor description:@"token 21"] retain]; ANTLRRewriteRuleSubtreeStream *stream_functionHeader = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"rule functionHeader"] retain]; ANTLRRewriteRuleSubtreeStream *stream_block = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"rule block"] retain]; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:21:5: ( variable | functionHeader ';' -> ^( FUNC_DECL functionHeader ) | functionHeader block -> ^( FUNC_DEF functionHeader block ) ) //ruleblock NSInteger alt2=3; alt2 = [dfa2 predict:input]; switch (alt2) { case 1 : ; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:21:9: variable // alt { root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; /* ASTParser ruleRef */ [self pushFollow:FOLLOW_variable_in_declaration105]; variable2 = [self variable]; [self popFollow]; [treeAdaptor addChild:[variable2 getTree] toTree:root_0]; /* element() */ /* elements */ } break; case 2 : ; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:22:9: functionHeader ';' // alt { [self pushFollow:FOLLOW_functionHeader_in_declaration115]; functionHeader3 = [self functionHeader]; [self popFollow]; [stream_functionHeader addElement:[functionHeader3 getTree]]; /* element() */ char_literal4=(ANTLRCommonToken *)[self match:input TokenType:21 Follow:FOLLOW_21_in_declaration117]; [stream_21 addElement:char_literal4]; /* element() */ /* elements */ // AST REWRITE // elements: functionHeader // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: [retval setTree:root_0]; retval.tree = root_0; ANTLRRewriteRuleSubtreeStream *stream_retval = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"token retval" element:retval!=nil?[retval getTree]:nil] retain]; root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; // 22:28: -> ^( FUNC_DECL functionHeader ) { // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:22:31: ^( FUNC_DECL functionHeader ) { ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:[[treeAdaptor createTree:(NSInteger)FUNC_DECL Text:[[ANTLRBaseRecognizer getTokenNames] objectAtIndex:(NSUInteger)FUNC_DECL]] retain] old:root_1]; [treeAdaptor addChild:[stream_functionHeader nextTree] toTree:root_1]; [treeAdaptor addChild:root_1 toTree:root_0]; } } retval.tree = root_0; } break; case 3 : ; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:23:9: functionHeader block // alt { [self pushFollow:FOLLOW_functionHeader_in_declaration135]; functionHeader5 = [self functionHeader]; [self popFollow]; [stream_functionHeader addElement:[functionHeader5 getTree]]; /* element() */ [self pushFollow:FOLLOW_block_in_declaration137]; block6 = [self block]; [self popFollow]; [stream_block addElement:[block6 getTree]]; /* element() */ /* elements */ // AST REWRITE // elements: functionHeader, block // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: [retval setTree:root_0]; retval.tree = root_0; ANTLRRewriteRuleSubtreeStream *stream_retval = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"token retval" element:retval!=nil?[retval getTree]:nil] retain]; root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; // 23:30: -> ^( FUNC_DEF functionHeader block ) { // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:23:33: ^( FUNC_DEF functionHeader block ) { ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:[[treeAdaptor createTree:(NSInteger)FUNC_DEF Text:[[ANTLRBaseRecognizer getTokenNames] objectAtIndex:(NSUInteger)FUNC_DEF]] retain] old:root_1]; [treeAdaptor addChild:[stream_functionHeader nextTree] toTree:root_1]; [treeAdaptor addChild:[stream_block nextTree] toTree:root_1]; [treeAdaptor addChild:root_1 toTree:root_0]; } } retval.tree = root_0; } break; } /* ASTParser ruleCleanUp */ /* AST ruleCleanUp */ // token+rule list labels [retval setStop:[input LT:-1]]; [stream_21 release]; [stream_functionHeader release]; [stream_block release]; retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0]; [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken]; } @catch (ANTLRRecognitionException *re) { [self reportError:re]; [self recover:input Exception:re]; /* ASTParser rule.setErrorReturnValue */ retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re]; } @finally { } return retval; } /* $ANTLR end declaration */ /* * $ANTLR start variable * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:26:1: variable : type declarator ';' -> ^( VAR_DEF type declarator ) ; */ - (SimpleCParser_variable_return *) variable { /* ruleScopeSetUp */ /* AST ruleDeclarations */ SimpleCParser_variable_return * retval = [SimpleCParser_variable_return newSimpleCParser_variable_return]; [retval setStart:[input LT:1]]; ANTLRCommonTree *root_0 = nil; @try { /* AST ruleLabelDefs */ ANTLRCommonToken *char_literal9 = nil; SimpleCParser_type_return * type7 = nil; SimpleCParser_declarator_return * declarator8 = nil; ANTLRCommonTree *char_literal9_tree=nil; ANTLRRewriteRuleTokenStream *stream_21 = [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor description:@"token 21"] retain]; ANTLRRewriteRuleSubtreeStream *stream_declarator = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"rule declarator"] retain]; ANTLRRewriteRuleSubtreeStream *stream_type = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"rule type"] retain]; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:27:5: ( type declarator ';' -> ^( VAR_DEF type declarator ) ) // ruleBlockSingleAlt // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:27:9: type declarator ';' // alt { [self pushFollow:FOLLOW_type_in_variable166]; type7 = [self type]; [self popFollow]; [stream_type addElement:[type7 getTree]]; /* element() */ [self pushFollow:FOLLOW_declarator_in_variable168]; declarator8 = [self declarator]; [self popFollow]; [stream_declarator addElement:[declarator8 getTree]]; /* element() */ char_literal9=(ANTLRCommonToken *)[self match:input TokenType:21 Follow:FOLLOW_21_in_variable170]; [stream_21 addElement:char_literal9]; /* element() */ /* elements */ // AST REWRITE // elements: type, declarator // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: [retval setTree:root_0]; retval.tree = root_0; ANTLRRewriteRuleSubtreeStream *stream_retval = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"token retval" element:retval!=nil?[retval getTree]:nil] retain]; root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; // 27:29: -> ^( VAR_DEF type declarator ) { // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:27:32: ^( VAR_DEF type declarator ) { ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:[[treeAdaptor createTree:(NSInteger)VAR_DEF Text:[[ANTLRBaseRecognizer getTokenNames] objectAtIndex:(NSUInteger)VAR_DEF]] retain] old:root_1]; [treeAdaptor addChild:[stream_type nextTree] toTree:root_1]; [treeAdaptor addChild:[stream_declarator nextTree] toTree:root_1]; [treeAdaptor addChild:root_1 toTree:root_0]; } } retval.tree = root_0; } /* ASTParser ruleCleanUp */ /* AST ruleCleanUp */ // token+rule list labels [retval setStop:[input LT:-1]]; [stream_21 release]; [stream_declarator release]; [stream_type release]; retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0]; [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken]; } @catch (ANTLRRecognitionException *re) { [self reportError:re]; [self recover:input Exception:re]; /* ASTParser rule.setErrorReturnValue */ retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re]; } @finally { } return retval; } /* $ANTLR end variable */ /* * $ANTLR start declarator * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:30:1: declarator : K_ID ; */ - (SimpleCParser_declarator_return *) declarator { /* ruleScopeSetUp */ /* AST ruleDeclarations */ SimpleCParser_declarator_return * retval = [SimpleCParser_declarator_return newSimpleCParser_declarator_return]; [retval setStart:[input LT:1]]; ANTLRCommonTree *root_0 = nil; @try { /* AST ruleLabelDefs */ ANTLRCommonToken *K_ID10 = nil; ANTLRCommonTree *K_ID10_tree=nil; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:31:5: ( K_ID ) // ruleBlockSingleAlt // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:31:9: K_ID // alt { root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; /* ASTParser tokenRef */ K_ID10=(ANTLRCommonToken *)[self match:input TokenType:K_ID Follow:FOLLOW_K_ID_in_declarator199]; K_ID10_tree = /* ASTParser createNodeFromToken */ (ANTLRCommonTree *)[[treeAdaptor createTree:K_ID10] retain]; [treeAdaptor addChild:K_ID10_tree toTree:root_0]; /* element() */ /* elements */ } /* ASTParser ruleCleanUp */ /* AST ruleCleanUp */ // token+rule list labels [retval setStop:[input LT:-1]]; retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0]; [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken]; } @catch (ANTLRRecognitionException *re) { [self reportError:re]; [self recover:input Exception:re]; /* ASTParser rule.setErrorReturnValue */ retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re]; } @finally { } return retval; } /* $ANTLR end declarator */ /* * $ANTLR start functionHeader * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:34:1: functionHeader : type K_ID '(' ( formalParameter ( ',' formalParameter )* )? ')' -> ^( FUNC_HDR type K_ID ( formalParameter )+ ) ; */ - (SimpleCParser_functionHeader_return *) functionHeader { /* ruleScopeSetUp */ /* AST ruleDeclarations */ SimpleCParser_functionHeader_return * retval = [SimpleCParser_functionHeader_return newSimpleCParser_functionHeader_return]; [retval setStart:[input LT:1]]; ANTLRCommonTree *root_0 = nil; @try { /* AST ruleLabelDefs */ ANTLRCommonToken *K_ID12 = nil; ANTLRCommonToken *char_literal13 = nil; ANTLRCommonToken *char_literal15 = nil; ANTLRCommonToken *char_literal17 = nil; SimpleCParser_type_return * type11 = nil; SimpleCParser_formalParameter_return * formalParameter14 = nil; SimpleCParser_formalParameter_return * formalParameter16 = nil; ANTLRCommonTree *K_ID12_tree=nil; ANTLRCommonTree *char_literal13_tree=nil; ANTLRCommonTree *char_literal15_tree=nil; ANTLRCommonTree *char_literal17_tree=nil; ANTLRRewriteRuleTokenStream *stream_K_ID = [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor description:@"token K_ID"] retain]; ANTLRRewriteRuleTokenStream *stream_22 = [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor description:@"token 22"] retain]; ANTLRRewriteRuleTokenStream *stream_23 = [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor description:@"token 23"] retain]; ANTLRRewriteRuleTokenStream *stream_24 = [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor description:@"token 24"] retain]; ANTLRRewriteRuleSubtreeStream *stream_formalParameter = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"rule formalParameter"] retain]; ANTLRRewriteRuleSubtreeStream *stream_type = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"rule type"] retain]; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:35:5: ( type K_ID '(' ( formalParameter ( ',' formalParameter )* )? ')' -> ^( FUNC_HDR type K_ID ( formalParameter )+ ) ) // ruleBlockSingleAlt // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:35:9: type K_ID '(' ( formalParameter ( ',' formalParameter )* )? ')' // alt { [self pushFollow:FOLLOW_type_in_functionHeader219]; type11 = [self type]; [self popFollow]; [stream_type addElement:[type11 getTree]]; /* element() */ K_ID12=(ANTLRCommonToken *)[self match:input TokenType:K_ID Follow:FOLLOW_K_ID_in_functionHeader221]; [stream_K_ID addElement:K_ID12]; /* element() */ char_literal13=(ANTLRCommonToken *)[self match:input TokenType:22 Follow:FOLLOW_22_in_functionHeader223]; [stream_22 addElement:char_literal13]; /* element() */ // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:35:23: ( formalParameter ( ',' formalParameter )* )? // block NSInteger alt4=2; NSInteger LA4_0 = [input LA:1]; if ( ((LA4_0>=K_ID && LA4_0<=K_VOID)) ) { alt4=1; } switch (alt4) { case 1 : ; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:35:25: formalParameter ( ',' formalParameter )* // alt { [self pushFollow:FOLLOW_formalParameter_in_functionHeader227]; formalParameter14 = [self formalParameter]; [self popFollow]; [stream_formalParameter addElement:[formalParameter14 getTree]]; /* element() */ do { NSInteger alt3=2; NSInteger LA3_0 = [input LA:1]; if ( (LA3_0==23) ) { alt3=1; } switch (alt3) { case 1 : ; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:35:43: ',' formalParameter // alt { char_literal15=(ANTLRCommonToken *)[self match:input TokenType:23 Follow:FOLLOW_23_in_functionHeader231]; [stream_23 addElement:char_literal15]; /* element() */ [self pushFollow:FOLLOW_formalParameter_in_functionHeader233]; formalParameter16 = [self formalParameter]; [self popFollow]; [stream_formalParameter addElement:[formalParameter16 getTree]]; /* element() */ /* elements */ } break; default : goto loop3; } } while (YES); loop3: ; /* element() */ /* elements */ } break; } /* element() */ char_literal17=(ANTLRCommonToken *)[self match:input TokenType:24 Follow:FOLLOW_24_in_functionHeader241]; [stream_24 addElement:char_literal17]; /* element() */ /* elements */ // AST REWRITE // elements: K_ID, formalParameter, type // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: [retval setTree:root_0]; retval.tree = root_0; ANTLRRewriteRuleSubtreeStream *stream_retval = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"token retval" element:retval!=nil?[retval getTree]:nil] retain]; root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; // 36:9: -> ^( FUNC_HDR type K_ID ( formalParameter )+ ) { // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:36:12: ^( FUNC_HDR type K_ID ( formalParameter )+ ) { ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:[[treeAdaptor createTree:(NSInteger)FUNC_HDR Text:[[ANTLRBaseRecognizer getTokenNames] objectAtIndex:(NSUInteger)FUNC_HDR]] retain] old:root_1]; [treeAdaptor addChild:[stream_type nextTree] toTree:root_1]; // TODO: args: [treeAdaptor addChild:[stream_K_ID nextNode] toTree:root_1]; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:36:33: ( formalParameter )+ { if ( !([stream_formalParameter hasNext]) ) { @throw [NSException exceptionWithName:@"RewriteEarlyExitException" reason:nil userInfo:nil]; } while ( [stream_formalParameter hasNext] ) { [treeAdaptor addChild:[stream_formalParameter nextTree] toTree:root_1]; } [stream_formalParameter reset]; } [treeAdaptor addChild:root_1 toTree:root_0]; } } retval.tree = root_0; } /* ASTParser ruleCleanUp */ /* AST ruleCleanUp */ // token+rule list labels [retval setStop:[input LT:-1]]; [stream_K_ID release]; [stream_22 release]; [stream_23 release]; [stream_24 release]; [stream_formalParameter release]; [stream_type release]; retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0]; [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken]; } @catch (ANTLRRecognitionException *re) { [self reportError:re]; [self recover:input Exception:re]; /* ASTParser rule.setErrorReturnValue */ retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re]; } @finally { } return retval; } /* $ANTLR end functionHeader */ /* * $ANTLR start formalParameter * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:39:1: formalParameter : type declarator -> ^( ARG_DEF type declarator ) ; */ - (SimpleCParser_formalParameter_return *) formalParameter { /* ruleScopeSetUp */ /* AST ruleDeclarations */ SimpleCParser_formalParameter_return * retval = [SimpleCParser_formalParameter_return newSimpleCParser_formalParameter_return]; [retval setStart:[input LT:1]]; ANTLRCommonTree *root_0 = nil; @try { /* AST ruleLabelDefs */ SimpleCParser_type_return * type18 = nil; SimpleCParser_declarator_return * declarator19 = nil; ANTLRRewriteRuleSubtreeStream *stream_declarator = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"rule declarator"] retain]; ANTLRRewriteRuleSubtreeStream *stream_type = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"rule type"] retain]; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:40:5: ( type declarator -> ^( ARG_DEF type declarator ) ) // ruleBlockSingleAlt // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:40:9: type declarator // alt { [self pushFollow:FOLLOW_type_in_formalParameter281]; type18 = [self type]; [self popFollow]; [stream_type addElement:[type18 getTree]]; /* element() */ [self pushFollow:FOLLOW_declarator_in_formalParameter283]; declarator19 = [self declarator]; [self popFollow]; [stream_declarator addElement:[declarator19 getTree]]; /* element() */ /* elements */ // AST REWRITE // elements: declarator, type // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: [retval setTree:root_0]; retval.tree = root_0; ANTLRRewriteRuleSubtreeStream *stream_retval = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"token retval" element:retval!=nil?[retval getTree]:nil] retain]; root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; // 40:25: -> ^( ARG_DEF type declarator ) { // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:40:28: ^( ARG_DEF type declarator ) { ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:[[treeAdaptor createTree:(NSInteger)ARG_DEF Text:[[ANTLRBaseRecognizer getTokenNames] objectAtIndex:(NSUInteger)ARG_DEF]] retain] old:root_1]; [treeAdaptor addChild:[stream_type nextTree] toTree:root_1]; [treeAdaptor addChild:[stream_declarator nextTree] toTree:root_1]; [treeAdaptor addChild:root_1 toTree:root_0]; } } retval.tree = root_0; } /* ASTParser ruleCleanUp */ /* AST ruleCleanUp */ // token+rule list labels [retval setStop:[input LT:-1]]; [stream_declarator release]; [stream_type release]; retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0]; [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken]; } @catch (ANTLRRecognitionException *re) { [self reportError:re]; [self recover:input Exception:re]; /* ASTParser rule.setErrorReturnValue */ retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re]; } @finally { } return retval; } /* $ANTLR end formalParameter */ /* * $ANTLR start type * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:43:1: type : ( K_INT | K_CHAR | K_VOID | K_ID ); */ - (SimpleCParser_type_return *) type { /* ruleScopeSetUp */ /* AST ruleDeclarations */ SimpleCParser_type_return * retval = [SimpleCParser_type_return newSimpleCParser_type_return]; [retval setStart:[input LT:1]]; ANTLRCommonTree *root_0 = nil; @try { /* AST ruleLabelDefs */ ANTLRCommonToken *set20 = nil; ANTLRCommonTree *set20_tree=nil; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:44:5: ( K_INT | K_CHAR | K_VOID | K_ID ) // ruleBlockSingleAlt // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g: // alt { root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; /* ASTParser matchRuleBlockSet */ /* ASTParser matchSet */ set20 = (ANTLRCommonToken *)[input LT:1]; if ((([input LA:1] >= K_ID) && ([input LA:1] <= K_VOID))) { [input consume]; [treeAdaptor addChild:/* ASTParser createNodeFromToken */ (ANTLRCommonTree *)[[treeAdaptor createTree:set20] retain] toTree:root_0 ]; [state setIsErrorRecovery:NO]; } else { ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException exceptionWithSet:nil stream:input]; @throw mse; } /* element() */ /* elements */ } /* ASTParser ruleCleanUp */ /* AST ruleCleanUp */ // token+rule list labels [retval setStop:[input LT:-1]]; retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0]; [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken]; } @catch (ANTLRRecognitionException *re) { [self reportError:re]; [self recover:input Exception:re]; /* ASTParser rule.setErrorReturnValue */ retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re]; } @finally { } return retval; } /* $ANTLR end type */ /* * $ANTLR start block * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:50:1: block : lc= '{' ( variable )* ( stat )* '}' -> ^( BLOCK[$lc,@\"BLOCK\"] ( variable )* ( stat )* ) ; */ - (SimpleCParser_block_return *) block { /* ruleScopeSetUp */ /* AST ruleDeclarations */ SimpleCParser_block_return * retval = [SimpleCParser_block_return newSimpleCParser_block_return]; [retval setStart:[input LT:1]]; ANTLRCommonTree *root_0 = nil; @try { /* AST ruleLabelDefs */ ANTLRCommonToken *lc = nil; ANTLRCommonToken *char_literal23 = nil; SimpleCParser_variable_return * variable21 = nil; SimpleCParser_stat_return * stat22 = nil; ANTLRCommonTree *lc_tree=nil; ANTLRCommonTree *char_literal23_tree=nil; ANTLRRewriteRuleTokenStream *stream_25 = [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor description:@"token 25"] retain]; ANTLRRewriteRuleTokenStream *stream_26 = [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor description:@"token 26"] retain]; ANTLRRewriteRuleSubtreeStream *stream_variable = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"rule variable"] retain]; ANTLRRewriteRuleSubtreeStream *stream_stat = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"rule stat"] retain]; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:51:5: (lc= '{' ( variable )* ( stat )* '}' -> ^( BLOCK[$lc,@\"BLOCK\"] ( variable )* ( stat )* ) ) // ruleBlockSingleAlt // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:51:9: lc= '{' ( variable )* ( stat )* '}' // alt { lc=(ANTLRCommonToken *)[self match:input TokenType:25 Follow:FOLLOW_25_in_block376]; [stream_25 addElement:lc]; /* element() */ do { NSInteger alt5=2; switch ([input LA:1]) { case K_ID: ; { NSInteger LA5_2 = [input LA:2]; if ( (LA5_2==K_ID) ) { alt5=1; } } break; case K_INT: ; { NSInteger LA5_3 = [input LA:2]; if ( (LA5_3==K_ID) ) { alt5=1; } } break; case K_CHAR: ; case K_VOID: ; { alt5=1; } break; } switch (alt5) { case 1 : ; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:52:13: variable // alt { [self pushFollow:FOLLOW_variable_in_block390]; variable21 = [self variable]; [self popFollow]; [stream_variable addElement:[variable21 getTree]]; /* element() */ /* elements */ } break; default : goto loop5; } } while (YES); loop5: ; /* element() */ do { NSInteger alt6=2; NSInteger LA6_0 = [input LA:1]; if ( ((LA6_0>=K_ID && LA6_0<=K_INT)||LA6_0==K_FOR||(LA6_0>=21 && LA6_0<=22)||LA6_0==25) ) { alt6=1; } switch (alt6) { case 1 : ; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:53:13: stat // alt { [self pushFollow:FOLLOW_stat_in_block405]; stat22 = [self stat]; [self popFollow]; [stream_stat addElement:[stat22 getTree]]; /* element() */ /* elements */ } break; default : goto loop6; } } while (YES); loop6: ; /* element() */ char_literal23=(ANTLRCommonToken *)[self match:input TokenType:26 Follow:FOLLOW_26_in_block416]; [stream_26 addElement:char_literal23]; /* element() */ /* elements */ // AST REWRITE // elements: stat, variable // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: [retval setTree:root_0]; retval.tree = root_0; ANTLRRewriteRuleSubtreeStream *stream_retval = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"token retval" element:retval!=nil?[retval getTree]:nil] retain]; root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; // 55:9: -> ^( BLOCK[$lc,@\"BLOCK\"] ( variable )* ( stat )* ) { // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:55:12: ^( BLOCK[$lc,@\"BLOCK\"] ( variable )* ( stat )* ) { ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:[[treeAdaptor createTree:(NSInteger)BLOCK Text:[[ANTLRBaseRecognizer getTokenNames] objectAtIndex:(NSUInteger)BLOCK]] retain] old:root_1]; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:55:34: ( variable )* while ( [stream_variable hasNext] ) { [treeAdaptor addChild:[stream_variable nextTree] toTree:root_1]; } [stream_variable reset]; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:55:44: ( stat )* while ( [stream_stat hasNext] ) { [treeAdaptor addChild:[stream_stat nextTree] toTree:root_1]; } [stream_stat reset]; [treeAdaptor addChild:root_1 toTree:root_0]; } } retval.tree = root_0; } /* ASTParser ruleCleanUp */ /* AST ruleCleanUp */ // token+rule list labels [retval setStop:[input LT:-1]]; [stream_25 release]; [stream_26 release]; [stream_variable release]; [stream_stat release]; retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0]; [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken]; } @catch (ANTLRRecognitionException *re) { [self reportError:re]; [self recover:input Exception:re]; /* ASTParser rule.setErrorReturnValue */ retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re]; } @finally { } return retval; } /* $ANTLR end block */ /* * $ANTLR start stat * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:58:1: stat : ( forStat | expr ';' | block | assignStat ';' | ';' ); */ - (SimpleCParser_stat_return *) stat { /* ruleScopeSetUp */ /* AST ruleDeclarations */ SimpleCParser_stat_return * retval = [SimpleCParser_stat_return newSimpleCParser_stat_return]; [retval setStart:[input LT:1]]; ANTLRCommonTree *root_0 = nil; @try { /* AST ruleLabelDefs */ ANTLRCommonToken *char_literal26 = nil; ANTLRCommonToken *char_literal29 = nil; ANTLRCommonToken *char_literal30 = nil; SimpleCParser_forStat_return * forStat24 = nil; SimpleCParser_expr_return * expr25 = nil; SimpleCParser_block_return * block27 = nil; SimpleCParser_assignStat_return * assignStat28 = nil; ANTLRCommonTree *char_literal26_tree=nil; ANTLRCommonTree *char_literal29_tree=nil; ANTLRCommonTree *char_literal30_tree=nil; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:58:5: ( forStat | expr ';' | block | assignStat ';' | ';' ) //ruleblock NSInteger alt7=5; switch ([input LA:1]) { case K_FOR: ; { alt7=1; } break; case K_ID: ; { NSInteger LA7_2 = [input LA:2]; if ( (LA7_2==K_EQ) ) { alt7=4; } else if ( ((LA7_2>=K_EQEQ && LA7_2<=K_PLUS)||LA7_2==21) ) { alt7=2; } else { ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newANTLRNoViableAltException:7 state:2 stream:input]; @throw nvae; } } break; case K_INT: ; case 22: ; { alt7=2; } break; case 25: ; { alt7=3; } break; case 21: ; { alt7=5; } break; default: ; ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newANTLRNoViableAltException:7 state:0 stream:input]; @throw nvae; } switch (alt7) { case 1 : ; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:58:7: forStat // alt { root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; /* ASTParser ruleRef */ [self pushFollow:FOLLOW_forStat_in_stat449]; forStat24 = [self forStat]; [self popFollow]; [treeAdaptor addChild:[forStat24 getTree] toTree:root_0]; /* element() */ /* elements */ } break; case 2 : ; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:59:7: expr ';' // alt { root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; /* ASTParser ruleRef */ [self pushFollow:FOLLOW_expr_in_stat457]; expr25 = [self expr]; [self popFollow]; [treeAdaptor addChild:[expr25 getTree] toTree:root_0]; /* element() */ char_literal26=(ANTLRCommonToken *)[self match:input TokenType:21 Follow:FOLLOW_21_in_stat459]; /* element() */ /* elements */ } break; case 3 : ; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:60:7: block // alt { root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; /* ASTParser ruleRef */ [self pushFollow:FOLLOW_block_in_stat468]; block27 = [self block]; [self popFollow]; [treeAdaptor addChild:[block27 getTree] toTree:root_0]; /* element() */ /* elements */ } break; case 4 : ; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:61:7: assignStat ';' // alt { root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; /* ASTParser ruleRef */ [self pushFollow:FOLLOW_assignStat_in_stat476]; assignStat28 = [self assignStat]; [self popFollow]; [treeAdaptor addChild:[assignStat28 getTree] toTree:root_0]; /* element() */ char_literal29=(ANTLRCommonToken *)[self match:input TokenType:21 Follow:FOLLOW_21_in_stat478]; /* element() */ /* elements */ } break; case 5 : ; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:62:7: ';' // alt { root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; char_literal30=(ANTLRCommonToken *)[self match:input TokenType:21 Follow:FOLLOW_21_in_stat487]; /* element() */ /* elements */ } break; } /* ASTParser ruleCleanUp */ /* AST ruleCleanUp */ // token+rule list labels [retval setStop:[input LT:-1]]; retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0]; [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken]; } @catch (ANTLRRecognitionException *re) { [self reportError:re]; [self recover:input Exception:re]; /* ASTParser rule.setErrorReturnValue */ retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re]; } @finally { } return retval; } /* $ANTLR end stat */ /* * $ANTLR start forStat * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:65:1: forStat : K_FOR '(' start= assignStat ';' expr ';' next= assignStat ')' block -> ^( K_FOR $start expr $next block ) ; */ - (SimpleCParser_forStat_return *) forStat { /* ruleScopeSetUp */ /* AST ruleDeclarations */ SimpleCParser_forStat_return * retval = [SimpleCParser_forStat_return newSimpleCParser_forStat_return]; [retval setStart:[input LT:1]]; ANTLRCommonTree *root_0 = nil; @try { /* AST ruleLabelDefs */ ANTLRCommonToken *K_FOR31 = nil; ANTLRCommonToken *char_literal32 = nil; ANTLRCommonToken *char_literal33 = nil; ANTLRCommonToken *char_literal35 = nil; ANTLRCommonToken *char_literal36 = nil; SimpleCParser_assignStat_return * start = nil; SimpleCParser_assignStat_return * next = nil; SimpleCParser_expr_return * expr34 = nil; SimpleCParser_block_return * block37 = nil; ANTLRCommonTree *K_FOR31_tree=nil; ANTLRCommonTree *char_literal32_tree=nil; ANTLRCommonTree *char_literal33_tree=nil; ANTLRCommonTree *char_literal35_tree=nil; ANTLRCommonTree *char_literal36_tree=nil; ANTLRRewriteRuleTokenStream *stream_21 = [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor description:@"token 21"] retain]; ANTLRRewriteRuleTokenStream *stream_22 = [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor description:@"token 22"] retain]; ANTLRRewriteRuleTokenStream *stream_24 = [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor description:@"token 24"] retain]; ANTLRRewriteRuleTokenStream *stream_K_FOR = [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor description:@"token K_FOR"] retain]; ANTLRRewriteRuleSubtreeStream *stream_assignStat = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"rule assignStat"] retain]; ANTLRRewriteRuleSubtreeStream *stream_block = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"rule block"] retain]; ANTLRRewriteRuleSubtreeStream *stream_expr = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"rule expr"] retain]; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:66:5: ( K_FOR '(' start= assignStat ';' expr ';' next= assignStat ')' block -> ^( K_FOR $start expr $next block ) ) // ruleBlockSingleAlt // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:66:9: K_FOR '(' start= assignStat ';' expr ';' next= assignStat ')' block // alt { K_FOR31=(ANTLRCommonToken *)[self match:input TokenType:K_FOR Follow:FOLLOW_K_FOR_in_forStat507]; [stream_K_FOR addElement:K_FOR31]; /* element() */ char_literal32=(ANTLRCommonToken *)[self match:input TokenType:22 Follow:FOLLOW_22_in_forStat509]; [stream_22 addElement:char_literal32]; /* element() */ [self pushFollow:FOLLOW_assignStat_in_forStat513]; start = [self assignStat]; [self popFollow]; [stream_assignStat addElement:[start getTree]]; /* element() */ char_literal33=(ANTLRCommonToken *)[self match:input TokenType:21 Follow:FOLLOW_21_in_forStat515]; [stream_21 addElement:char_literal33]; /* element() */ [self pushFollow:FOLLOW_expr_in_forStat517]; expr34 = [self expr]; [self popFollow]; [stream_expr addElement:[expr34 getTree]]; /* element() */ char_literal35=(ANTLRCommonToken *)[self match:input TokenType:21 Follow:FOLLOW_21_in_forStat519]; [stream_21 addElement:char_literal35]; /* element() */ [self pushFollow:FOLLOW_assignStat_in_forStat523]; next = [self assignStat]; [self popFollow]; [stream_assignStat addElement:[next getTree]]; /* element() */ char_literal36=(ANTLRCommonToken *)[self match:input TokenType:24 Follow:FOLLOW_24_in_forStat525]; [stream_24 addElement:char_literal36]; /* element() */ [self pushFollow:FOLLOW_block_in_forStat527]; block37 = [self block]; [self popFollow]; [stream_block addElement:[block37 getTree]]; /* element() */ /* elements */ // AST REWRITE // elements: K_FOR, expr, start, next, block // token labels: // rule labels: retval, start, next // token list labels: // rule list labels: // wildcard labels: [retval setTree:root_0]; retval.tree = root_0; ANTLRRewriteRuleSubtreeStream *stream_retval = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"token retval" element:retval!=nil?[retval getTree]:nil] retain]; ANTLRRewriteRuleSubtreeStream *stream_start = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"token start" element:start!=nil?[start getTree]:nil] retain]; ANTLRRewriteRuleSubtreeStream *stream_next = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"token next" element:next!=nil?[next getTree]:nil] retain]; root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; // 67:9: -> ^( K_FOR $start expr $next block ) { // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:67:12: ^( K_FOR $start expr $next block ) { ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:[stream_K_FOR nextNode] old:root_1]; [treeAdaptor addChild:[stream_start nextTree] toTree:root_1]; [treeAdaptor addChild:[stream_expr nextTree] toTree:root_1]; [treeAdaptor addChild:[stream_next nextTree] toTree:root_1]; [treeAdaptor addChild:[stream_block nextTree] toTree:root_1]; [treeAdaptor addChild:root_1 toTree:root_0]; } } retval.tree = root_0; } /* ASTParser ruleCleanUp */ /* AST ruleCleanUp */ // token+rule list labels [retval setStop:[input LT:-1]]; [stream_21 release]; [stream_22 release]; [stream_24 release]; [stream_K_FOR release]; [stream_assignStat release]; [stream_block release]; [stream_expr release]; retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0]; [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken]; } @catch (ANTLRRecognitionException *re) { [self reportError:re]; [self recover:input Exception:re]; /* ASTParser rule.setErrorReturnValue */ retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re]; } @finally { } return retval; } /* $ANTLR end forStat */ /* * $ANTLR start assignStat * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:70:1: assignStat : K_ID K_EQ expr -> ^( K_EQ K_ID expr ) ; */ - (SimpleCParser_assignStat_return *) assignStat { /* ruleScopeSetUp */ /* AST ruleDeclarations */ SimpleCParser_assignStat_return * retval = [SimpleCParser_assignStat_return newSimpleCParser_assignStat_return]; [retval setStart:[input LT:1]]; ANTLRCommonTree *root_0 = nil; @try { /* AST ruleLabelDefs */ ANTLRCommonToken *K_ID38 = nil; ANTLRCommonToken *K_EQ39 = nil; SimpleCParser_expr_return * expr40 = nil; ANTLRCommonTree *K_ID38_tree=nil; ANTLRCommonTree *K_EQ39_tree=nil; ANTLRRewriteRuleTokenStream *stream_K_ID = [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor description:@"token K_ID"] retain]; ANTLRRewriteRuleTokenStream *stream_K_EQ = [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor description:@"token K_EQ"] retain]; ANTLRRewriteRuleSubtreeStream *stream_expr = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"rule expr"] retain]; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:71:5: ( K_ID K_EQ expr -> ^( K_EQ K_ID expr ) ) // ruleBlockSingleAlt // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:71:9: K_ID K_EQ expr // alt { K_ID38=(ANTLRCommonToken *)[self match:input TokenType:K_ID Follow:FOLLOW_K_ID_in_assignStat570]; [stream_K_ID addElement:K_ID38]; /* element() */ K_EQ39=(ANTLRCommonToken *)[self match:input TokenType:K_EQ Follow:FOLLOW_K_EQ_in_assignStat572]; [stream_K_EQ addElement:K_EQ39]; /* element() */ [self pushFollow:FOLLOW_expr_in_assignStat574]; expr40 = [self expr]; [self popFollow]; [stream_expr addElement:[expr40 getTree]]; /* element() */ /* elements */ // AST REWRITE // elements: K_EQ, K_ID, expr // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: [retval setTree:root_0]; retval.tree = root_0; ANTLRRewriteRuleSubtreeStream *stream_retval = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"token retval" element:retval!=nil?[retval getTree]:nil] retain]; root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; // 71:24: -> ^( K_EQ K_ID expr ) { // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:71:27: ^( K_EQ K_ID expr ) { ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:[stream_K_EQ nextNode] old:root_1]; // TODO: args: [treeAdaptor addChild:[stream_K_ID nextNode] toTree:root_1]; [treeAdaptor addChild:[stream_expr nextTree] toTree:root_1]; [treeAdaptor addChild:root_1 toTree:root_0]; } } retval.tree = root_0; } /* ASTParser ruleCleanUp */ /* AST ruleCleanUp */ // token+rule list labels [retval setStop:[input LT:-1]]; [stream_K_ID release]; [stream_K_EQ release]; [stream_expr release]; retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0]; [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken]; } @catch (ANTLRRecognitionException *re) { [self reportError:re]; [self recover:input Exception:re]; /* ASTParser rule.setErrorReturnValue */ retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re]; } @finally { } return retval; } /* $ANTLR end assignStat */ /* * $ANTLR start expr * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:74:1: expr : condExpr ; */ - (SimpleCParser_expr_return *) expr { /* ruleScopeSetUp */ /* AST ruleDeclarations */ SimpleCParser_expr_return * retval = [SimpleCParser_expr_return newSimpleCParser_expr_return]; [retval setStart:[input LT:1]]; ANTLRCommonTree *root_0 = nil; @try { /* AST ruleLabelDefs */ SimpleCParser_condExpr_return * condExpr41 = nil; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:74:5: ( condExpr ) // ruleBlockSingleAlt // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:74:9: condExpr // alt { root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; /* ASTParser ruleRef */ [self pushFollow:FOLLOW_condExpr_in_expr598]; condExpr41 = [self condExpr]; [self popFollow]; [treeAdaptor addChild:[condExpr41 getTree] toTree:root_0]; /* element() */ /* elements */ } /* ASTParser ruleCleanUp */ /* AST ruleCleanUp */ // token+rule list labels [retval setStop:[input LT:-1]]; retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0]; [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken]; } @catch (ANTLRRecognitionException *re) { [self reportError:re]; [self recover:input Exception:re]; /* ASTParser rule.setErrorReturnValue */ retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re]; } @finally { } return retval; } /* $ANTLR end expr */ /* * $ANTLR start condExpr * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:77:1: condExpr : aexpr ( ( K_EQEQ | K_LT ) aexpr )? ; */ - (SimpleCParser_condExpr_return *) condExpr { /* ruleScopeSetUp */ /* AST ruleDeclarations */ SimpleCParser_condExpr_return * retval = [SimpleCParser_condExpr_return newSimpleCParser_condExpr_return]; [retval setStart:[input LT:1]]; ANTLRCommonTree *root_0 = nil; @try { /* AST ruleLabelDefs */ ANTLRCommonToken *K_EQEQ43 = nil; ANTLRCommonToken *K_LT44 = nil; SimpleCParser_aexpr_return * aexpr42 = nil; SimpleCParser_aexpr_return * aexpr45 = nil; ANTLRCommonTree *K_EQEQ43_tree=nil; ANTLRCommonTree *K_LT44_tree=nil; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:78:5: ( aexpr ( ( K_EQEQ | K_LT ) aexpr )? ) // ruleBlockSingleAlt // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:78:9: aexpr ( ( K_EQEQ | K_LT ) aexpr )? // alt { root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; /* ASTParser ruleRef */ [self pushFollow:FOLLOW_aexpr_in_condExpr617]; aexpr42 = [self aexpr]; [self popFollow]; [treeAdaptor addChild:[aexpr42 getTree] toTree:root_0]; /* element() */ // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:78:15: ( ( K_EQEQ | K_LT ) aexpr )? // block NSInteger alt9=2; NSInteger LA9_0 = [input LA:1]; if ( ((LA9_0>=K_EQEQ && LA9_0<=K_LT)) ) { alt9=1; } switch (alt9) { case 1 : ; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:78:17: ( K_EQEQ | K_LT ) aexpr // alt { // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:78:17: ( K_EQEQ | K_LT ) // block NSInteger alt8=2; NSInteger LA8_0 = [input LA:1]; if ( (LA8_0==K_EQEQ) ) { alt8=1; } else if ( (LA8_0==K_LT) ) { alt8=2; } else { ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newANTLRNoViableAltException:8 state:0 stream:input]; @throw nvae; } switch (alt8) { case 1 : ; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:78:18: K_EQEQ // alt { K_EQEQ43=(ANTLRCommonToken *)[self match:input TokenType:K_EQEQ Follow:FOLLOW_K_EQEQ_in_condExpr622]; K_EQEQ43_tree = /* ASTParser createNodeFromToken */ (ANTLRCommonTree *)[[treeAdaptor createTree:K_EQEQ43] retain]; root_0 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:K_EQEQ43_tree old:root_0]; /* element() */ /* elements */ } break; case 2 : ; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:78:28: K_LT // alt { K_LT44=(ANTLRCommonToken *)[self match:input TokenType:K_LT Follow:FOLLOW_K_LT_in_condExpr627]; K_LT44_tree = /* ASTParser createNodeFromToken */ (ANTLRCommonTree *)[[treeAdaptor createTree:K_LT44] retain]; root_0 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:K_LT44_tree old:root_0]; /* element() */ /* elements */ } break; } /* element() */ /* ASTParser ruleRef */ [self pushFollow:FOLLOW_aexpr_in_condExpr631]; aexpr45 = [self aexpr]; [self popFollow]; [treeAdaptor addChild:[aexpr45 getTree] toTree:root_0]; /* element() */ /* elements */ } break; } /* element() */ /* elements */ } /* ASTParser ruleCleanUp */ /* AST ruleCleanUp */ // token+rule list labels [retval setStop:[input LT:-1]]; retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0]; [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken]; } @catch (ANTLRRecognitionException *re) { [self reportError:re]; [self recover:input Exception:re]; /* ASTParser rule.setErrorReturnValue */ retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re]; } @finally { } return retval; } /* $ANTLR end condExpr */ /* * $ANTLR start aexpr * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:81:1: aexpr : atom ( K_PLUS atom )* ; */ - (SimpleCParser_aexpr_return *) aexpr { /* ruleScopeSetUp */ /* AST ruleDeclarations */ SimpleCParser_aexpr_return * retval = [SimpleCParser_aexpr_return newSimpleCParser_aexpr_return]; [retval setStart:[input LT:1]]; ANTLRCommonTree *root_0 = nil; @try { /* AST ruleLabelDefs */ ANTLRCommonToken *K_PLUS47 = nil; SimpleCParser_atom_return * atom46 = nil; SimpleCParser_atom_return * atom48 = nil; ANTLRCommonTree *K_PLUS47_tree=nil; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:82:5: ( atom ( K_PLUS atom )* ) // ruleBlockSingleAlt // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:82:9: atom ( K_PLUS atom )* // alt { root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; /* ASTParser ruleRef */ [self pushFollow:FOLLOW_atom_in_aexpr653]; atom46 = [self atom]; [self popFollow]; [treeAdaptor addChild:[atom46 getTree] toTree:root_0]; /* element() */ do { NSInteger alt10=2; NSInteger LA10_0 = [input LA:1]; if ( (LA10_0==K_PLUS) ) { alt10=1; } switch (alt10) { case 1 : ; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:82:16: K_PLUS atom // alt { K_PLUS47=(ANTLRCommonToken *)[self match:input TokenType:K_PLUS Follow:FOLLOW_K_PLUS_in_aexpr657]; K_PLUS47_tree = /* ASTParser createNodeFromToken */ (ANTLRCommonTree *)[[treeAdaptor createTree:K_PLUS47] retain]; root_0 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:K_PLUS47_tree old:root_0]; /* element() */ /* ASTParser ruleRef */ [self pushFollow:FOLLOW_atom_in_aexpr660]; atom48 = [self atom]; [self popFollow]; [treeAdaptor addChild:[atom48 getTree] toTree:root_0]; /* element() */ /* elements */ } break; default : goto loop10; } } while (YES); loop10: ; /* element() */ /* elements */ } /* ASTParser ruleCleanUp */ /* AST ruleCleanUp */ // token+rule list labels [retval setStop:[input LT:-1]]; retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0]; [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken]; } @catch (ANTLRRecognitionException *re) { [self reportError:re]; [self recover:input Exception:re]; /* ASTParser rule.setErrorReturnValue */ retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re]; } @finally { } return retval; } /* $ANTLR end aexpr */ /* * $ANTLR start atom * /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:85:1: atom : ( K_ID | K_INT | '(' expr ')' -> expr ); */ - (SimpleCParser_atom_return *) atom { /* ruleScopeSetUp */ /* AST ruleDeclarations */ SimpleCParser_atom_return * retval = [SimpleCParser_atom_return newSimpleCParser_atom_return]; [retval setStart:[input LT:1]]; ANTLRCommonTree *root_0 = nil; @try { /* AST ruleLabelDefs */ ANTLRCommonToken *K_ID49 = nil; ANTLRCommonToken *K_INT50 = nil; ANTLRCommonToken *char_literal51 = nil; ANTLRCommonToken *char_literal53 = nil; SimpleCParser_expr_return * expr52 = nil; ANTLRCommonTree *K_ID49_tree=nil; ANTLRCommonTree *K_INT50_tree=nil; ANTLRCommonTree *char_literal51_tree=nil; ANTLRCommonTree *char_literal53_tree=nil; ANTLRRewriteRuleTokenStream *stream_22 = [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor description:@"token 22"] retain]; ANTLRRewriteRuleTokenStream *stream_24 = [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor description:@"token 24"] retain]; ANTLRRewriteRuleSubtreeStream *stream_expr = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"rule expr"] retain]; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:86:5: ( K_ID | K_INT | '(' expr ')' -> expr ) //ruleblock NSInteger alt11=3; switch ([input LA:1]) { case K_ID: ; { alt11=1; } break; case K_INT: ; { alt11=2; } break; case 22: ; { alt11=3; } break; default: ; ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newANTLRNoViableAltException:11 state:0 stream:input]; @throw nvae; } switch (alt11) { case 1 : ; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:86:7: K_ID // alt { root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; /* ASTParser tokenRef */ K_ID49=(ANTLRCommonToken *)[self match:input TokenType:K_ID Follow:FOLLOW_K_ID_in_atom680]; K_ID49_tree = /* ASTParser createNodeFromToken */ (ANTLRCommonTree *)[[treeAdaptor createTree:K_ID49] retain]; [treeAdaptor addChild:K_ID49_tree toTree:root_0]; /* element() */ /* elements */ } break; case 2 : ; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:87:7: K_INT // alt { root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; /* ASTParser tokenRef */ K_INT50=(ANTLRCommonToken *)[self match:input TokenType:K_INT Follow:FOLLOW_K_INT_in_atom694]; K_INT50_tree = /* ASTParser createNodeFromToken */ (ANTLRCommonTree *)[[treeAdaptor createTree:K_INT50] retain]; [treeAdaptor addChild:K_INT50_tree toTree:root_0]; /* element() */ /* elements */ } break; case 3 : ; // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:88:7: '(' expr ')' // alt { char_literal51=(ANTLRCommonToken *)[self match:input TokenType:22 Follow:FOLLOW_22_in_atom708]; [stream_22 addElement:char_literal51]; /* element() */ [self pushFollow:FOLLOW_expr_in_atom710]; expr52 = [self expr]; [self popFollow]; [stream_expr addElement:[expr52 getTree]]; /* element() */ char_literal53=(ANTLRCommonToken *)[self match:input TokenType:24 Follow:FOLLOW_24_in_atom712]; [stream_24 addElement:char_literal53]; /* element() */ /* elements */ // AST REWRITE // elements: expr // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: [retval setTree:root_0]; retval.tree = root_0; ANTLRRewriteRuleSubtreeStream *stream_retval = [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor description:@"token retval" element:retval!=nil?[retval getTree]:nil] retain]; root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain]; // 88:20: -> expr { [treeAdaptor addChild:[stream_expr nextTree] toTree:root_0]; } retval.tree = root_0; } break; } /* ASTParser ruleCleanUp */ /* AST ruleCleanUp */ // token+rule list labels [retval setStop:[input LT:-1]]; [stream_22 release]; [stream_24 release]; [stream_expr release]; retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0]; [treeAdaptor setTokenBoundaries:retval.tree From:retval.startToken To:retval.stopToken]; } @catch (ANTLRRecognitionException *re) { [self reportError:re]; [self recover:input Exception:re]; /* ASTParser rule.setErrorReturnValue */ retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.startToken To:[input LT:-1] Exception:re]; } @finally { } return retval; } /* $ANTLR end atom */ @end /* end of SimpleCParser implementation line 669 */ /* End of code * ============================================================================= */