262 lines
8.0 KiB
Objective-C
262 lines
8.0 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/treeparser/LangDumpDecl.g
|
|
* - On : 2012-02-16 17:59:08
|
|
* - for the tree parser : LangDumpDeclTreeParser
|
|
*
|
|
* 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/treeparser/LangDumpDecl.g 2012-02-16 17:59:08
|
|
|
|
|
|
/* -----------------------------------------
|
|
* Include the ANTLR3 generated header file.
|
|
*/
|
|
#import "LangDumpDecl.h"
|
|
/* ----------------------------------------- */
|
|
|
|
|
|
/* ============================================================================= */
|
|
/* =============================================================================
|
|
* Start of recognizer
|
|
*/
|
|
|
|
#pragma mark Bitsets
|
|
static ANTLRBitSet *FOLLOW_DECL_in_decl45;
|
|
static const unsigned long long FOLLOW_DECL_in_decl45_data[] = { 0x0000000000000004LL};
|
|
static ANTLRBitSet *FOLLOW_type_in_decl47;
|
|
static const unsigned long long FOLLOW_type_in_decl47_data[] = { 0x0000000000000040LL};
|
|
static ANTLRBitSet *FOLLOW_declarator_in_decl49;
|
|
static const unsigned long long FOLLOW_declarator_in_decl49_data[] = { 0x0000000000000008LL};
|
|
static ANTLRBitSet *FOLLOW_INTTYPE_in_type81;
|
|
static const unsigned long long FOLLOW_INTTYPE_in_type81_data[] = { 0x0000000000000002LL};
|
|
static ANTLRBitSet *FOLLOW_ID_in_declarator95;
|
|
static const unsigned long long FOLLOW_ID_in_declarator95_data[] = { 0x0000000000000002LL};
|
|
|
|
|
|
#pragma mark Dynamic Global globalAttributeScopeImplementation
|
|
|
|
#pragma mark Dynamic Rule Scopes ruleAttributeScopeImplementation
|
|
|
|
#pragma mark Rule Return Scopes returnScopeImplementation
|
|
@implementation LangDumpDecl_declarator_return /* returnScopeImplementation */
|
|
/* start of synthesize -- OBJC-Line 1837 */
|
|
+ (LangDumpDecl_declarator_return *)newLangDumpDecl_declarator_return
|
|
{
|
|
return [[[LangDumpDecl_declarator_return alloc] init] retain];
|
|
}
|
|
|
|
- (id) init
|
|
{
|
|
self = [super init];
|
|
return self;
|
|
}
|
|
|
|
|
|
|
|
@end /* end of returnScope implementation */
|
|
|
|
|
|
|
|
@implementation LangDumpDecl // 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_DECL_in_decl45 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_DECL_in_decl45_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_type_in_decl47 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_decl47_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_declarator_in_decl49 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_decl49_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_INTTYPE_in_type81 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_INTTYPE_in_type81_data Count:(NSUInteger)1] retain];
|
|
FOLLOW_ID_in_declarator95 = [[ANTLRBitSet newBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_declarator95_data Count:(NSUInteger)1] retain];
|
|
|
|
[BaseRecognizer setTokenNames:[[AMutableArray arrayWithObjects:@"<invalid>", @"<EOR>", @"<DOWN>", @"<UP>",
|
|
@"DECL", @"FLOATTYPE", @"ID", @"INT", @"INTTYPE", @"WS", @"';'", nil] retain]];
|
|
[BaseRecognizer setGrammarFileName:@"/Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/LangDumpDecl.g"];
|
|
}
|
|
|
|
+ (LangDumpDecl *)newLangDumpDecl:(id<TreeNodeStream>)aStream
|
|
{
|
|
return [[LangDumpDecl alloc] initWithStream:aStream];
|
|
}
|
|
|
|
- (id) initWithStream:(id<TreeNodeStream>)aStream
|
|
{
|
|
self = [super initWithStream:aStream State:[[RecognizerSharedState newRecognizerSharedStateWithRuleLen:3+1] retain]];
|
|
if ( self != nil ) {
|
|
/* start of actions-actionScope-init */
|
|
/* start of init */
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void) dealloc
|
|
{
|
|
[super dealloc];
|
|
}
|
|
|
|
/* ObjC start actions.(actionScope).methods */
|
|
/* ObjC end actions.(actionScope).methods */
|
|
/* ObjC start methods() */
|
|
/* ObjC end methods() */
|
|
/* ObjC start rules */
|
|
/*
|
|
* $ANTLR start decl
|
|
* /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/LangDumpDecl.g:8:1: decl : ^( DECL type declarator ) ;
|
|
*/
|
|
- (void) decl
|
|
{
|
|
/* ruleScopeSetUp */
|
|
|
|
/* ruleDeclarations */
|
|
|
|
@try {
|
|
/* ruleLabelDefs entry */
|
|
LangDumpDecl_declarator_return * declarator1 = nil ;
|
|
|
|
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/LangDumpDecl.g:8:6: ( ^( DECL type declarator ) ) // ruleBlockSingleAlt
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/LangDumpDecl.g:8:8: ^( DECL type declarator ) // alt
|
|
{
|
|
|
|
|
|
[self match:input TokenType:DECL Follow:FOLLOW_DECL_in_decl45];
|
|
|
|
[self match:input TokenType:DOWN Follow:nil];
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_type_in_decl47];
|
|
[self type];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
/* ruleRef */
|
|
[self pushFollow:FOLLOW_declarator_in_decl49];
|
|
declarator1 = [self declarator];
|
|
|
|
[self popFollow];
|
|
|
|
|
|
|
|
[self match:input TokenType:UP Follow:nil];
|
|
|
|
|
|
|
|
NSLog(@"int %@", (declarator1!=nil?[[input getTokenStream] toStringFromStart:[[input getTreeAdaptor] getTokenStartIndex:[declarator1 getStart]]ToEnd:[[input getTreeAdaptor] getTokenStopIndex:[declarator1 getStart]]]:0));
|
|
|
|
|
|
}
|
|
|
|
/* token+rule list labels */
|
|
|
|
}
|
|
@catch (RecognitionException *re) {
|
|
[self reportError:re];
|
|
[self recover:input Exception:re];
|
|
}
|
|
|
|
@finally {
|
|
/* ruleScopeCleanUp */
|
|
|
|
}
|
|
return ;
|
|
}
|
|
/* $ANTLR end decl */
|
|
|
|
/*
|
|
* $ANTLR start type
|
|
* /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/LangDumpDecl.g:13:1: type : INTTYPE ;
|
|
*/
|
|
- (void) type
|
|
{
|
|
/* ruleScopeSetUp */
|
|
|
|
/* ruleDeclarations */
|
|
|
|
@try {
|
|
/* ruleLabelDefs entry */
|
|
|
|
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/LangDumpDecl.g:13:6: ( INTTYPE ) // ruleBlockSingleAlt
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/LangDumpDecl.g:13:8: INTTYPE // alt
|
|
{
|
|
|
|
[self match:input TokenType:INTTYPE Follow:FOLLOW_INTTYPE_in_type81];
|
|
|
|
}
|
|
|
|
/* token+rule list labels */
|
|
|
|
}
|
|
@catch (RecognitionException *re) {
|
|
[self reportError:re];
|
|
[self recover:input Exception:re];
|
|
}
|
|
|
|
@finally {
|
|
/* ruleScopeCleanUp */
|
|
|
|
}
|
|
return ;
|
|
}
|
|
/* $ANTLR end type */
|
|
|
|
/*
|
|
* $ANTLR start declarator
|
|
* /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/LangDumpDecl.g:15:1: declarator : ID ;
|
|
*/
|
|
- (LangDumpDecl_declarator_return *) declarator
|
|
{
|
|
/* ruleScopeSetUp */
|
|
|
|
/* ruleDeclarations */
|
|
LangDumpDecl_declarator_return * retval = [LangDumpDecl_declarator_return newLangDumpDecl_declarator_return];
|
|
[retval setStart:[input LT:1]];
|
|
|
|
|
|
@try {
|
|
/* ruleLabelDefs entry */
|
|
|
|
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/LangDumpDecl.g:16:6: ( ID ) // ruleBlockSingleAlt
|
|
// /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/LangDumpDecl.g:16:8: ID // alt
|
|
{
|
|
|
|
[self match:input TokenType:ID Follow:FOLLOW_ID_in_declarator95];
|
|
|
|
}
|
|
|
|
/* token+rule list labels */
|
|
|
|
}
|
|
@catch (RecognitionException *re) {
|
|
[self reportError:re];
|
|
[self recover:input Exception:re];
|
|
}
|
|
|
|
@finally {
|
|
/* ruleScopeCleanUp */
|
|
|
|
}
|
|
return retval;
|
|
}
|
|
/* $ANTLR end declarator */
|
|
/* ObjC end rules */
|
|
|
|
@end /* end of LangDumpDecl implementation line 692 */
|