1305 lines
44 KiB
Objective-C
1305 lines
44 KiB
Objective-C
/** \file
|
|
* This OBJC source file was generated by $ANTLR version 3.4
|
|
*
|
|
* - From the grammar source file : /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g
|
|
* - On : 2012-02-16 17:56:35
|
|
* - for the tree parser : SimpleCWalkerTreeParser
|
|
*
|
|
* Editing it, at least manually, is not wise.
|
|
*
|
|
* ObjC language generator and runtime by Alan Condit, acondit|hereisanat|ipns|dotgoeshere|com.
|
|
*
|
|
*
|
|
*/
|
|
// $ANTLR 3.4 /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g 2012-02-16 17:56:35
|
|
|
|
|
|
/* -----------------------------------------
|
|
* Include the ANTLR3 generated header file.
|
|
*/
|
|
#import "SimpleCWalker.h"
|
|
/* ----------------------------------------- */
|
|
|
|
|
|
/* ============================================================================= */
|
|
/* =============================================================================
|
|
* Start of recognizer
|
|
*/
|
|
|
|
#pragma mark Bitsets
|
|
static ANTLRBitSet *FOLLOW_declaration_in_program56;
|
|
static const unsigned long long FOLLOW_declaration_in_program56_data[] = { 0x00000000020000C2LL};
|
|
static ANTLRBitSet *FOLLOW_variable_in_declaration76;
|
|
static const unsigned long long FOLLOW_variable_in_declaration76_data[] = { 0x0000000000000002LL};
|
|
static ANTLRBitSet *FOLLOW_FUNC_DECL_in_declaration87;
|
|
static const unsigned long long FOLLOW_FUNC_DECL_in_declaration87_data[] = { 0x0000000000000004LL};
|
|
static ANTLRBitSet *FOLLOW_functionHeader_in_declaration89;
|
|
static const unsigned long long FOLLOW_functionHeader_in_declaration89_data[] = { 0x0000000000000008LL};
|
|
static ANTLRBitSet *FOLLOW_FUNC_DEF_in_declaration101;
|
|
static const unsigned long long FOLLOW_FUNC_DEF_in_declaration101_data[] = { 0x0000000000000004LL};
|
|
static ANTLRBitSet *FOLLOW_functionHeader_in_declaration103;
|
|
static const unsigned long long FOLLOW_functionHeader_in_declaration103_data[] = { 0x0000000000000020LL};
|
|
static ANTLRBitSet *FOLLOW_block_in_declaration105;
|
|
static const unsigned long long FOLLOW_block_in_declaration105_data[] = { 0x0000000000000008LL};
|
|
static ANTLRBitSet *FOLLOW_VAR_DEF_in_variable126;
|
|
static const unsigned long long FOLLOW_VAR_DEF_in_variable126_data[] = { 0x0000000000000004LL};
|
|
static ANTLRBitSet *FOLLOW_type_in_variable128;
|
|
static const unsigned long long FOLLOW_type_in_variable128_data[] = { 0x0000000000004000LL};
|
|
static ANTLRBitSet *FOLLOW_declarator_in_variable130;
|
|
static const unsigned long long FOLLOW_declarator_in_variable130_data[] = { 0x0000000000000008LL};
|
|
static ANTLRBitSet *FOLLOW_K_ID_in_declarator150;
|
|
static const unsigned long long FOLLOW_K_ID_in_declarator150_data[] = { 0x0000000000000002LL};
|
|
static ANTLRBitSet *FOLLOW_FUNC_HDR_in_functionHeader171;
|
|
static const unsigned long long FOLLOW_FUNC_HDR_in_functionHeader171_data[] = { 0x0000000000000004LL};
|
|
static ANTLRBitSet *FOLLOW_type_in_functionHeader173;
|
|
static const unsigned long long FOLLOW_type_in_functionHeader173_data[] = { 0x0000000000004000LL};
|
|
static ANTLRBitSet *FOLLOW_K_ID_in_functionHeader175;
|
|
static const unsigned long long FOLLOW_K_ID_in_functionHeader175_data[] = { 0x0000000000000010LL};
|
|
static ANTLRBitSet *FOLLOW_formalParameter_in_functionHeader177;
|
|
static const unsigned long long FOLLOW_formalParameter_in_functionHeader177_data[] = { 0x0000000000000018LL};
|
|
static ANTLRBitSet *FOLLOW_ARG_DEF_in_formalParameter199;
|
|
static const unsigned long long FOLLOW_ARG_DEF_in_formalParameter199_data[] = { 0x0000000000000004LL};
|
|
static ANTLRBitSet *FOLLOW_type_in_formalParameter201;
|
|
static const unsigned long long FOLLOW_type_in_formalParameter201_data[] = { 0x0000000000004000LL};
|
|
static ANTLRBitSet *FOLLOW_declarator_in_formalParameter203;
|
|
static const unsigned long long FOLLOW_declarator_in_formalParameter203_data[] = { 0x0000000000000008LL};
|
|
static ANTLRBitSet *FOLLOW_BLOCK_in_block283;
|
|
static const unsigned long long FOLLOW_BLOCK_in_block283_data[] = { 0x0000000000000004LL};
|
|
static ANTLRBitSet *FOLLOW_variable_in_block285;
|
|
static const unsigned long long FOLLOW_variable_in_block285_data[] = { 0x000000000218F828LL};
|
|
static ANTLRBitSet *FOLLOW_stat_in_block288;
|
|
static const unsigned long long FOLLOW_stat_in_block288_data[] = { 0x000000000018F828LL};
|
|
static ANTLRBitSet *FOLLOW_forStat_in_stat302;
|
|
static const unsigned long long FOLLOW_forStat_in_stat302_data[] = { 0x0000000000000002LL};
|
|
static ANTLRBitSet *FOLLOW_expr_in_stat310;
|
|
static const unsigned long long FOLLOW_expr_in_stat310_data[] = { 0x0000000000000002LL};
|
|
static ANTLRBitSet *FOLLOW_block_in_stat318;
|
|
static const unsigned long long FOLLOW_block_in_stat318_data[] = { 0x0000000000000002LL};
|
|
static ANTLRBitSet *FOLLOW_K_FOR_in_forStat338;
|
|
static const unsigned long long FOLLOW_K_FOR_in_forStat338_data[] = { 0x0000000000000004LL};
|
|
static ANTLRBitSet *FOLLOW_expr_in_forStat340;
|
|
static const unsigned long long FOLLOW_expr_in_forStat340_data[] = { 0x000000000018D800LL};
|
|
static ANTLRBitSet *FOLLOW_expr_in_forStat342;
|
|
static const unsigned long long FOLLOW_expr_in_forStat342_data[] = { 0x000000000018D800LL};
|
|
static ANTLRBitSet *FOLLOW_expr_in_forStat344;
|
|
static const unsigned long long FOLLOW_expr_in_forStat344_data[] = { 0x0000000000000020LL};
|
|
static ANTLRBitSet *FOLLOW_block_in_forStat346;
|
|
static const unsigned long long FOLLOW_block_in_forStat346_data[] = { 0x0000000000000008LL};
|
|
static ANTLRBitSet *FOLLOW_K_EQEQ_in_expr362;
|
|
static const unsigned long long FOLLOW_K_EQEQ_in_expr362_data[] = { 0x0000000000000004LL};
|
|
static ANTLRBitSet *FOLLOW_expr_in_expr364;
|
|
static const unsigned long long FOLLOW_expr_in_expr364_data[] = { 0x000000000018D800LL};
|
|
static ANTLRBitSet *FOLLOW_expr_in_expr366;
|
|
static const unsigned long long FOLLOW_expr_in_expr366_data[] = { 0x0000000000000008LL};
|
|
static ANTLRBitSet *FOLLOW_K_LT_in_expr378;
|
|
static const unsigned long long FOLLOW_K_LT_in_expr378_data[] = { 0x0000000000000004LL};
|
|
static ANTLRBitSet *FOLLOW_expr_in_expr380;
|
|
static const unsigned long long FOLLOW_expr_in_expr380_data[] = { 0x000000000018D800LL};
|
|
static ANTLRBitSet *FOLLOW_expr_in_expr382;
|
|
static const unsigned long long FOLLOW_expr_in_expr382_data[] = { 0x0000000000000008LL};
|
|
static ANTLRBitSet *FOLLOW_K_PLUS_in_expr394;
|
|
static const unsigned long long FOLLOW_K_PLUS_in_expr394_data[] = { 0x0000000000000004LL};
|
|
static ANTLRBitSet *FOLLOW_expr_in_expr396;
|
|
static const unsigned long long FOLLOW_expr_in_expr396_data[] = { 0x000000000018D800LL};
|
|
static ANTLRBitSet *FOLLOW_expr_in_expr398;
|
|
static const unsigned long long FOLLOW_expr_in_expr398_data[] = { 0x0000000000000008LL};
|
|
static ANTLRBitSet *FOLLOW_K_EQ_in_expr410;
|
|
static const unsigned long long FOLLOW_K_EQ_in_expr410_data[] = { 0x0000000000000004LL};
|
|
static ANTLRBitSet *FOLLOW_K_ID_in_expr412;
|
|
static const unsigned long long FOLLOW_K_ID_in_expr412_data[] = { 0x000000000018D800LL};
|
|
static ANTLRBitSet *FOLLOW_expr_in_expr416;
|
|
static const unsigned long long FOLLOW_expr_in_expr416_data[] = { 0x0000000000000008LL};
|
|
static ANTLRBitSet *FOLLOW_atom_in_expr429;
|
|
static const unsigned long long FOLLOW_atom_in_expr429_data[] = { 0x0000000000000002LL};
|
|
|
|
|
|
#pragma mark Dynamic Global globalAttributeScopeImplementation
|
|
@implementation Symbols_Scope /* globalAttributeScopeImplementation */
|
|
/* start of synthesize -- OBJC-Line 1750 */
|
|
@synthesize tree;
|
|
|
|
+ (Symbols_Scope *)newSymbols_Scope
|
|
{
|
|
return [[Symbols_Scope alloc] init];
|
|
}
|
|
|
|
- (id) init
|
|
{
|
|
self = [super init];
|
|
return self;
|
|
}
|
|
|
|
/* start of iterate get and set functions */
|
|
- (CommonTree *)gettree { return( tree ); }
|
|
- (void)settree:(CommonTree *)aVal { tree = aVal; }
|
|
|
|
/* End of iterate get and set functions */
|
|
@end /* end of Symbols_Scope implementation */
|
|
|
|
|
|
|
|
#pragma mark Dynamic Rule Scopes ruleAttributeScopeImplementation
|
|
|
|
#pragma mark Rule Return Scopes returnScopeImplementation
|
|
@implementation SimpleCWalker_expr_return /* returnScopeImplementation */
|
|
/* start of synthesize -- OBJC-Line 1837 */
|
|
+ (SimpleCWalker_expr_return *)newSimpleCWalker_expr_return
|
|
{
|
|
return [[[SimpleCWalker_expr_return alloc] init] retain];
|
|
}
|
|
|
|
- (id) init
|
|
{
|
|
self = [super init];
|
|
return self;
|
|
}
|
|
|
|
|
|
|
|
@end /* end of returnScope implementation */
|
|
|
|
|
|
|
|
@implementation SimpleCWalker // line 637
|
|
|
|
/* ObjC start of ruleAttributeScope */
|
|
#pragma mark Dynamic Rule Scopes ruleAttributeScope
|
|
/* ObjC end of ruleAttributeScope */
|
|
#pragma mark global Attribute Scopes globalAttributeScope
|
|
/* ObjC start globalAttributeScope */
|
|
static _stack;
|
|
|
|
/* ObjC end globalAttributeScope */
|
|
/* ObjC start actions.(actionScope).synthesize */
|
|
/* ObjC start synthesize() */
|
|
|
|
+ (void) initialize
|
|
{
|
|
#pragma mark Bitsets
|
|
FOLLOW_declaration_in_program56 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_declaration_in_program56_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_variable_in_declaration76 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_variable_in_declaration76_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_FUNC_DECL_in_declaration87 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_FUNC_DECL_in_declaration87_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_functionHeader_in_declaration89 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_functionHeader_in_declaration89_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_FUNC_DEF_in_declaration101 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_FUNC_DEF_in_declaration101_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_functionHeader_in_declaration103 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_functionHeader_in_declaration103_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_block_in_declaration105 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_declaration105_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_VAR_DEF_in_variable126 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_VAR_DEF_in_variable126_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_type_in_variable128 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_variable128_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_declarator_in_variable130 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_variable130_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_K_ID_in_declarator150 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_K_ID_in_declarator150_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_FUNC_HDR_in_functionHeader171 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_FUNC_HDR_in_functionHeader171_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_type_in_functionHeader173 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_functionHeader173_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_K_ID_in_functionHeader175 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_K_ID_in_functionHeader175_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_formalParameter_in_functionHeader177 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_formalParameter_in_functionHeader177_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_ARG_DEF_in_formalParameter199 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_ARG_DEF_in_formalParameter199_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_type_in_formalParameter201 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_formalParameter201_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_declarator_in_formalParameter203 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_formalParameter203_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_BLOCK_in_block283 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_BLOCK_in_block283_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_variable_in_block285 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_variable_in_block285_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_stat_in_block288 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_stat_in_block288_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_forStat_in_stat302 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_forStat_in_stat302_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_expr_in_stat310 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_stat310_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_block_in_stat318 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_stat318_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_K_FOR_in_forStat338 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_K_FOR_in_forStat338_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_expr_in_forStat340 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_forStat340_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_expr_in_forStat342 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_forStat342_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_expr_in_forStat344 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_forStat344_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_block_in_forStat346 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_forStat346_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_K_EQEQ_in_expr362 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_K_EQEQ_in_expr362_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_expr_in_expr364 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_expr364_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_expr_in_expr366 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_expr366_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_K_LT_in_expr378 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_K_LT_in_expr378_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_expr_in_expr380 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_expr380_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_expr_in_expr382 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_expr382_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_K_PLUS_in_expr394 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_K_PLUS_in_expr394_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_expr_in_expr396 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_expr396_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_expr_in_expr398 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_expr398_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_K_EQ_in_expr410 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_K_EQ_in_expr410_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_K_ID_in_expr412 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_K_ID_in_expr412_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_expr_in_expr416 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_expr416_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_atom_in_expr429 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_atom_in_expr429_data Count:(NSUInteger)1] retain];
|
|
|
|
[BaseRecognizer 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]];
|
|
[BaseRecognizer setGrammarFileName:@"/Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g"];
|
|
}
|
|
|
|
+ (SimpleCWalker *)newSimpleCWalker:(id<TreeNodeStream>)aStream
|
|
{
|
|
return [[SimpleCWalker alloc] initWithStream:aStream];
|
|
}
|
|
|
|
- (id) initWithStream:(id<TreeNodeStream>)aStream
|
|
{
|
|
self = [super initWithStream:aStream State:[[RecognizerSharedState newRecognizerSharedStateWithRuleLen:12+1] retain]];
|
|
if ( self != nil ) {
|
|
/* globalAttributeScopeInit */
|
|
|
|
Symbols_scope = [Symbols_Scope newSymbols_Scope];
|
|
|
|
Symbols_stack = [SymbolStack newSymbolStackWithLen:30];
|
|
|
|
/* start of actions-actionScope-init */
|
|
/* start of init */
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void) dealloc
|
|
{
|
|
[Symbols_stack release];
|
|
|
|
[super dealloc];
|
|
}
|
|
|
|
/* ObjC start actions.(actionScope).methods */
|
|
/* ObjC end actions.(actionScope).methods */
|
|
/* ObjC start methods() */
|
|
/* ObjC end methods() */
|
|
/* ObjC start rules */
|
|
/*
|
|
* $ANTLR start program
|
|
* /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:13:1: program : ( declaration )+ ;
|
|
*/
|
|
- (void) program
|
|
{
|
|
/* ruleScopeSetUp */
|
|
|
|
/* ruleDeclarations */
|
|
|
|
@try {
|
|
/* ruleLabelDefs entry */
|
|
|
|
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:14:5: ( ( declaration )+ ) // ruleBlockSingleAlt
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:14:9: ( declaration )+ // alt
|
|
{
|
|
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:14:9: ( declaration )+ // positiveClosureBlock
|
|
NSInteger cnt1 = 0;
|
|
do {
|
|
NSInteger alt1 = 2;
|
|
NSInteger LA1_0 = [input LA:1];
|
|
if ( ((LA1_0 >= FUNC_DECL && LA1_0 <= FUNC_DEF)||LA1_0==VAR_DEF) ) {
|
|
alt1=1;
|
|
}
|
|
|
|
|
|
switch (alt1) {
|
|
case 1 : ;
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:14:9: declaration // alt
|
|
{
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_declaration_in_program56];
|
|
[self declaration];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
}
|
|
break;
|
|
|
|
default :
|
|
if ( cnt1 >= 1 )
|
|
goto loop1;
|
|
EarlyExitException *eee =
|
|
[EarlyExitException newException:input decisionNumber:1];
|
|
@throw eee;
|
|
}
|
|
cnt1++;
|
|
} while (YES);
|
|
loop1: ;
|
|
|
|
|
|
}
|
|
|
|
/* token+rule list labels */
|
|
|
|
}
|
|
@catch (RecognitionException *re) {
|
|
[self reportError:re];
|
|
[self recover:input Exception:re];
|
|
}
|
|
|
|
@finally {
|
|
/* ruleScopeCleanUp */
|
|
|
|
}
|
|
return ;
|
|
}
|
|
/* $ANTLR end program */
|
|
|
|
/*
|
|
* $ANTLR start declaration
|
|
* /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:17:1: declaration : ( variable | ^( FUNC_DECL functionHeader ) | ^( FUNC_DEF functionHeader block ) );
|
|
*/
|
|
- (void) declaration
|
|
{
|
|
/* ruleScopeSetUp */
|
|
|
|
/* ruleDeclarations */
|
|
|
|
@try {
|
|
/* ruleLabelDefs entry */
|
|
|
|
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:18:5: ( variable | ^( FUNC_DECL functionHeader ) | ^( FUNC_DEF functionHeader block ) ) //ruleblock
|
|
NSInteger alt2=3;
|
|
unichar charLA2 = [input LA:1];
|
|
switch (charLA2) {
|
|
case VAR_DEF: ;
|
|
{
|
|
alt2=1;
|
|
}
|
|
break;
|
|
case FUNC_DECL: ;
|
|
{
|
|
alt2=2;
|
|
}
|
|
break;
|
|
case FUNC_DEF: ;
|
|
{
|
|
alt2=3;
|
|
}
|
|
break;
|
|
|
|
default: ;
|
|
NoViableAltException *nvae = [NoViableAltException newException:2 state:0 stream:input];
|
|
nvae.c = charLA2;
|
|
@throw nvae;
|
|
|
|
}
|
|
|
|
switch (alt2) {
|
|
case 1 : ;
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:18:9: variable // alt
|
|
{
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_variable_in_declaration76];
|
|
[self variable];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
}
|
|
break;
|
|
case 2 : ;
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:19:9: ^( FUNC_DECL functionHeader ) // alt
|
|
{
|
|
|
|
|
|
[self match:input TokenType:FUNC_DECL Follow:FOLLOW_FUNC_DECL_in_declaration87];
|
|
|
|
[self match:input TokenType:DOWN Follow:nil];
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_functionHeader_in_declaration89];
|
|
[self functionHeader];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
[self match:input TokenType:UP Follow:nil];
|
|
|
|
|
|
}
|
|
break;
|
|
case 3 : ;
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:20:9: ^( FUNC_DEF functionHeader block ) // alt
|
|
{
|
|
|
|
|
|
[self match:input TokenType:FUNC_DEF Follow:FOLLOW_FUNC_DEF_in_declaration101];
|
|
|
|
[self match:input TokenType:DOWN Follow:nil];
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_functionHeader_in_declaration103];
|
|
[self functionHeader];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_block_in_declaration105];
|
|
[self block];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
[self match:input TokenType:UP Follow:nil];
|
|
|
|
|
|
}
|
|
break;
|
|
|
|
}
|
|
/* token+rule list labels */
|
|
|
|
}
|
|
@catch (RecognitionException *re) {
|
|
[self reportError:re];
|
|
[self recover:input Exception:re];
|
|
}
|
|
|
|
@finally {
|
|
/* ruleScopeCleanUp */
|
|
|
|
}
|
|
return ;
|
|
}
|
|
/* $ANTLR end declaration */
|
|
|
|
/*
|
|
* $ANTLR start variable
|
|
* /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:23:1: variable : ^( VAR_DEF type declarator ) ;
|
|
*/
|
|
- (void) variable
|
|
{
|
|
/* ruleScopeSetUp */
|
|
|
|
/* ruleDeclarations */
|
|
|
|
@try {
|
|
/* ruleLabelDefs entry */
|
|
|
|
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:24:5: ( ^( VAR_DEF type declarator ) ) // ruleBlockSingleAlt
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:24:9: ^( VAR_DEF type declarator ) // alt
|
|
{
|
|
|
|
|
|
[self match:input TokenType:VAR_DEF Follow:FOLLOW_VAR_DEF_in_variable126];
|
|
|
|
[self match:input TokenType:DOWN Follow:nil];
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_type_in_variable128];
|
|
[self type];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_declarator_in_variable130];
|
|
[self declarator];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
[self match:input TokenType:UP Follow:nil];
|
|
|
|
|
|
}
|
|
|
|
/* token+rule list labels */
|
|
|
|
}
|
|
@catch (RecognitionException *re) {
|
|
[self reportError:re];
|
|
[self recover:input Exception:re];
|
|
}
|
|
|
|
@finally {
|
|
/* ruleScopeCleanUp */
|
|
|
|
}
|
|
return ;
|
|
}
|
|
/* $ANTLR end variable */
|
|
|
|
/*
|
|
* $ANTLR start declarator
|
|
* /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:27:1: declarator : K_ID ;
|
|
*/
|
|
- (void) declarator
|
|
{
|
|
/* ruleScopeSetUp */
|
|
|
|
/* ruleDeclarations */
|
|
|
|
@try {
|
|
/* ruleLabelDefs entry */
|
|
|
|
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:28:5: ( K_ID ) // ruleBlockSingleAlt
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:28:9: K_ID // alt
|
|
{
|
|
|
|
[self match:input TokenType:K_ID Follow:FOLLOW_K_ID_in_declarator150];
|
|
|
|
}
|
|
|
|
/* token+rule list labels */
|
|
|
|
}
|
|
@catch (RecognitionException *re) {
|
|
[self reportError:re];
|
|
[self recover:input Exception:re];
|
|
}
|
|
|
|
@finally {
|
|
/* ruleScopeCleanUp */
|
|
|
|
}
|
|
return ;
|
|
}
|
|
/* $ANTLR end declarator */
|
|
|
|
/*
|
|
* $ANTLR start functionHeader
|
|
* /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:31:1: functionHeader : ^( FUNC_HDR type K_ID ( formalParameter )+ ) ;
|
|
*/
|
|
- (void) functionHeader
|
|
{
|
|
/* ruleScopeSetUp */
|
|
|
|
/* ruleDeclarations */
|
|
|
|
@try {
|
|
/* ruleLabelDefs entry */
|
|
|
|
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:32:5: ( ^( FUNC_HDR type K_ID ( formalParameter )+ ) ) // ruleBlockSingleAlt
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:32:9: ^( FUNC_HDR type K_ID ( formalParameter )+ ) // alt
|
|
{
|
|
|
|
|
|
[self match:input TokenType:FUNC_HDR Follow:FOLLOW_FUNC_HDR_in_functionHeader171];
|
|
|
|
[self match:input TokenType:DOWN Follow:nil];
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_type_in_functionHeader173];
|
|
[self type];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
[self match:input TokenType:K_ID Follow:FOLLOW_K_ID_in_functionHeader175];
|
|
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:32:30: ( formalParameter )+ // positiveClosureBlock
|
|
NSInteger cnt3 = 0;
|
|
do {
|
|
NSInteger alt3 = 2;
|
|
NSInteger LA3_0 = [input LA:1];
|
|
if ( (LA3_0==ARG_DEF) ) {
|
|
alt3=1;
|
|
}
|
|
|
|
|
|
switch (alt3) {
|
|
case 1 : ;
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:32:30: formalParameter // alt
|
|
{
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_formalParameter_in_functionHeader177];
|
|
[self formalParameter];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
}
|
|
break;
|
|
|
|
default :
|
|
if ( cnt3 >= 1 )
|
|
goto loop3;
|
|
EarlyExitException *eee =
|
|
[EarlyExitException newException:input decisionNumber:3];
|
|
@throw eee;
|
|
}
|
|
cnt3++;
|
|
} while (YES);
|
|
loop3: ;
|
|
|
|
|
|
[self match:input TokenType:UP Follow:nil];
|
|
|
|
|
|
}
|
|
|
|
/* token+rule list labels */
|
|
|
|
}
|
|
@catch (RecognitionException *re) {
|
|
[self reportError:re];
|
|
[self recover:input Exception:re];
|
|
}
|
|
|
|
@finally {
|
|
/* ruleScopeCleanUp */
|
|
|
|
}
|
|
return ;
|
|
}
|
|
/* $ANTLR end functionHeader */
|
|
|
|
/*
|
|
* $ANTLR start formalParameter
|
|
* /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:35:1: formalParameter : ^( ARG_DEF type declarator ) ;
|
|
*/
|
|
- (void) formalParameter
|
|
{
|
|
/* ruleScopeSetUp */
|
|
|
|
/* ruleDeclarations */
|
|
|
|
@try {
|
|
/* ruleLabelDefs entry */
|
|
|
|
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:36:5: ( ^( ARG_DEF type declarator ) ) // ruleBlockSingleAlt
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:36:9: ^( ARG_DEF type declarator ) // alt
|
|
{
|
|
|
|
|
|
[self match:input TokenType:ARG_DEF Follow:FOLLOW_ARG_DEF_in_formalParameter199];
|
|
|
|
[self match:input TokenType:DOWN Follow:nil];
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_type_in_formalParameter201];
|
|
[self type];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_declarator_in_formalParameter203];
|
|
[self declarator];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
[self match:input TokenType:UP Follow:nil];
|
|
|
|
|
|
}
|
|
|
|
/* token+rule list labels */
|
|
|
|
}
|
|
@catch (RecognitionException *re) {
|
|
[self reportError:re];
|
|
[self recover:input Exception:re];
|
|
}
|
|
|
|
@finally {
|
|
/* ruleScopeCleanUp */
|
|
|
|
}
|
|
return ;
|
|
}
|
|
/* $ANTLR end formalParameter */
|
|
|
|
/*
|
|
* $ANTLR start type
|
|
* /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:39:1: type : ( K_INT_TYPE | K_CHAR | K_VOID | K_ID );
|
|
*/
|
|
- (void) type
|
|
{
|
|
/* ruleScopeSetUp */
|
|
|
|
/* ruleDeclarations */
|
|
|
|
@try {
|
|
/* ruleLabelDefs entry */
|
|
|
|
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:40:5: ( K_INT_TYPE | K_CHAR | K_VOID | K_ID ) // ruleBlockSingleAlt
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g: // alt
|
|
{
|
|
|
|
if ([input LA:1] == K_CHAR||[input LA:1] == K_ID||[input LA:1] == K_INT_TYPE||[input LA:1] == K_VOID) {
|
|
[input consume];
|
|
[state setIsErrorRecovery:NO];
|
|
} else {
|
|
MismatchedSetException *mse = [MismatchedSetException newException:nil stream:input];
|
|
@throw mse;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/* token+rule list labels */
|
|
|
|
}
|
|
@catch (RecognitionException *re) {
|
|
[self reportError:re];
|
|
[self recover:input Exception:re];
|
|
}
|
|
|
|
@finally {
|
|
/* ruleScopeCleanUp */
|
|
|
|
}
|
|
return ;
|
|
}
|
|
/* $ANTLR end type */
|
|
|
|
/*
|
|
* $ANTLR start block
|
|
* /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:46:1: block : ^( BLOCK ( variable )* ( stat )* ) ;
|
|
*/
|
|
- (void) block
|
|
{
|
|
/* ruleScopeSetUp */
|
|
|
|
/* ruleDeclarations */
|
|
|
|
@try {
|
|
/* ruleLabelDefs entry */
|
|
|
|
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:47:5: ( ^( BLOCK ( variable )* ( stat )* ) ) // ruleBlockSingleAlt
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:47:9: ^( BLOCK ( variable )* ( stat )* ) // alt
|
|
{
|
|
|
|
|
|
[self match:input TokenType:BLOCK Follow:FOLLOW_BLOCK_in_block283];
|
|
|
|
if ( [input LA:1] == DOWN ) {
|
|
[self match:input TokenType:DOWN Follow:nil];
|
|
|
|
|
|
do {
|
|
NSInteger alt4=2;
|
|
NSInteger LA4_0 = [input LA:1];
|
|
if ( (LA4_0==VAR_DEF) ) {
|
|
alt4=1;
|
|
}
|
|
|
|
|
|
switch (alt4) {
|
|
case 1 : ;
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:47:17: variable // alt
|
|
{
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_variable_in_block285];
|
|
[self variable];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
}
|
|
break;
|
|
|
|
default :
|
|
goto loop4;
|
|
}
|
|
} while (YES);
|
|
loop4: ;
|
|
|
|
|
|
|
|
do {
|
|
NSInteger alt5=2;
|
|
NSInteger LA5_0 = [input LA:1];
|
|
if ( (LA5_0==BLOCK||(LA5_0 >= K_EQ && LA5_0 <= K_INT)||(LA5_0 >= K_LT && LA5_0 <= K_PLUS)) ) {
|
|
alt5=1;
|
|
}
|
|
|
|
|
|
switch (alt5) {
|
|
case 1 : ;
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:47:27: stat // alt
|
|
{
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_stat_in_block288];
|
|
[self stat];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
}
|
|
break;
|
|
|
|
default :
|
|
goto loop5;
|
|
}
|
|
} while (YES);
|
|
loop5: ;
|
|
|
|
|
|
[self match:input TokenType:UP Follow:nil];
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/* token+rule list labels */
|
|
|
|
}
|
|
@catch (RecognitionException *re) {
|
|
[self reportError:re];
|
|
[self recover:input Exception:re];
|
|
}
|
|
|
|
@finally {
|
|
/* ruleScopeCleanUp */
|
|
|
|
}
|
|
return ;
|
|
}
|
|
/* $ANTLR end block */
|
|
|
|
/*
|
|
* $ANTLR start stat
|
|
* /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:50:1: stat : ( forStat | expr | block );
|
|
*/
|
|
- (void) stat
|
|
{
|
|
/* ruleScopeSetUp */
|
|
|
|
/* ruleDeclarations */
|
|
|
|
@try {
|
|
/* ruleLabelDefs entry */
|
|
|
|
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:50:5: ( forStat | expr | block ) //ruleblock
|
|
NSInteger alt6=3;
|
|
unichar charLA6 = [input LA:1];
|
|
switch (charLA6) {
|
|
case K_FOR: ;
|
|
{
|
|
alt6=1;
|
|
}
|
|
break;
|
|
case K_EQ: ;
|
|
case K_EQEQ: ;
|
|
case K_ID: ;
|
|
case K_INT: ;
|
|
case K_LT: ;
|
|
case K_PLUS: ;
|
|
{
|
|
alt6=2;
|
|
}
|
|
break;
|
|
case BLOCK: ;
|
|
{
|
|
alt6=3;
|
|
}
|
|
break;
|
|
|
|
default: ;
|
|
NoViableAltException *nvae = [NoViableAltException newException:6 state:0 stream:input];
|
|
nvae.c = charLA6;
|
|
@throw nvae;
|
|
|
|
}
|
|
|
|
switch (alt6) {
|
|
case 1 : ;
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:50:7: forStat // alt
|
|
{
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_forStat_in_stat302];
|
|
[self forStat];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
}
|
|
break;
|
|
case 2 : ;
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:51:7: expr // alt
|
|
{
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_expr_in_stat310];
|
|
[self expr];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
}
|
|
break;
|
|
case 3 : ;
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:52:7: block // alt
|
|
{
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_block_in_stat318];
|
|
[self block];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
}
|
|
break;
|
|
|
|
}
|
|
/* token+rule list labels */
|
|
|
|
}
|
|
@catch (RecognitionException *re) {
|
|
[self reportError:re];
|
|
[self recover:input Exception:re];
|
|
}
|
|
|
|
@finally {
|
|
/* ruleScopeCleanUp */
|
|
|
|
}
|
|
return ;
|
|
}
|
|
/* $ANTLR end stat */
|
|
|
|
/*
|
|
* $ANTLR start forStat
|
|
* /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:55:1: forStat : ^( K_FOR expr expr expr block ) ;
|
|
*/
|
|
- (void) forStat
|
|
{
|
|
/* ruleScopeSetUp */
|
|
|
|
/* ruleDeclarations */
|
|
|
|
@try {
|
|
/* ruleLabelDefs entry */
|
|
|
|
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:56:5: ( ^( K_FOR expr expr expr block ) ) // ruleBlockSingleAlt
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:56:9: ^( K_FOR expr expr expr block ) // alt
|
|
{
|
|
|
|
|
|
[self match:input TokenType:K_FOR Follow:FOLLOW_K_FOR_in_forStat338];
|
|
|
|
[self match:input TokenType:DOWN Follow:nil];
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_expr_in_forStat340];
|
|
[self expr];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_expr_in_forStat342];
|
|
[self expr];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_expr_in_forStat344];
|
|
[self expr];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_block_in_forStat346];
|
|
[self block];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
[self match:input TokenType:UP Follow:nil];
|
|
|
|
|
|
}
|
|
|
|
/* token+rule list labels */
|
|
|
|
}
|
|
@catch (RecognitionException *re) {
|
|
[self reportError:re];
|
|
[self recover:input Exception:re];
|
|
}
|
|
|
|
@finally {
|
|
/* ruleScopeCleanUp */
|
|
|
|
}
|
|
return ;
|
|
}
|
|
/* $ANTLR end forStat */
|
|
|
|
/*
|
|
* $ANTLR start expr
|
|
* /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:59:1: expr : ( ^( K_EQEQ expr expr ) | ^( K_LT expr expr ) | ^( K_PLUS expr expr ) | ^( K_EQ K_ID e= expr ) | atom );
|
|
*/
|
|
- (SimpleCWalker_expr_return *) expr
|
|
{
|
|
/* ruleScopeSetUp */
|
|
|
|
/* ruleDeclarations */
|
|
SimpleCWalker_expr_return * retval = [SimpleCWalker_expr_return newSimpleCWalker_expr_return];
|
|
[retval setStart:[input LT:1]];
|
|
|
|
|
|
@try {
|
|
/* ruleLabelDefs entry */
|
|
CommonTree *K_ID1 = nil;SimpleCWalker_expr_return * e = nil ;
|
|
|
|
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:59:5: ( ^( K_EQEQ expr expr ) | ^( K_LT expr expr ) | ^( K_PLUS expr expr ) | ^( K_EQ K_ID e= expr ) | atom ) //ruleblock
|
|
NSInteger alt7=5;
|
|
unichar charLA7 = [input LA:1];
|
|
switch (charLA7) {
|
|
case K_EQEQ: ;
|
|
{
|
|
alt7=1;
|
|
}
|
|
break;
|
|
case K_LT: ;
|
|
{
|
|
alt7=2;
|
|
}
|
|
break;
|
|
case K_PLUS: ;
|
|
{
|
|
alt7=3;
|
|
}
|
|
break;
|
|
case K_EQ: ;
|
|
{
|
|
alt7=4;
|
|
}
|
|
break;
|
|
case K_ID: ;
|
|
case K_INT: ;
|
|
{
|
|
alt7=5;
|
|
}
|
|
break;
|
|
|
|
default: ;
|
|
NoViableAltException *nvae = [NoViableAltException newException:7 state:0 stream:input];
|
|
nvae.c = charLA7;
|
|
@throw nvae;
|
|
|
|
}
|
|
|
|
switch (alt7) {
|
|
case 1 : ;
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:59:9: ^( K_EQEQ expr expr ) // alt
|
|
{
|
|
|
|
|
|
[self match:input TokenType:K_EQEQ Follow:FOLLOW_K_EQEQ_in_expr362];
|
|
|
|
[self match:input TokenType:DOWN Follow:nil];
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_expr_in_expr364];
|
|
[self expr];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_expr_in_expr366];
|
|
[self expr];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
[self match:input TokenType:UP Follow:nil];
|
|
|
|
|
|
}
|
|
break;
|
|
case 2 : ;
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:60:9: ^( K_LT expr expr ) // alt
|
|
{
|
|
|
|
|
|
[self match:input TokenType:K_LT Follow:FOLLOW_K_LT_in_expr378];
|
|
|
|
[self match:input TokenType:DOWN Follow:nil];
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_expr_in_expr380];
|
|
[self expr];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_expr_in_expr382];
|
|
[self expr];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
[self match:input TokenType:UP Follow:nil];
|
|
|
|
|
|
}
|
|
break;
|
|
case 3 : ;
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:61:9: ^( K_PLUS expr expr ) // alt
|
|
{
|
|
|
|
|
|
[self match:input TokenType:K_PLUS Follow:FOLLOW_K_PLUS_in_expr394];
|
|
|
|
[self match:input TokenType:DOWN Follow:nil];
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_expr_in_expr396];
|
|
[self expr];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_expr_in_expr398];
|
|
[self expr];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
[self match:input TokenType:UP Follow:nil];
|
|
|
|
|
|
}
|
|
break;
|
|
case 4 : ;
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:62:9: ^( K_EQ K_ID e= expr ) // alt
|
|
{
|
|
|
|
|
|
[self match:input TokenType:K_EQ Follow:FOLLOW_K_EQ_in_expr410];
|
|
|
|
[self match:input TokenType:DOWN Follow:nil];
|
|
|
|
K_ID1=(CommonTree *)[self match:input TokenType:K_ID Follow:FOLLOW_K_ID_in_expr412];
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_expr_in_expr416];
|
|
e = [self expr];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
[self match:input TokenType:UP Follow:nil];
|
|
|
|
|
|
|
|
NSLog(@"assigning %@ to variable %@", (e!=nil?[[input getTokenStream] toStringFromStart:[[input getTreeAdaptor] getTokenStartIndex:[e getStart]]ToEnd:[[input getTreeAdaptor] getTokenStopIndex:[e getStart]]]:0), (K_ID1!=nil?K_ID1.text:nil));
|
|
|
|
|
|
}
|
|
break;
|
|
case 5 : ;
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:63:9: atom // alt
|
|
{
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_atom_in_expr429];
|
|
[self atom];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
}
|
|
break;
|
|
|
|
}
|
|
/* token+rule list labels */
|
|
|
|
}
|
|
@catch (RecognitionException *re) {
|
|
[self reportError:re];
|
|
[self recover:input Exception:re];
|
|
}
|
|
|
|
@finally {
|
|
/* ruleScopeCleanUp */
|
|
|
|
}
|
|
return retval;
|
|
}
|
|
/* $ANTLR end expr */
|
|
|
|
/*
|
|
* $ANTLR start atom
|
|
* /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:66:1: atom : ( K_ID | K_INT );
|
|
*/
|
|
- (void) atom
|
|
{
|
|
/* ruleScopeSetUp */
|
|
|
|
/* ruleDeclarations */
|
|
|
|
@try {
|
|
/* ruleLabelDefs entry */
|
|
|
|
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g:67:5: ( K_ID | K_INT ) // ruleBlockSingleAlt
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/simplecTreeParser/SimpleCWalker.g: // alt
|
|
{
|
|
|
|
if ((([input LA:1] >= K_ID) && ([input LA:1] <= K_INT))) {
|
|
[input consume];
|
|
[state setIsErrorRecovery:NO];
|
|
} else {
|
|
MismatchedSetException *mse = [MismatchedSetException newException:nil stream:input];
|
|
@throw mse;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/* token+rule list labels */
|
|
|
|
}
|
|
@catch (RecognitionException *re) {
|
|
[self reportError:re];
|
|
[self recover:input Exception:re];
|
|
}
|
|
|
|
@finally {
|
|
/* ruleScopeCleanUp */
|
|
|
|
}
|
|
return ;
|
|
}
|
|
/* $ANTLR end atom */
|
|
/* ObjC end rules */
|
|
|
|
@end /* end of SimpleCWalker implementation line 692 */
|