/projects/antlr-3.4/bin/SimpleCParser.m
Objective C | 1440 lines | 955 code | 306 blank | 179 comment | 102 complexity | edac0b0c528fa71772b3b4978d92007b 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 15:09:17
- * - 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 15:09:17
- /* -----------------------------------------
- * 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] =
- {9,14,18,9,0,14,17,10,0,0,9,14,10};
- const static unichar dfa2_max[13] =
- {24,14,23,24,0,14,23,22,0,0,24,14,22};
- 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[] = {9, -1, -1, -1, -1, -1, 8};
- const static NSInteger dfa2_transition1[] = {10, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 6};
- const static NSInteger dfa2_transition2[] = {5, -1, -1, -1, -1, 5, -1, 5,
- -1, -1, -1, -1, -1, 6, -1, 5};
- const static NSInteger dfa2_transition3[] = {11, -1, -1, -1, -1, 11, -1,
- 11, -1, -1, -1, -1, -1, -1, -1, 11};
- const static NSInteger dfa2_transition4[] = {3, -1, -1, -1, -1, 4};
- const static NSInteger dfa2_transition5[] = {1, -1, -1, -1, -1, 1, -1, 1,
- -1, -1, -1, -1, -1, -1, -1, 1};
- const static NSInteger dfa2_transition6[] = {7};
- const static NSInteger dfa2_transition7[] = {12};
- const static NSInteger dfa2_transition8[] = {2};
- + (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_transition5;
- transition[1] = dfa2_transition8;
- transition[2] = dfa2_transition4;
- transition[3] = dfa2_transition2;
- transition[4] = dfa2_transition6;
- transition[5] = dfa2_transition0;
- transition[6] = dfa2_transition1;
- transition[7] = dfa2_transition3;
- transition[8] = dfa2_transition7;
- transition[9] = dfa2_transition1;
- }
- return self;
- }
- - (void) dealloc
- {
- free(transition);
- [super dealloc];
- }
- - (NSString *) description
- {
- return @"20:1: declaration : ( variable | functionHeader K_SEMICOLON -> ^( 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[] = { 0x0000000001014202LL};
- 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[] = { 0x0000000000800000LL};
- static ANTLRBitSet *FOLLOW_K_SEMICOLON_in_declaration117;
- static const unsigned long long FOLLOW_K_SEMICOLON_in_declaration117_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_functionHeader_in_declaration135;
- static const unsigned long long FOLLOW_functionHeader_in_declaration135_data[] = { 0x0000000000020000LL};
- 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[] = { 0x0000000000004000LL};
- static ANTLRBitSet *FOLLOW_declarator_in_variable168;
- static const unsigned long long FOLLOW_declarator_in_variable168_data[] = { 0x0000000000800000LL};
- static ANTLRBitSet *FOLLOW_K_SEMICOLON_in_variable170;
- static const unsigned long long FOLLOW_K_SEMICOLON_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[] = { 0x0000000000004000LL};
- static ANTLRBitSet *FOLLOW_K_ID_in_functionHeader221;
- static const unsigned long long FOLLOW_K_ID_in_functionHeader221_data[] = { 0x0000000000040000LL};
- static ANTLRBitSet *FOLLOW_K_LCURVE_in_functionHeader223;
- static const unsigned long long FOLLOW_K_LCURVE_in_functionHeader223_data[] = { 0x0000000001414200LL};
- static ANTLRBitSet *FOLLOW_formalParameter_in_functionHeader227;
- static const unsigned long long FOLLOW_formalParameter_in_functionHeader227_data[] = { 0x0000000000400400LL};
- static ANTLRBitSet *FOLLOW_K_COMMA_in_functionHeader231;
- static const unsigned long long FOLLOW_K_COMMA_in_functionHeader231_data[] = { 0x0000000001014200LL};
- static ANTLRBitSet *FOLLOW_formalParameter_in_functionHeader233;
- static const unsigned long long FOLLOW_formalParameter_in_functionHeader233_data[] = { 0x0000000000400400LL};
- static ANTLRBitSet *FOLLOW_K_RCURVE_in_functionHeader241;
- static const unsigned long long FOLLOW_K_RCURVE_in_functionHeader241_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_type_in_formalParameter281;
- static const unsigned long long FOLLOW_type_in_formalParameter281_data[] = { 0x0000000000004000LL};
- static ANTLRBitSet *FOLLOW_declarator_in_formalParameter283;
- static const unsigned long long FOLLOW_declarator_in_formalParameter283_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_K_LCURLY_in_block376;
- static const unsigned long long FOLLOW_K_LCURLY_in_block376_data[] = { 0x0000000001A7E200LL};
- static ANTLRBitSet *FOLLOW_variable_in_block390;
- static const unsigned long long FOLLOW_variable_in_block390_data[] = { 0x0000000001A7E200LL};
- static ANTLRBitSet *FOLLOW_stat_in_block405;
- static const unsigned long long FOLLOW_stat_in_block405_data[] = { 0x0000000000A6E000LL};
- static ANTLRBitSet *FOLLOW_K_RCURLY_in_block416;
- static const unsigned long long FOLLOW_K_RCURLY_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[] = { 0x0000000000800000LL};
- static ANTLRBitSet *FOLLOW_K_SEMICOLON_in_stat459;
- static const unsigned long long FOLLOW_K_SEMICOLON_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[] = { 0x0000000000800000LL};
- static ANTLRBitSet *FOLLOW_K_SEMICOLON_in_stat478;
- static const unsigned long long FOLLOW_K_SEMICOLON_in_stat478_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_K_SEMICOLON_in_stat487;
- static const unsigned long long FOLLOW_K_SEMICOLON_in_stat487_data[] = { 0x0000000000000002LL};
- static ANTLRBitSet *FOLLOW_K_FOR_in_forStat507;
- static const unsigned long long FOLLOW_K_FOR_in_forStat507_data[] = { 0x0000000000040000LL};
- static ANTLRBitSet *FOLLOW_K_LCURVE_in_forStat509;
- static const unsigned long long FOLLOW_K_LCURVE_in_forStat509_data[] = { 0x0000000000004000LL};
- static ANTLRBitSet *FOLLOW_assignStat_in_forStat513;
- static const unsigned long long FOLLOW_assignStat_in_forStat513_data[] = { 0x0000000000800000LL};
- static ANTLRBitSet *FOLLOW_K_SEMICOLON_in_forStat515;
- static const unsigned long long FOLLOW_K_SEMICOLON_in_forStat515_data[] = { 0x000000000004C000LL};
- static ANTLRBitSet *FOLLOW_expr_in_forStat517;
- static const unsigned long long FOLLOW_expr_in_forStat517_data[] = { 0x0000000000800000LL};
- static ANTLRBitSet *FOLLOW_K_SEMICOLON_in_forStat519;
- static const unsigned long long FOLLOW_K_SEMICOLON_in_forStat519_data[] = { 0x0000000000004000LL};
- static ANTLRBitSet *FOLLOW_assignStat_in_forStat523;
- static const unsigned long long FOLLOW_assignStat_in_forStat523_data[] = { 0x0000000000400000LL};
- static ANTLRBitSet *FOLLOW_K_RCURVE_in_forStat525;
- static const unsigned long long FOLLOW_K_RCURVE_in_forStat525_data[] = { 0x0000000000020000LL};
- 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[] = { 0x0000000000000800LL};
- static ANTLRBitSet *FOLLOW_K_EQ_in_assignStat572;
- static const unsigned long long FOLLOW_K_EQ_in_assignStat572_data[] = { 0x000000000004C000LL};
- 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[] = { 0x0000000000081002LL};
- static ANTLRBitSet *FOLLOW_K_EQEQ_in_condExpr622;
- static const unsigned long long FOLLOW_K_EQEQ_in_condExpr622_data[] = { 0x000000000004C000LL};
- static ANTLRBitSet *FOLLOW_K_LT_in_condExpr627;
- static const unsigned long long FOLLOW_K_LT_in_condExpr627_data[] = { 0x000000000004C000LL};
- 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[] = { 0x0000000000100002LL};
- static ANTLRBitSet *FOLLOW_K_PLUS_in_aexpr657;
- static const unsigned long long FOLLOW_K_PLUS_in_aexpr657_data[] = { 0x000000000004C000LL};
- static ANTLRBitSet *FOLLOW_atom_in_aexpr660;
- static const unsigned long long FOLLOW_atom_in_aexpr660_data[] = { 0x0000000000100002LL};
- 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_K_LCURVE_in_atom708;
- static const unsigned long long FOLLOW_K_LCURVE_in_atom708_data[] = { 0x000000000004C000LL};
- static ANTLRBitSet *FOLLOW_expr_in_atom710;
- static const unsigned long long FOLLOW_expr_in_atom710_data[] = { 0x0000000000400000LL};
- static ANTLRBitSet *FOLLOW_K_RCURVE_in_atom712;
- static const unsigned long long FOLLOW_K_RCURVE_in_atom712_data[] = { 0x0000000000000002LL};
- #pragma mark Dynamic Global Scopes
- #pragma mark Dynamic Rule Scopes
- #pragma mark Rule Return Scopes start
- @implementation SimpleCParser_program_return /* returnScope */
- /* AST returnScope.synthesize */
- @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
- + (SimpleCParser_program_return *)newSimpleCParser_program_return
- {
- return [[[SimpleCParser_program_return alloc] init] retain];
- }
- - (id) init
- {
- self = [super init];
- return self;
- }
- /* 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.tree = nil;
- [super dealloc];
- }
- @end /* end of returnScope implementation */
- @implementation SimpleCParser_declaration_return /* returnScope */
- /* AST returnScope.synthesize */
- @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
- + (SimpleCParser_declaration_return *)newSimpleCParser_declaration_return
- {
- return [[[SimpleCParser_declaration_return alloc] init] retain];
- }
- - (id) init
- {
- self = [super init];
- return self;
- }
- /* 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.tree = nil;
- [super dealloc];
- }
- @end /* end of returnScope implementation */
- @implementation SimpleCParser_variable_return /* returnScope */
- /* AST returnScope.synthesize */
- @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
- + (SimpleCParser_variable_return *)newSimpleCParser_variable_return
- {
- return [[[SimpleCParser_variable_return alloc] init] retain];
- }
- - (id) init
- {
- self = [super init];
- return self;
- }
- /* 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.tree = nil;
- [super dealloc];
- }
- @end /* end of returnScope implementation */
- @implementation SimpleCParser_declarator_return /* returnScope */
- /* AST returnScope.synthesize */
- @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
- + (SimpleCParser_declarator_return *)newSimpleCParser_declarator_return
- {
- return [[[SimpleCParser_declarator_return alloc] init] retain];
- }
- - (id) init
- {
- self = [super init];
- return self;
- }
- /* 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.tree = nil;
- [super dealloc];
- }
- @end /* end of returnScope implementation */
- @implementation SimpleCParser_functionHeader_return /* returnScope */
- /* AST returnScope.synthesize */
- @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
- + (SimpleCParser_functionHeader_return *)newSimpleCParser_functionHeader_return
- {
- return [[[SimpleCParser_functionHeader_return alloc] init] retain];
- }
- - (id) init
- {
- self = [super init];
- return self;
- }
- /* 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.tree = nil;
- [super dealloc];
- }
- @end /* end of returnScope implementation */
- @implementation SimpleCParser_formalParameter_return /* returnScope */
- /* AST returnScope.synthesize */
- @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
- + (SimpleCParser_formalParameter_return *)newSimpleCParser_formalParameter_return
- {
- return [[[SimpleCParser_formalParameter_return alloc] init] retain];
- }
- - (id) init
- {
- self = [super init];
- return self;
- }
- /* 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.tree = nil;
- [super dealloc];
- }
- @end /* end of returnScope implementation */
- @implementation SimpleCParser_type_return /* returnScope */
- /* AST returnScope.synthesize */
- @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
- + (SimpleCParser_type_return *)newSimpleCParser_type_return
- {
- return [[[SimpleCParser_type_return alloc] init] retain];
- }
- - (id) init
- {
- self = [super init];
- return self;
- }
- /* 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.tree = nil;
- [super dealloc];
- }
- @end /* end of returnScope implementation */
- @implementation SimpleCParser_block_return /* returnScope */
- /* AST returnScope.synthesize */
- @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
- + (SimpleCParser_block_return *)newSimpleCParser_block_return
- {
- return [[[SimpleCParser_block_return alloc] init] retain];
- }
- - (id) init
- {
- self = [super init];
- return self;
- }
- /* 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.tree = nil;
- [super dealloc];
- }
- @end /* end of returnScope implementation */
- @implementation SimpleCParser_stat_return /* returnScope */
- /* AST returnScope.synthesize */
- @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
- + (SimpleCParser_stat_return *)newSimpleCParser_stat_return
- {
- return [[[SimpleCParser_stat_return alloc] init] retain];
- }
- - (id) init
- {
- self = [super init];
- return self;
- }
- /* 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.tree = nil;
- [super dealloc];
- }
- @end /* end of returnScope implementation */
- @implementation SimpleCParser_forStat_return /* returnScope */
- /* AST returnScope.synthesize */
- @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
- + (SimpleCParser_forStat_return *)newSimpleCParser_forStat_return
- {
- return [[[SimpleCParser_forStat_return alloc] init] retain];
- }
- - (id) init
- {
- self = [super init];
- return self;
- }
- /* 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.tree = nil;
- [super dealloc];
- }
- @end /* end of returnScope implementation */
- @implementation SimpleCParser_assignStat_return /* returnScope */
- /* AST returnScope.synthesize */
- @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
- + (SimpleCParser_assignStat_return *)newSimpleCParser_assignStat_return
- {
- return [[[SimpleCParser_assignStat_return alloc] init] retain];
- }
- - (id) init
- {
- self = [super init];
- return self;
- }
- /* 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.tree = nil;
- [super dealloc];
- }
- @end /* end of returnScope implementation */
- @implementation SimpleCParser_expr_return /* returnScope */
- /* AST returnScope.synthesize */
- @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
- + (SimpleCParser_expr_return *)newSimpleCParser_expr_return
- {
- return [[[SimpleCParser_expr_return alloc] init] retain];
- }
- - (id) init
- {
- self = [super init];
- return self;
- }
- /* 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.tree = nil;
- [super dealloc];
- }
- @end /* end of returnScope implementation */
- @implementation SimpleCParser_condExpr_return /* returnScope */
- /* AST returnScope.synthesize */
- @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
- + (SimpleCParser_condExpr_return *)newSimpleCParser_condExpr_return
- {
- return [[[SimpleCParser_condExpr_return alloc] init] retain];
- }
- - (id) init
- {
- self = [super init];
- return self;
- }
- /* 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.tree = nil;
- [super dealloc];
- }
- @end /* end of returnScope implementation */
- @implementation SimpleCParser_aexpr_return /* returnScope */
- /* AST returnScope.synthesize */
- @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
- + (SimpleCParser_aexpr_return *)newSimpleCParser_aexpr_return
- {
- return [[[SimpleCParser_aexpr_return alloc] init] retain];
- }
- - (id) init
- {
- self = [super init];
- return self;
- }
- /* 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.tree = nil;
- [super dealloc];
- }
- @end /* end of returnScope implementation */
- @implementation SimpleCParser_atom_return /* returnScope */
- /* AST returnScope.synthesize */
- @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
- + (SimpleCParser_atom_return *)newSimpleCParser_atom_return
- {
- return [[[SimpleCParser_atom_return alloc] init] retain];
- }
- - (id) init
- {
- self = [super init];
- return self;
- }
- /* 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.tree = nil;
- [super dealloc];
- }
- @end /* end of returnScope implementation */
- //#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() */
- /* AST genericParser.synthesize */
- /* AST parserProperties */
- @synthesize treeAdaptor;
- /* ObjC end synthesize() */
- + (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_K_SEMICOLON_in_declaration117 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_SEMICOLON_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_K_SEMICOLON_in_variable170 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_SEMICOLON_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_K_LCURVE_in_functionHeader223 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_LCURVE_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_K_COMMA_in_functionHeader231 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_COMMA_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_K_RCURVE_in_functionHeader241 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_RCURVE_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_K_LCURLY_in_block376 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_LCURLY_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_K_RCURLY_in_block416 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_RCURLY_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_K_SEMICOLON_in_stat459 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_SEMICOLON_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_K_SEMICOLON_in_stat478 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_SEMICOLON_in_stat478_data Count:(NSUInteger)1] retain];
- FOLLOW_K_SEMICOLON_in_stat487 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_SEMICOLON_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_K_LCURVE_in_forStat509 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_LCURVE_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_K_SEMICOLON_in_forStat515 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_SEMICOLON_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_K_SEMICOLON_in_forStat519 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_SEMICOLON_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_K_RCURVE_in_forStat525 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_RCURVE_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_K_LCURVE_in_atom708 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_LCURVE_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_K_RCURVE_in_atom712 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_RCURVE_in_atom712_data Count:(NSUInteger)1] retain];
- [ANTLRBaseRecognizer setTokenNames:[[AMutableArray arrayWithObjects:@"<invalid>", @"<EOR>", @"<DOWN>", @"<UP>",
- @"ARG_DEF", @"BLOCK", @"FUNC_DECL", @"FUNC_DEF", @"FUNC_HDR", @"K_CHAR",
- @"K_COMMA", @"K_EQ", @"K_EQEQ", @"K_FOR", @"K_ID", @"K_INT", @"K_INT_TYPE",
- @"K_LCURLY", @"K_LCURVE", @"K_LT", @"K_PLUS", @"K_RCURLY", @"K_RCURVE",
- @"K_SEMICOLON", @"K_VOID", @"VAR_DEF", @"WS", 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 */
- /* AST genericParser.init */
- [self setTreeAdaptor:[[ANTLRCommonTreeAdaptor newTreeAdaptor] retain]];
- }
- return self;
- }
- - (void) dealloc
- {
- [dfa2 release];
- /* AST genericParser.dealloc */
- [self setTreeAdaptor:nil];
- [super dealloc];
- }
- /* ObjC start members */
- /* ObjC end members */
- /* ObjC start actions.(actionScope).methods */
- /* ObjC end actions.(actionScope).methods */
- /* ObjC start methods() */
- /* AST genericParser.methods */
- /* AST parserMethods */
- - (id<ANTLRTreeAdaptor>) getTreeAdaptor
- {
- return treeAdaptor;
- }
- - (void) setTreeAdaptor:(id<ANTLRTreeAdaptor>)aTreeAdaptor
- {
- if (aTreeAdaptor != treeAdaptor) {
- treeAdaptor = aTreeAdaptor;
- }
- }
- /* ObjC end methods() */
- /* ObjC start rules */
- /*
- * $ANTLR start program
- * SimpleC.g:16:1: program : ( declaration )+ ;
- */
- - (SimpleCParser_program_return *) program
- {
- /* my ruleScopeSetUp */
- /* Terence's stuff */
- /* 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 ;
-
- // SimpleC.g:17:5: ( ( declaration )+ ) // ruleBlockSingleAlt
- // SimpleC.g:17:9: ( declaration )+ // alt
- {
- root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
- // SimpleC.g:17:9: ( declaration )+ // positiveClosureBlock
- NSInteger cnt1 = 0;
- do {
- NSInteger alt1 = 2;
- NSInteger LA1_0 = [input LA:1];
- if ( (LA1_0==K_CHAR||LA1_0==K_ID||LA1_0==K_INT_TYPE||LA1_0==K_VOID) ) {
- alt1=1;
- }
- switch (alt1) {
- case 1 : ;
- // SimpleC.g:17:9: declaration // alt
- {
- /* ASTParser ruleRef */
- /* ruleRef */
- [self pushFollow:FOLLOW_declaration_in_program85];
- declaration1 = [self declaration];
- [self popFollow];
- [treeAdaptor addChild:[declaration1 getTree] toTree:root_0];
- }
- break;
- default :
- if ( cnt1 >= 1 )
- goto loop1;
- ANTLREarlyExitException *eee =
- [ANTLREarlyExitException newException:input decisionNumber:1];
- @throw eee;
- }
- cnt1++;
- } while (YES);
- loop1: ;
- }
- /* 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.start 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.start To:[input LT:-1] Exception:re];
- }
- @finally {
- /* Terence's stuff */
- }
- return retval;
- }
- /* $ANTLR end program */
- /*
- * $ANTLR start declaration
- * SimpleC.g:20:1: declaration : ( variable | functionHeader K_SEMICOLON -> ^( FUNC_DECL functionHeader ) | functionHeader block -> ^( FUNC_DEF functionHeader block ) );
- */
- - (SimpleCParser_declaration_return *) declaration
- {
- /* my ruleScopeSetUp */
- /* Terence's stuff */
- /* 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 *K_SEMICOLON4 = nil;
- SimpleCParser_variable_return * variable2 = nil ;
-
- SimpleCParser_functionHeader_return * functionHeader3 = nil ;
-
- SimpleCParser_functionHeader_return * functionHeader5 = nil ;
-
- SimpleCParser_block_return * block6 = nil ;
-
- ANTLRCommonTree *K_SEMICOLON4_tree=nil;
- ANTLRRewriteRuleTokenStream *stream_K_SEMICOLON =
- [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
- description:@"token K_SEMICOLON"] retain];
- ANTLRRewriteRuleSubtreeStream *stream_functionHeader =
- [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
- description:@"rule functionHeader"] retain];
- ANTLRRewriteRuleSubtreeStream *stream_block =
- [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
- description:@"rule block"] retain];
- // SimpleC.g:21:5: ( variable | functionHeader K_SEMICOLON -> ^( FUNC_DECL functionHeader ) | functionHeader block -> ^( FUNC_DEF functionHeader block ) ) //ruleblock
- NSInteger alt2=3;
- alt2 = [dfa2 predict:input];
- switch (alt2) {
- case 1 : ;
- // SimpleC.g:21:9: variable // alt
- {
- root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
- /* ASTParser ruleRef */
- /* ruleRef */
- [self pushFollow:FOLLOW_variable_in_declaration105];
- variable2 = [self variable];
- [self popFollow];
- [treeAdaptor addChild:[variable2 getTree] toTree:root_0];
- }
- break;
- case 2 : ;
- // SimpleC.g:22:9: functionHeader K_SEMICOLON // alt
- {
- /* ruleRef */
- [self pushFollow:FOLLOW_functionHeader_in_declaration115];
- functionHeader3 = [self functionHeader];
- [self popFollow];
- [stream_functionHeader addElement:[functionHeader3 getTree]];
- K_SEMICOLON4=(ANTLRCommonToken *)[self match:input TokenType:K_SEMICOLON Follow:FOLLOW_K_SEMICOLON_in_declaration117];
- [stream_K_SEMICOLON addElement:K_SEMICOLON4];
- // AST REWRITE
- // elements: functionHeader
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- 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:36: -> ^( FUNC_DECL functionHeader )
- {
- // SimpleC.g:22:39: ^( FUNC_DECL functionHeader )
- {
- ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
- root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:
- [treeAdaptor createTree:FUNC_DECL Text:@"FUNC_DECL"]
- 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 : ;
- // SimpleC.g:23:9: functionHeader block // alt
- {
- /* ruleRef */
- [self pushFollow:FOLLOW_functionHeader_in_declaration135];
- functionHeader5 = [self functionHeader];
- [self popFollow];
- [stream_functionHeader addElement:[functionHeader5 getTree]];
- /* ruleRef */
- [self pushFollow:FOLLOW_block_in_declaration137];
- block6 = [self block];
- [self popFollow];
- [stream_block addElement:[block6 getTree]];
- // AST REWRITE
- // elements: functionHeader, block
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- 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 )
- {
- // SimpleC.g:23:33: ^( FUNC_DEF functionHeader block )
- {
- ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
- root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:
- [treeAdaptor createTree:FUNC_DEF Text:@"FUNC_DEF"]
- 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_K_SEMICOLON release];
- [stream_functionHeader release];
- [stream_block release];
- retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
- [treeAdaptor setTokenBoundaries:retval.tree From:retval.start 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.start To:[input LT:-1] Exception:re];
- }
- @finally {
- /* Terence's stuff */
- }
- return retval;
- }
- /* $ANTLR end declaration */
- /*
- * $ANTLR start variable
- * SimpleC.g:26:1: variable : type declarator K_SEMICOLON -> ^( VAR_DEF type declarator ) ;
- */
- - (SimpleCParser_variable_return *) variable
- {
- /* my ruleScopeSetUp */
- /* Terence's stuff */
- /* 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 *K_SEMICOLON9 = nil;
- SimpleCParser_type_return * type7 = nil ;
-
- SimpleCParser_declarator_return * declarator8 = nil ;
-
- ANTLRCommonTree *K_SEMICOLON9_tree=nil;
- ANTLRRewriteRuleTokenStream *stream_K_SEMICOLON =
- [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
- description:@"token K_SEMICOLON"] retain];
- ANTLRRewriteRuleSubtreeStream *stream_declarator =
- [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
- description:@"rule declarator"] retain];
- ANTLRRewriteRuleSubtreeStream *stream_type =
- [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
- description:@"rule type"] retain];
- // SimpleC.g:27:5: ( type declarator K_SEMICOLON -> ^( VAR_DEF type declarator ) ) // ruleBlockSingleAlt
- // SimpleC.g:27:9: type declarator K_SEMICOLON // alt
- {
- /* ruleRef */
- [self pushFollow:FOLLOW_type_in_variable166];
- type7 = [self type];
- [self popFollow];
- [stream_type addElement:[type7 getTree]];
- /* ruleRef */
- [self pushFollow:FOLLOW_declarator_in_variable168];
- declarator8 = [self declarator];
- [self popFollow];
- [stream_declarator addElement:[declarator8 getTree]];
- K_SEMICOLON9=(ANTLRCommonToken *)[self match:input TokenType:K_SEMICOLON Follow:FOLLOW_K_SEMICOLON_in_variable170];
- [stream_K_SEMICOLON addElement:K_SEMICOLON9];
- // AST REWRITE
- // elements: declarator, type
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- 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:37: -> ^( VAR_DEF type declarator )
- {
- // SimpleC.g:27:40: ^( VAR_DEF type declarator )
- {
- ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
- root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:
- [treeAdaptor createTree:VAR_DEF Text:@"VAR_DEF"]
- 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_K_SEMICOLON release];
- [stream_declarator release];
- [stream_type release];
- retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
- [treeAdaptor setTokenBoundaries:retval.tree From:retval.start 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.start To:[input LT:-1] Exception:re];
- }
- @finally {
- /* Terence's stuff */
- }
- return retval;
- }
- /* $ANTLR end variable */
- /*
- * $ANTLR start declarator
- * SimpleC.g:30:1: declarator : K_ID ;
- */
- - (SimpleCParser_declarator_return *) declarator
- {
- /* my ruleScopeSetUp */
- /* Terence's stuff */
- /* 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;
- // SimpleC.g:31:5: ( K_ID ) // ruleBlockSingleAlt
- // 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 create:K_ID10] retain]
- ;
- [treeAdaptor addChild:K_ID10_tree toTree:root_0];
- }
- /* ASTParser ruleCleanUp */
- /* AST ruleCleanUp */
- // token+rule list