blob: da605a87f10a0d71c8cc06f4894bda4b1efd5048 [file] [log] [blame]
/** \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/LL-star/SimpleC.g
* - On : 2012-02-16 17:39:18
* - 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 3.4 /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g 2012-02-16 17:39:18
/* -----------------------------------------
* Include the ANTLR3 generated header file.
*/
#import "SimpleCParser.h"
/* ----------------------------------------- */
/* ============================================================================= */
/* =============================================================================
* Start of recognizer
*/
#pragma mark Cyclic DFA implementation start DFA2
@implementation DFA2
const static NSInteger dfa2_eot[13] =
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
const static NSInteger dfa2_eof[13] =
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
const static unichar dfa2_min[13] =
{4,4,7,4,-1,4,11,8,-1,-1,4,4,8};
const static unichar dfa2_max[13] =
{18,4,11,18,-1,4,19,10,-1,-1,18,4,10};
const static NSInteger dfa2_accept[13] =
{-1,-1,-1,-1,1,-1,-1,-1,2,3,-1,-1,-1};
const static NSInteger dfa2_special[13] =
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
/** Used when there is no transition table entry for a particular state */
#define dfa2_T_empty nil
const static NSInteger dfa2_T0[] =
{
3, -1, -1, -1, 4
};
const static NSInteger dfa2_T1[] =
{
6, -1, 10
};
const static NSInteger dfa2_T2[] =
{
8, -1, -1, -1, -1, -1, -1, -1, 9
};
const static NSInteger dfa2_T3[] =
{
2
};
const static NSInteger dfa2_T4[] =
{
1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1
};
const static NSInteger dfa2_T5[] =
{
7
};
const static NSInteger dfa2_T6[] =
{
11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, -1, 11, 11
};
const static NSInteger dfa2_T7[] =
{
12
};
const static NSInteger dfa2_T8[] =
{
5, -1, -1, -1, 6, -1, -1, -1, -1, -1, -1, 5, -1, 5, 5
};
const static NSInteger *dfa2_transition[] =
{
dfa2_T4, dfa2_T3, dfa2_T0, dfa2_T8, nil, dfa2_T5, dfa2_T2, dfa2_T1,
nil, nil, dfa2_T6, dfa2_T7, dfa2_T1
};
//const static NSInteger dfa2_transition[] = {};
+ (DFA2 *) newDFA2WithRecognizer:(BaseRecognizer *)aRecognizer
{
return [[[DFA2 alloc] initWithRecognizer:aRecognizer] retain];
}
- (id) initWithRecognizer:(BaseRecognizer *) 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;
transition = dfa2_transition;
/*
if (!(transition = calloc(13, sizeof(void*)))) {
[self release];
return nil;
}
len = 13;
transition[0] = dfa2_transition4;
transition[1] = dfa2_transition3;
transition[2] = dfa2_transition0;
transition[3] = dfa2_transition8;
transition[4] = dfa2_transition5;
transition[5] = dfa2_transition2;
transition[6] = dfa2_transition1;
transition[7] = dfa2_transition6;
transition[8] = dfa2_transition7;
transition[9] = dfa2_transition1;
*/
}
return self;
}
- (void) dealloc
{
free(transition);
[super dealloc];
}
- (NSString *) description
{
return @"20:1: declaration : ( variable | functionHeader ';' | functionHeader block );";
}
@end /* end DFA2 implementation */
#pragma mark Cyclic DFA implementation end DFA2
#pragma mark Bitsets
static ANTLRBitSet *FOLLOW_declaration_in_program28;
static const unsigned long long FOLLOW_declaration_in_program28_data[] = { 0x0000000000068012LL};
static ANTLRBitSet *FOLLOW_variable_in_declaration50;
static const unsigned long long FOLLOW_variable_in_declaration50_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_functionHeader_in_declaration60;
static const unsigned long long FOLLOW_functionHeader_in_declaration60_data[] = { 0x0000000000000800LL};
static ANTLRBitSet *FOLLOW_11_in_declaration62;
static const unsigned long long FOLLOW_11_in_declaration62_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_functionHeader_in_declaration75;
static const unsigned long long FOLLOW_functionHeader_in_declaration75_data[] = { 0x0000000000080000LL};
static ANTLRBitSet *FOLLOW_block_in_declaration77;
static const unsigned long long FOLLOW_block_in_declaration77_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_type_in_variable99;
static const unsigned long long FOLLOW_type_in_variable99_data[] = { 0x0000000000000010LL};
static ANTLRBitSet *FOLLOW_declarator_in_variable101;
static const unsigned long long FOLLOW_declarator_in_variable101_data[] = { 0x0000000000000800LL};
static ANTLRBitSet *FOLLOW_11_in_variable103;
static const unsigned long long FOLLOW_11_in_variable103_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_ID_in_declarator122;
static const unsigned long long FOLLOW_ID_in_declarator122_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_type_in_functionHeader151;
static const unsigned long long FOLLOW_type_in_functionHeader151_data[] = { 0x0000000000000010LL};
static ANTLRBitSet *FOLLOW_ID_in_functionHeader153;
static const unsigned long long FOLLOW_ID_in_functionHeader153_data[] = { 0x0000000000000080LL};
static ANTLRBitSet *FOLLOW_7_in_functionHeader155;
static const unsigned long long FOLLOW_7_in_functionHeader155_data[] = { 0x0000000000068110LL};
static ANTLRBitSet *FOLLOW_formalParameter_in_functionHeader159;
static const unsigned long long FOLLOW_formalParameter_in_functionHeader159_data[] = { 0x0000000000000500LL};
static ANTLRBitSet *FOLLOW_10_in_functionHeader163;
static const unsigned long long FOLLOW_10_in_functionHeader163_data[] = { 0x0000000000068010LL};
static ANTLRBitSet *FOLLOW_formalParameter_in_functionHeader165;
static const unsigned long long FOLLOW_formalParameter_in_functionHeader165_data[] = { 0x0000000000000500LL};
static ANTLRBitSet *FOLLOW_8_in_functionHeader173;
static const unsigned long long FOLLOW_8_in_functionHeader173_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_type_in_formalParameter195;
static const unsigned long long FOLLOW_type_in_formalParameter195_data[] = { 0x0000000000000010LL};
static ANTLRBitSet *FOLLOW_declarator_in_formalParameter197;
static const unsigned long long FOLLOW_declarator_in_formalParameter197_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_19_in_block286;
static const unsigned long long FOLLOW_19_in_block286_data[] = { 0x00000000001F88B0LL};
static ANTLRBitSet *FOLLOW_variable_in_block300;
static const unsigned long long FOLLOW_variable_in_block300_data[] = { 0x00000000001F88B0LL};
static ANTLRBitSet *FOLLOW_stat_in_block315;
static const unsigned long long FOLLOW_stat_in_block315_data[] = { 0x00000000001908B0LL};
static ANTLRBitSet *FOLLOW_20_in_block326;
static const unsigned long long FOLLOW_20_in_block326_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_forStat_in_stat338;
static const unsigned long long FOLLOW_forStat_in_stat338_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_expr_in_stat346;
static const unsigned long long FOLLOW_expr_in_stat346_data[] = { 0x0000000000000800LL};
static ANTLRBitSet *FOLLOW_11_in_stat348;
static const unsigned long long FOLLOW_11_in_stat348_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_block_in_stat362;
static const unsigned long long FOLLOW_block_in_stat362_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_assignStat_in_stat370;
static const unsigned long long FOLLOW_assignStat_in_stat370_data[] = { 0x0000000000000800LL};
static ANTLRBitSet *FOLLOW_11_in_stat372;
static const unsigned long long FOLLOW_11_in_stat372_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_11_in_stat380;
static const unsigned long long FOLLOW_11_in_stat380_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_16_in_forStat399;
static const unsigned long long FOLLOW_16_in_forStat399_data[] = { 0x0000000000000080LL};
static ANTLRBitSet *FOLLOW_7_in_forStat401;
static const unsigned long long FOLLOW_7_in_forStat401_data[] = { 0x0000000000000010LL};
static ANTLRBitSet *FOLLOW_assignStat_in_forStat403;
static const unsigned long long FOLLOW_assignStat_in_forStat403_data[] = { 0x0000000000000800LL};
static ANTLRBitSet *FOLLOW_11_in_forStat405;
static const unsigned long long FOLLOW_11_in_forStat405_data[] = { 0x00000000000000B0LL};
static ANTLRBitSet *FOLLOW_expr_in_forStat407;
static const unsigned long long FOLLOW_expr_in_forStat407_data[] = { 0x0000000000000800LL};
static ANTLRBitSet *FOLLOW_11_in_forStat409;
static const unsigned long long FOLLOW_11_in_forStat409_data[] = { 0x0000000000000010LL};
static ANTLRBitSet *FOLLOW_assignStat_in_forStat411;
static const unsigned long long FOLLOW_assignStat_in_forStat411_data[] = { 0x0000000000000100LL};
static ANTLRBitSet *FOLLOW_8_in_forStat413;
static const unsigned long long FOLLOW_8_in_forStat413_data[] = { 0x0000000000080000LL};
static ANTLRBitSet *FOLLOW_block_in_forStat415;
static const unsigned long long FOLLOW_block_in_forStat415_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_ID_in_assignStat442;
static const unsigned long long FOLLOW_ID_in_assignStat442_data[] = { 0x0000000000002000LL};
static ANTLRBitSet *FOLLOW_13_in_assignStat444;
static const unsigned long long FOLLOW_13_in_assignStat444_data[] = { 0x00000000000000B0LL};
static ANTLRBitSet *FOLLOW_expr_in_assignStat446;
static const unsigned long long FOLLOW_expr_in_assignStat446_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_condExpr_in_expr468;
static const unsigned long long FOLLOW_condExpr_in_expr468_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_aexpr_in_condExpr487;
static const unsigned long long FOLLOW_aexpr_in_condExpr487_data[] = { 0x0000000000005002LL};
static ANTLRBitSet *FOLLOW_set_in_condExpr491;
static const unsigned long long FOLLOW_set_in_condExpr491_data[] = { 0x00000000000000B0LL};
static ANTLRBitSet *FOLLOW_aexpr_in_condExpr499;
static const unsigned long long FOLLOW_aexpr_in_condExpr499_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_atom_in_aexpr521;
static const unsigned long long FOLLOW_atom_in_aexpr521_data[] = { 0x0000000000000202LL};
static ANTLRBitSet *FOLLOW_9_in_aexpr525;
static const unsigned long long FOLLOW_9_in_aexpr525_data[] = { 0x00000000000000B0LL};
static ANTLRBitSet *FOLLOW_atom_in_aexpr527;
static const unsigned long long FOLLOW_atom_in_aexpr527_data[] = { 0x0000000000000202LL};
static ANTLRBitSet *FOLLOW_ID_in_atom547;
static const unsigned long long FOLLOW_ID_in_atom547_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_INT_in_atom561;
static const unsigned long long FOLLOW_INT_in_atom561_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_7_in_atom575;
static const unsigned long long FOLLOW_7_in_atom575_data[] = { 0x00000000000000B0LL};
static ANTLRBitSet *FOLLOW_expr_in_atom577;
static const unsigned long long FOLLOW_expr_in_atom577_data[] = { 0x0000000000000100LL};
static ANTLRBitSet *FOLLOW_8_in_atom579;
static const unsigned long long FOLLOW_8_in_atom579_data[] = { 0x0000000000000002LL};
#pragma mark Dynamic Global globalAttributeScopeImplementation
#pragma mark Dynamic Rule Scopes ruleAttributeScopeImplementation
#pragma mark Rule Return Scopes returnScopeImplementation
@implementation SimpleCParser // 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 */
/* ObjC end globalAttributeScope */
/* ObjC start actions.(actionScope).synthesize */
/* ObjC start synthesize() */
+ (void) initialize
{
#pragma mark Bitsets
FOLLOW_declaration_in_program28 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_declaration_in_program28_data Count:(NSUInteger)1] retain];
FOLLOW_variable_in_declaration50 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_variable_in_declaration50_data Count:(NSUInteger)1] retain];
FOLLOW_functionHeader_in_declaration60 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_functionHeader_in_declaration60_data Count:(NSUInteger)1] retain];
FOLLOW_11_in_declaration62 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_declaration62_data Count:(NSUInteger)1] retain];
FOLLOW_functionHeader_in_declaration75 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_functionHeader_in_declaration75_data Count:(NSUInteger)1] retain];
FOLLOW_block_in_declaration77 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_declaration77_data Count:(NSUInteger)1] retain];
FOLLOW_type_in_variable99 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_variable99_data Count:(NSUInteger)1] retain];
FOLLOW_declarator_in_variable101 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_variable101_data Count:(NSUInteger)1] retain];
FOLLOW_11_in_variable103 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_variable103_data Count:(NSUInteger)1] retain];
FOLLOW_ID_in_declarator122 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_declarator122_data Count:(NSUInteger)1] retain];
FOLLOW_type_in_functionHeader151 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_functionHeader151_data Count:(NSUInteger)1] retain];
FOLLOW_ID_in_functionHeader153 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_functionHeader153_data Count:(NSUInteger)1] retain];
FOLLOW_7_in_functionHeader155 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_7_in_functionHeader155_data Count:(NSUInteger)1] retain];
FOLLOW_formalParameter_in_functionHeader159 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_formalParameter_in_functionHeader159_data Count:(NSUInteger)1] retain];
FOLLOW_10_in_functionHeader163 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_10_in_functionHeader163_data Count:(NSUInteger)1] retain];
FOLLOW_formalParameter_in_functionHeader165 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_formalParameter_in_functionHeader165_data Count:(NSUInteger)1] retain];
FOLLOW_8_in_functionHeader173 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_8_in_functionHeader173_data Count:(NSUInteger)1] retain];
FOLLOW_type_in_formalParameter195 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_formalParameter195_data Count:(NSUInteger)1] retain];
FOLLOW_declarator_in_formalParameter197 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_formalParameter197_data Count:(NSUInteger)1] retain];
FOLLOW_19_in_block286 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_19_in_block286_data Count:(NSUInteger)1] retain];
FOLLOW_variable_in_block300 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_variable_in_block300_data Count:(NSUInteger)1] retain];
FOLLOW_stat_in_block315 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_stat_in_block315_data Count:(NSUInteger)1] retain];
FOLLOW_20_in_block326 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_20_in_block326_data Count:(NSUInteger)1] retain];
FOLLOW_forStat_in_stat338 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_forStat_in_stat338_data Count:(NSUInteger)1] retain];
FOLLOW_expr_in_stat346 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_stat346_data Count:(NSUInteger)1] retain];
FOLLOW_11_in_stat348 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_stat348_data Count:(NSUInteger)1] retain];
FOLLOW_block_in_stat362 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_stat362_data Count:(NSUInteger)1] retain];
FOLLOW_assignStat_in_stat370 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_stat370_data Count:(NSUInteger)1] retain];
FOLLOW_11_in_stat372 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_stat372_data Count:(NSUInteger)1] retain];
FOLLOW_11_in_stat380 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_stat380_data Count:(NSUInteger)1] retain];
FOLLOW_16_in_forStat399 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_16_in_forStat399_data Count:(NSUInteger)1] retain];
FOLLOW_7_in_forStat401 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_7_in_forStat401_data Count:(NSUInteger)1] retain];
FOLLOW_assignStat_in_forStat403 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_forStat403_data Count:(NSUInteger)1] retain];
FOLLOW_11_in_forStat405 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_forStat405_data Count:(NSUInteger)1] retain];
FOLLOW_expr_in_forStat407 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_forStat407_data Count:(NSUInteger)1] retain];
FOLLOW_11_in_forStat409 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_forStat409_data Count:(NSUInteger)1] retain];
FOLLOW_assignStat_in_forStat411 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_forStat411_data Count:(NSUInteger)1] retain];
FOLLOW_8_in_forStat413 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_8_in_forStat413_data Count:(NSUInteger)1] retain];
FOLLOW_block_in_forStat415 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_forStat415_data Count:(NSUInteger)1] retain];
FOLLOW_ID_in_assignStat442 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_assignStat442_data Count:(NSUInteger)1] retain];
FOLLOW_13_in_assignStat444 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_13_in_assignStat444_data Count:(NSUInteger)1] retain];
FOLLOW_expr_in_assignStat446 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_assignStat446_data Count:(NSUInteger)1] retain];
FOLLOW_condExpr_in_expr468 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_condExpr_in_expr468_data Count:(NSUInteger)1] retain];
FOLLOW_aexpr_in_condExpr487 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_aexpr_in_condExpr487_data Count:(NSUInteger)1] retain];
FOLLOW_set_in_condExpr491 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_set_in_condExpr491_data Count:(NSUInteger)1] retain];
FOLLOW_aexpr_in_condExpr499 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_aexpr_in_condExpr499_data Count:(NSUInteger)1] retain];
FOLLOW_atom_in_aexpr521 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_atom_in_aexpr521_data Count:(NSUInteger)1] retain];
FOLLOW_9_in_aexpr525 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_9_in_aexpr525_data Count:(NSUInteger)1] retain];
FOLLOW_atom_in_aexpr527 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_atom_in_aexpr527_data Count:(NSUInteger)1] retain];
FOLLOW_ID_in_atom547 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_atom547_data Count:(NSUInteger)1] retain];
FOLLOW_INT_in_atom561 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_INT_in_atom561_data Count:(NSUInteger)1] retain];
FOLLOW_7_in_atom575 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_7_in_atom575_data Count:(NSUInteger)1] retain];
FOLLOW_expr_in_atom577 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_atom577_data Count:(NSUInteger)1] retain];
FOLLOW_8_in_atom579 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_8_in_atom579_data Count:(NSUInteger)1] retain];
[BaseRecognizer setTokenNames:[[AMutableArray arrayWithObjects:@"<invalid>", @"<EOR>", @"<DOWN>", @"<UP>",
@"ID", @"INT", @"WS", @"'('", @"')'", @"'+'", @"','", @"';'", @"'<'", @"'='",
@"'=='", @"'char'", @"'for'", @"'int'", @"'void'", @"'{'", @"'}'", nil] retain]];
[BaseRecognizer setGrammarFileName:@"/Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g"];
}
+ (SimpleCParser *)newSimpleCParser:(id<TokenStream>)aStream
{
return [[SimpleCParser alloc] initWithTokenStream:aStream];
}
- (id) initWithTokenStream:(id<TokenStream>)aStream
{
self = [super initWithTokenStream:aStream State:[[RecognizerSharedState newRecognizerSharedStateWithRuleLen:15+1] retain]];
if ( self != nil ) {
dfa2 = [DFA2 newDFA2WithRecognizer:self];
/* start of actions-actionScope-init */
/* start of init */
}
return self;
}
- (void) dealloc
{
[dfa2 release];
[super dealloc];
}
/* ObjC start 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/LL-star/SimpleC.g:7:1: program : ( declaration )+ ;
*/
- (void) program
{
/* ruleScopeSetUp */
/* ruleDeclarations */
@try {
/* ruleLabelDefs entry */
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:8:5: ( ( declaration )+ ) // ruleBlockSingleAlt
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:8:9: ( declaration )+ // alt
{
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:8:9: ( declaration )+ // positiveClosureBlock
NSInteger cnt1 = 0;
do {
NSInteger alt1 = 2;
NSInteger LA1_0 = [input LA:1];
if ( (LA1_0==ID||LA1_0==15||(LA1_0 >= 17 && LA1_0 <= 18)) ) {
alt1=1;
}
switch (alt1) {
case 1 : ;
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:8:9: declaration // alt
{
/* ruleRef */
[self pushFollow:FOLLOW_declaration_in_program28];
[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/LL-star/SimpleC.g:20:1: declaration : ( variable | functionHeader ';' | functionHeader block );
*/
- (void) declaration
{
/* ruleScopeSetUp */
/* ruleDeclarations */
@try {
/* ruleLabelDefs entry */
NSString * functionHeader1 = nil ;
NSString * functionHeader2 = nil ;
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:21:5: ( variable | functionHeader ';' | functionHeader block ) //ruleblock
NSInteger alt2=3;
alt2 = [dfa2 predict:input];
switch (alt2) {
case 1 : ;
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:21:9: variable // alt
{
/* ruleRef */
[self pushFollow:FOLLOW_variable_in_declaration50];
[self variable];
[self popFollow];
}
break;
case 2 : ;
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:22:9: functionHeader ';' // alt
{
/* ruleRef */
[self pushFollow:FOLLOW_functionHeader_in_declaration60];
functionHeader1 = [self functionHeader];
[self popFollow];
[self match:input TokenType:11 Follow:FOLLOW_11_in_declaration62];
NSLog(@"%@ is a declaration\n", functionHeader1
);
}
break;
case 3 : ;
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:24:9: functionHeader block // alt
{
/* ruleRef */
[self pushFollow:FOLLOW_functionHeader_in_declaration75];
functionHeader2 = [self functionHeader];
[self popFollow];
/* ruleRef */
[self pushFollow:FOLLOW_block_in_declaration77];
[self block];
[self popFollow];
NSLog(@"%@ is a definition\n", functionHeader2
);
}
break;
}
/* token+rule list labels */
}
@catch (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/LL-star/SimpleC.g:28:1: variable : type declarator ';' ;
*/
- (void) variable
{
/* ruleScopeSetUp */
/* ruleDeclarations */
@try {
/* ruleLabelDefs entry */
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:29:5: ( type declarator ';' ) // ruleBlockSingleAlt
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:29:9: type declarator ';' // alt
{
/* ruleRef */
[self pushFollow:FOLLOW_type_in_variable99];
[self type];
[self popFollow];
/* ruleRef */
[self pushFollow:FOLLOW_declarator_in_variable101];
[self declarator];
[self popFollow];
[self match:input TokenType:11 Follow:FOLLOW_11_in_variable103];
}
/* token+rule list labels */
}
@catch (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/LL-star/SimpleC.g:32:1: declarator : ID ;
*/
- (void) declarator
{
/* ruleScopeSetUp */
/* ruleDeclarations */
@try {
/* ruleLabelDefs entry */
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:33:5: ( ID ) // ruleBlockSingleAlt
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:33:9: ID // alt
{
[self match:input TokenType:ID Follow:FOLLOW_ID_in_declarator122];
}
/* 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/LL-star/SimpleC.g:36:1: functionHeader returns [NSString *name] : type ID '(' ( formalParameter ( ',' formalParameter )* )? ')' ;
*/
- (NSString *) functionHeader
{
/* ruleScopeSetUp */
/* ruleDeclarations */
NSString * name = nil ;
name=nil; // for now you must init here rather than in 'returns'
@try {
/* ruleLabelDefs entry */
CommonToken *ID3 = nil;
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:40:5: ( type ID '(' ( formalParameter ( ',' formalParameter )* )? ')' ) // ruleBlockSingleAlt
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:40:9: type ID '(' ( formalParameter ( ',' formalParameter )* )? ')' // alt
{
/* ruleRef */
[self pushFollow:FOLLOW_type_in_functionHeader151];
[self type];
[self popFollow];
ID3=(CommonToken *)[self match:input TokenType:ID Follow:FOLLOW_ID_in_functionHeader153];
[self match:input TokenType:7 Follow:FOLLOW_7_in_functionHeader155];
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:40:21: ( formalParameter ( ',' formalParameter )* )? // block
NSInteger alt4=2;
NSInteger LA4_0 = [input LA:1];
if ( (LA4_0==ID||LA4_0==15||(LA4_0 >= 17 && LA4_0 <= 18)) ) {
alt4=1;
}
switch (alt4) {
case 1 : ;
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:40:23: formalParameter ( ',' formalParameter )* // alt
{
/* ruleRef */
[self pushFollow:FOLLOW_formalParameter_in_functionHeader159];
[self formalParameter];
[self popFollow];
do {
NSInteger alt3=2;
NSInteger LA3_0 = [input LA:1];
if ( (LA3_0==10) ) {
alt3=1;
}
switch (alt3) {
case 1 : ;
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:40:41: ',' formalParameter // alt
{
[self match:input TokenType:10 Follow:FOLLOW_10_in_functionHeader163];
/* ruleRef */
[self pushFollow:FOLLOW_formalParameter_in_functionHeader165];
[self formalParameter];
[self popFollow];
}
break;
default :
goto loop3;
}
} while (YES);
loop3: ;
}
break;
}
[self match:input TokenType:8 Follow:FOLLOW_8_in_functionHeader173];
name = (ID3!=nil?ID3.text:nil);
}
/* token+rule list labels */
}
@catch (RecognitionException *re) {
[self reportError:re];
[self recover:input Exception:re];
}
@finally {
/* ruleScopeCleanUp */
}
return name;
}
/* $ANTLR end functionHeader */
/*
* $ANTLR start formalParameter
* /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:44:1: formalParameter : type declarator ;
*/
- (void) formalParameter
{
/* ruleScopeSetUp */
/* ruleDeclarations */
@try {
/* ruleLabelDefs entry */
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:45:5: ( type declarator ) // ruleBlockSingleAlt
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:45:9: type declarator // alt
{
/* ruleRef */
[self pushFollow:FOLLOW_type_in_formalParameter195];
[self type];
[self popFollow];
/* ruleRef */
[self pushFollow:FOLLOW_declarator_in_formalParameter197];
[self declarator];
[self popFollow];
}
/* token+rule list labels */
}
@catch (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/LL-star/SimpleC.g:48:1: type : ( 'int' | 'char' | 'void' | ID );
*/
- (void) type
{
/* ruleScopeSetUp */
/* ruleDeclarations */
@try {
/* ruleLabelDefs entry */
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:49:5: ( 'int' | 'char' | 'void' | ID ) // ruleBlockSingleAlt
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g: // alt
{
if ([input LA:1] == ID||[input LA:1] == 15||(([input LA:1] >= 17) && ([input LA:1] <= 18))) {
[input consume];
[state setIsErrorRecovery:NO];
} else {
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/LL-star/SimpleC.g:55:1: block : '{' ( variable )* ( stat )* '}' ;
*/
- (void) block
{
/* ruleScopeSetUp */
/* ruleDeclarations */
@try {
/* ruleLabelDefs entry */
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:56:5: ( '{' ( variable )* ( stat )* '}' ) // ruleBlockSingleAlt
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:56:9: '{' ( variable )* ( stat )* '}' // alt
{
[self match:input TokenType:19 Follow:FOLLOW_19_in_block286];
do {
NSInteger alt5=2;
NSInteger LA5_0 = [input LA:1];
if ( (LA5_0==ID) ) {
NSInteger LA5_2 = [input LA:2];
if ( (LA5_2==ID) ) {
alt5=1;
}
}
else if ( (LA5_0==15||(LA5_0 >= 17 && LA5_0 <= 18)) ) {
alt5=1;
}
switch (alt5) {
case 1 : ;
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:57:13: variable // alt
{
/* ruleRef */
[self pushFollow:FOLLOW_variable_in_block300];
[self variable];
[self popFollow];
}
break;
default :
goto loop5;
}
} while (YES);
loop5: ;
do {
NSInteger alt6=2;
NSInteger LA6_0 = [input LA:1];
if ( ((LA6_0 >= ID && LA6_0 <= INT)||LA6_0==7||LA6_0==11||LA6_0==16||LA6_0==19) ) {
alt6=1;
}
switch (alt6) {
case 1 : ;
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:58:13: stat // alt
{
/* ruleRef */
[self pushFollow:FOLLOW_stat_in_block315];
[self stat];
[self popFollow];
}
break;
default :
goto loop6;
}
} while (YES);
loop6: ;
[self match:input TokenType:20 Follow:FOLLOW_20_in_block326];
}
/* token+rule list labels */
}
@catch (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/LL-star/SimpleC.g:62:1: stat : ( forStat | expr ';' | block | assignStat ';' | ';' );
*/
- (void) stat
{
/* ruleScopeSetUp */
/* ruleDeclarations */
@try {
/* ruleLabelDefs entry */
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:62:5: ( forStat | expr ';' | block | assignStat ';' | ';' ) //ruleblock
NSInteger alt7=5;
unichar charLA7 = [input LA:1];
switch (charLA7) {
case 16: ;
{
alt7=1;
}
break;
case ID: ;
{
NSInteger LA7_2 = [input LA:2];
if ( (LA7_2==13) ) {
alt7=4;
}
else if ( (LA7_2==9||(LA7_2 >= 11 && LA7_2 <= 12)||LA7_2==14) ) {
alt7=2;
}
else {
NoViableAltException *nvae = [NoViableAltException newException:7 state:2 stream:input];
nvae.c = LA7_2;
@throw nvae;
}
}
break;
case INT: ;
case 7: ;
{
alt7=2;
}
break;
case 19: ;
{
alt7=3;
}
break;
case 11: ;
{
alt7=5;
}
break;
default: ;
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/LL-star/SimpleC.g:62:7: forStat // alt
{
/* ruleRef */
[self pushFollow:FOLLOW_forStat_in_stat338];
[self forStat];
[self popFollow];
}
break;
case 2 : ;
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:63:7: expr ';' // alt
{
/* ruleRef */
[self pushFollow:FOLLOW_expr_in_stat346];
[self expr];
[self popFollow];
[self match:input TokenType:11 Follow:FOLLOW_11_in_stat348];
}
break;
case 3 : ;
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:64:7: block // alt
{
/* ruleRef */
[self pushFollow:FOLLOW_block_in_stat362];
[self block];
[self popFollow];
}
break;
case 4 : ;
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:65:7: assignStat ';' // alt
{
/* ruleRef */
[self pushFollow:FOLLOW_assignStat_in_stat370];
[self assignStat];
[self popFollow];
[self match:input TokenType:11 Follow:FOLLOW_11_in_stat372];
}
break;
case 5 : ;
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:66:7: ';' // alt
{
[self match:input TokenType:11 Follow:FOLLOW_11_in_stat380];
}
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/LL-star/SimpleC.g:69:1: forStat : 'for' '(' assignStat ';' expr ';' assignStat ')' block ;
*/
- (void) forStat
{
/* ruleScopeSetUp */
/* ruleDeclarations */
@try {
/* ruleLabelDefs entry */
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:70:5: ( 'for' '(' assignStat ';' expr ';' assignStat ')' block ) // ruleBlockSingleAlt
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:70:9: 'for' '(' assignStat ';' expr ';' assignStat ')' block // alt
{
[self match:input TokenType:16 Follow:FOLLOW_16_in_forStat399];
[self match:input TokenType:7 Follow:FOLLOW_7_in_forStat401];
/* ruleRef */
[self pushFollow:FOLLOW_assignStat_in_forStat403];
[self assignStat];
[self popFollow];
[self match:input TokenType:11 Follow:FOLLOW_11_in_forStat405];
/* ruleRef */
[self pushFollow:FOLLOW_expr_in_forStat407];
[self expr];
[self popFollow];
[self match:input TokenType:11 Follow:FOLLOW_11_in_forStat409];
/* ruleRef */
[self pushFollow:FOLLOW_assignStat_in_forStat411];
[self assignStat];
[self popFollow];
[self match:input TokenType:8 Follow:FOLLOW_8_in_forStat413];
/* ruleRef */
[self pushFollow:FOLLOW_block_in_forStat415];
[self block];
[self popFollow];
}
/* token+rule list labels */
}
@catch (RecognitionException *re) {
[self reportError:re];
[self recover:input Exception:re];
}
@finally {
/* ruleScopeCleanUp */
}
return ;
}
/* $ANTLR end forStat */
/*
* $ANTLR start assignStat
* /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:73:1: assignStat : ID '=' expr ;
*/
- (void) assignStat
{
/* ruleScopeSetUp */
/* ruleDeclarations */
@try {
/* ruleLabelDefs entry */
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:74:5: ( ID '=' expr ) // ruleBlockSingleAlt
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:74:9: ID '=' expr // alt
{
[self match:input TokenType:ID Follow:FOLLOW_ID_in_assignStat442];
[self match:input TokenType:13 Follow:FOLLOW_13_in_assignStat444];
/* ruleRef */
[self pushFollow:FOLLOW_expr_in_assignStat446];
[self expr];
[self popFollow];
}
/* token+rule list labels */
}
@catch (RecognitionException *re) {
[self reportError:re];
[self recover:input Exception:re];
}
@finally {
/* ruleScopeCleanUp */
}
return ;
}
/* $ANTLR end assignStat */
/*
* $ANTLR start expr
* /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:77:1: expr : condExpr ;
*/
- (void) expr
{
/* ruleScopeSetUp */
/* ruleDeclarations */
@try {
/* ruleLabelDefs entry */
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:77:5: ( condExpr ) // ruleBlockSingleAlt
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:77:9: condExpr // alt
{
/* ruleRef */
[self pushFollow:FOLLOW_condExpr_in_expr468];
[self condExpr];
[self popFollow];
}
/* token+rule list labels */
}
@catch (RecognitionException *re) {
[self reportError:re];
[self recover:input Exception:re];
}
@finally {
/* ruleScopeCleanUp */
}
return ;
}
/* $ANTLR end expr */
/*
* $ANTLR start condExpr
* /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:80:1: condExpr : aexpr ( ( '==' | '<' ) aexpr )? ;
*/
- (void) condExpr
{
/* ruleScopeSetUp */
/* ruleDeclarations */
@try {
/* ruleLabelDefs entry */
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:81:5: ( aexpr ( ( '==' | '<' ) aexpr )? ) // ruleBlockSingleAlt
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:81:9: aexpr ( ( '==' | '<' ) aexpr )? // alt
{
/* ruleRef */
[self pushFollow:FOLLOW_aexpr_in_condExpr487];
[self aexpr];
[self popFollow];
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:81:15: ( ( '==' | '<' ) aexpr )? // block
NSInteger alt8=2;
NSInteger LA8_0 = [input LA:1];
if ( (LA8_0==12||LA8_0==14) ) {
alt8=1;
}
switch (alt8) {
case 1 : ;
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:81:17: ( '==' | '<' ) aexpr // alt
{
if ([input LA:1] == 12||[input LA:1] == 14) {
[input consume];
[state setIsErrorRecovery:NO];
} else {
MismatchedSetException *mse = [MismatchedSetException newException:nil stream:input];
@throw mse;
}
/* ruleRef */
[self pushFollow:FOLLOW_aexpr_in_condExpr499];
[self aexpr];
[self popFollow];
}
break;
}
}
/* token+rule list labels */
}
@catch (RecognitionException *re) {
[self reportError:re];
[self recover:input Exception:re];
}
@finally {
/* ruleScopeCleanUp */
}
return ;
}
/* $ANTLR end condExpr */
/*
* $ANTLR start aexpr
* /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:84:1: aexpr : atom ( '+' atom )* ;
*/
- (void) aexpr
{
/* ruleScopeSetUp */
/* ruleDeclarations */
@try {
/* ruleLabelDefs entry */
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:85:5: ( atom ( '+' atom )* ) // ruleBlockSingleAlt
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:85:9: atom ( '+' atom )* // alt
{
/* ruleRef */
[self pushFollow:FOLLOW_atom_in_aexpr521];
[self atom];
[self popFollow];
do {
NSInteger alt9=2;
NSInteger LA9_0 = [input LA:1];
if ( (LA9_0==9) ) {
alt9=1;
}
switch (alt9) {
case 1 : ;
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:85:16: '+' atom // alt
{
[self match:input TokenType:9 Follow:FOLLOW_9_in_aexpr525];
/* ruleRef */
[self pushFollow:FOLLOW_atom_in_aexpr527];
[self atom];
[self popFollow];
}
break;
default :
goto loop9;
}
} while (YES);
loop9: ;
}
/* token+rule list labels */
}
@catch (RecognitionException *re) {
[self reportError:re];
[self recover:input Exception:re];
}
@finally {
/* ruleScopeCleanUp */
}
return ;
}
/* $ANTLR end aexpr */
/*
* $ANTLR start atom
* /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:88:1: atom : ( ID | INT | '(' expr ')' );
*/
- (void) atom
{
/* ruleScopeSetUp */
/* ruleDeclarations */
@try {
/* ruleLabelDefs entry */
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:89:5: ( ID | INT | '(' expr ')' ) //ruleblock
NSInteger alt10=3;
unichar charLA10 = [input LA:1];
switch (charLA10) {
case ID: ;
{
alt10=1;
}
break;
case INT: ;
{
alt10=2;
}
break;
case 7: ;
{
alt10=3;
}
break;
default: ;
NoViableAltException *nvae = [NoViableAltException newException:10 state:0 stream:input];
nvae.c = charLA10;
@throw nvae;
}
switch (alt10) {
case 1 : ;
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:89:7: ID // alt
{
[self match:input TokenType:ID Follow:FOLLOW_ID_in_atom547];
}
break;
case 2 : ;
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:90:7: INT // alt
{
[self match:input TokenType:INT Follow:FOLLOW_INT_in_atom561];
}
break;
case 3 : ;
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/LL-star/SimpleC.g:91:7: '(' expr ')' // alt
{
[self match:input TokenType:7 Follow:FOLLOW_7_in_atom575];
/* ruleRef */
[self pushFollow:FOLLOW_expr_in_atom577];
[self expr];
[self popFollow];
[self match:input TokenType:8 Follow:FOLLOW_8_in_atom579];
}
break;
}
/* token+rule list labels */
}
@catch (RecognitionException *re) {
[self reportError:re];
[self recover:input Exception:re];
}
@finally {
/* ruleScopeCleanUp */
}
return ;
}
/* $ANTLR end atom */
/* ObjC end rules */
@end /* end of SimpleCParser implementation line 692 */