⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 symboltableparser.m

📁 ANTLR(ANother Tool for Language Recognition)它是这样的一种工具
💻 M
📖 第 1 页 / 共 2 页
字号:
// $ANTLR start method// /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/scopes/SymbolTable.g:41:1: method : 'method' ID '(' ')' block ;- (void) method{    @try {        // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/scopes/SymbolTable.g:42:9: ( 'method' ID '(' ')' block ) // ruleBlockSingleAlt        // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/scopes/SymbolTable.g:42:9: 'method' ID '(' ')' block // alt        {        [self match:input tokenType:7 follow:FOLLOW_7_in_method110];         [self match:input tokenType:SymbolTableParser_ID follow:FOLLOW_SymbolTableParser_ID_in_method112];         [self match:input tokenType:8 follow:FOLLOW_8_in_method114];         [self match:input tokenType:9 follow:FOLLOW_9_in_method116];         [following addObject:FOLLOW_block_in_method118];        [self block];        [following removeLastObject];        }    }	@catch (ANTLRRecognitionException *re) {		[self reportError:re];		[self recover:input exception:re];	}	@finally {		// token labels		// token+rule list labels		// rule labels		// rule refs in alts with rewrites	}	return ;}// $ANTLR end method// $ANTLR start block// /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/scopes/SymbolTable.g:45:1: block : '{' ( decl )* ( stat )* '}' ;- (void) block{    [SymbolTableParser_Symbols_stack addObject:[[[SymbolTableParserSymbolsScope alloc] init] autorelease]];        level++;        [[SymbolTableParser_Symbols_stack lastObject] setValue: [[NSMutableArray alloc] init] forKey:@"names"];    @try {        // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/scopes/SymbolTable.g:51:9: ( '{' ( decl )* ( stat )* '}' ) // ruleBlockSingleAlt        // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/scopes/SymbolTable.g:51:9: '{' ( decl )* ( stat )* '}' // alt        {        [self match:input tokenType:10 follow:FOLLOW_10_in_block147];         do {            int alt3=2;            {            	int LA3_0 = [input LA:1];            	if ( LA3_0==14 ) {            		alt3 = 1;            	}            }            switch (alt3) {        	case 1 :        	    // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/scopes/SymbolTable.g:51:14: decl // alt        	    {        	    [following addObject:FOLLOW_decl_in_block150];        	    [self decl];        	    [following removeLastObject];        	    }        	    break;        	default :        	    goto loop3;            }        } while (YES); loop3: ;        do {            int alt4=2;            {            	int LA4_0 = [input LA:1];            	if ( LA4_0==SymbolTableParser_ID||LA4_0==10 ) {            		alt4 = 1;            	}            }            switch (alt4) {        	case 1 :        	    // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/scopes/SymbolTable.g:51:22: stat // alt        	    {        	    [following addObject:FOLLOW_stat_in_block155];        	    [self stat];        	    [following removeLastObject];        	    }        	    break;        	default :        	    goto loop4;            }        } while (YES); loop4: ;        [self match:input tokenType:11 follow:FOLLOW_11_in_block159];                 NSLog(@"level %d symbols: %@", level, [[SymbolTableParser_Symbols_stack lastObject] valueForKey:@"names"]);                level--;                        }    }	@catch (ANTLRRecognitionException *re) {		[self reportError:re];		[self recover:input exception:re];	}	@finally {		// token labels		// token+rule list labels		// rule labels		// rule refs in alts with rewrites		[SymbolTableParser_Symbols_stack removeLastObject];	}	return ;}// $ANTLR end block// $ANTLR start stat// /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/scopes/SymbolTable.g:58:1: stat : ( ID '=' INT ';' | block );- (void) stat{    @try {        // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/scopes/SymbolTable.g:58:9: ( ID '=' INT ';' | block ) //ruleblock        int alt5=2;        {        	int LA5_0 = [input LA:1];        	if ( LA5_0==SymbolTableParser_ID ) {        		alt5 = 1;        	}        	else if ( LA5_0==10 ) {        		alt5 = 2;        	}        else {            ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException exceptionWithDecision:5 state:0 stream:input];        	@throw nvae;        	}        }        switch (alt5) {        	case 1 :        	    // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/scopes/SymbolTable.g:58:9: ID '=' INT ';' // alt        	    {        	    [self match:input tokenType:SymbolTableParser_ID follow:FOLLOW_SymbolTableParser_ID_in_stat183];         	    [self match:input tokenType:12 follow:FOLLOW_12_in_stat185];         	    [self match:input tokenType:SymbolTableParser_INT follow:FOLLOW_SymbolTableParser_INT_in_stat187];         	    [self match:input tokenType:13 follow:FOLLOW_13_in_stat189];         	    }        	    break;        	case 2 :        	    // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/scopes/SymbolTable.g:59:9: block // alt        	    {        	    [following addObject:FOLLOW_block_in_stat199];        	    [self block];        	    [following removeLastObject];        	    }        	    break;        }    }	@catch (ANTLRRecognitionException *re) {		[self reportError:re];		[self recover:input exception:re];	}	@finally {		// token labels		// token+rule list labels		// rule labels		// rule refs in alts with rewrites	}	return ;}// $ANTLR end stat// $ANTLR start decl// /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/scopes/SymbolTable.g:62:1: decl : 'int' ID ';' ;- (void) decl{    ANTLRToken * _ID1 = nil;    @try {        // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/scopes/SymbolTable.g:62:9: ( 'int' ID ';' ) // ruleBlockSingleAlt        // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/scopes/SymbolTable.g:62:9: 'int' ID ';' // alt        {        [self match:input tokenType:14 follow:FOLLOW_14_in_decl213];         _ID1=(ANTLRToken *)[input LT:1];        [_ID1 retain];        [self match:input tokenType:SymbolTableParser_ID follow:FOLLOW_SymbolTableParser_ID_in_decl215];         [self match:input tokenType:13 follow:FOLLOW_13_in_decl217];         [[[SymbolTableParser_Symbols_stack lastObject] valueForKey:@"names"] addObject:_ID1];        }    }	@catch (ANTLRRecognitionException *re) {		[self reportError:re];		[self recover:input exception:re];	}	@finally {		// token labels		[_ID1 release];		// token+rule list labels		// rule labels		// rule refs in alts with rewrites	}	return ;}// $ANTLR end decl@end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -