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

📄 simplecparser.m

📁 ANTLR(ANother Tool for Language Recognition)它是这样的一种工具
💻 M
📖 第 1 页 / 共 3 页
字号:
            ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException exceptionWithDecision:7 state:0 stream:input];        	@throw nvae;        	}}        switch (alt7) {        	case 1 :        	    // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:62:7: forStat // alt        	    {        	    [following addObject:FOLLOW_forStat_in_stat337];        	    [self forStat];        	    [following removeLastObject];        	    }        	    break;        	case 2 :        	    // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:63:7: expr ';' // alt        	    {        	    [following addObject:FOLLOW_expr_in_stat345];        	    [self expr];        	    [following removeLastObject];        	    [self match:input tokenType:7 follow:FOLLOW_7_in_stat347];         	    }        	    break;        	case 3 :        	    // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:64:7: block // alt        	    {        	    [following addObject:FOLLOW_block_in_stat361];        	    [self block];        	    [following removeLastObject];        	    }        	    break;        	case 4 :        	    // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:65:7: assignStat ';' // alt        	    {        	    [following addObject:FOLLOW_assignStat_in_stat369];        	    [self assignStat];        	    [following removeLastObject];        	    [self match:input tokenType:7 follow:FOLLOW_7_in_stat371];         	    }        	    break;        	case 5 :        	    // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:66:7: ';' // alt        	    {        	    [self match:input tokenType:7 follow:FOLLOW_7_in_stat379];         	    }        	    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 forStat// /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:69:1: forStat : 'for' '(' assignStat ';' expr ';' assignStat ')' block ;- (void) forStat{    @try {        // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:70:9: ( 'for' '(' assignStat ';' expr ';' assignStat ')' block ) // ruleBlockSingleAlt        // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:70:9: 'for' '(' assignStat ';' expr ';' assignStat ')' block // alt        {        [self match:input tokenType:16 follow:FOLLOW_16_in_forStat398];         [self match:input tokenType:8 follow:FOLLOW_8_in_forStat400];         [following addObject:FOLLOW_assignStat_in_forStat402];        [self assignStat];        [following removeLastObject];        [self match:input tokenType:7 follow:FOLLOW_7_in_forStat404];         [following addObject:FOLLOW_expr_in_forStat406];        [self expr];        [following removeLastObject];        [self match:input tokenType:7 follow:FOLLOW_7_in_forStat408];         [following addObject:FOLLOW_assignStat_in_forStat410];        [self assignStat];        [following removeLastObject];        [self match:input tokenType:10 follow:FOLLOW_10_in_forStat412];         [following addObject:FOLLOW_block_in_forStat414];        [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 forStat// $ANTLR start assignStat// /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:73:1: assignStat : ID '=' expr ;- (void) assignStat{    @try {        // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:74:9: ( ID '=' expr ) // ruleBlockSingleAlt        // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:74:9: ID '=' expr // alt        {        [self match:input tokenType:SimpleCParser_ID follow:FOLLOW_SimpleCParser_ID_in_assignStat441];         [self match:input tokenType:17 follow:FOLLOW_17_in_assignStat443];         [following addObject:FOLLOW_expr_in_assignStat445];        [self expr];        [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 assignStat// $ANTLR start expr// /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:77:1: expr : condExpr ;- (void) expr{    @try {        // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:77:9: ( condExpr ) // ruleBlockSingleAlt        // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:77:9: condExpr // alt        {        [following addObject:FOLLOW_condExpr_in_expr467];        [self condExpr];        [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 expr// $ANTLR start condExpr// /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:80:1: condExpr : aexpr ( ('=='|'<') aexpr )? ;- (void) condExpr{    @try {        // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:81:9: ( aexpr ( ('=='|'<') aexpr )? ) // ruleBlockSingleAlt        // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:81:9: aexpr ( ('=='|'<') aexpr )? // alt        {        [following addObject:FOLLOW_aexpr_in_condExpr486];        [self aexpr];        [following removeLastObject];        // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:81:15: ( ('=='|'<') aexpr )? // block        int alt8=2;        {        	int LA8_0 = [input LA:1];        	if ( (LA8_0>=18 && LA8_0<=19) ) {        		alt8 = 1;        	}        }        switch (alt8) {        	case 1 :        	    // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:81:17: ('=='|'<') aexpr // alt        	    {        	    if (([input LA:1]>=18 && [input LA:1]<=19)) {        	    	[input consume];        	    	errorRecovery = NO;        	    } else {        	    	ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException exceptionWithSet:nil stream:input];        	    	[self recoverFromMismatchedSet:input exception:mse follow:FOLLOW_set_in_condExpr491];	@throw mse;        	    }        	    [following addObject:FOLLOW_aexpr_in_condExpr498];        	    [self aexpr];        	    [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 condExpr// $ANTLR start aexpr// /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:84:1: aexpr : atom ( '+' atom )* ;- (void) aexpr{    @try {        // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:85:9: ( atom ( '+' atom )* ) // ruleBlockSingleAlt        // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:85:9: atom ( '+' atom )* // alt        {        [following addObject:FOLLOW_atom_in_aexpr520];        [self atom];        [following removeLastObject];        do {            int alt9=2;            {            	int LA9_0 = [input LA:1];            	if ( LA9_0==20 ) {            		alt9 = 1;            	}            }            switch (alt9) {        	case 1 :        	    // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:85:16: '+' atom // alt        	    {        	    [self match:input tokenType:20 follow:FOLLOW_20_in_aexpr524];         	    [following addObject:FOLLOW_atom_in_aexpr526];        	    [self atom];        	    [following removeLastObject];        	    }        	    break;        	default :        	    goto loop9;            }        } while (YES); loop9: ;        }    }	@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 aexpr// $ANTLR start atom// /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:88:1: atom : ( ID | INT | '(' expr ')' );- (void) atom{    @try {        // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:89:7: ( ID | INT | '(' expr ')' ) //ruleblock        int alt10=3;        switch ([input LA:1]) {        	case SimpleCParser_ID:        		alt10 = 1;        		break;        	case SimpleCParser_INT:        		alt10 = 2;        		break;        	case 8:        		alt10 = 3;        		break;        default:         {            ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException exceptionWithDecision:10 state:0 stream:input];        	@throw nvae;        	}}        switch (alt10) {        	case 1 :        	    // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:89:7: ID // alt        	    {        	    [self match:input tokenType:SimpleCParser_ID follow:FOLLOW_SimpleCParser_ID_in_atom546];         	    }        	    break;        	case 2 :        	    // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:90:7: INT // alt        	    {        	    [self match:input tokenType:SimpleCParser_INT follow:FOLLOW_SimpleCParser_INT_in_atom560];         	    }        	    break;        	case 3 :        	    // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/LL-star/SimpleC.g:91:7: '(' expr ')' // alt        	    {        	    [self match:input tokenType:8 follow:FOLLOW_8_in_atom574];         	    [following addObject:FOLLOW_expr_in_atom576];        	    [self expr];        	    [following removeLastObject];        	    [self match:input tokenType:10 follow:FOLLOW_10_in_atom578];         	    }        	    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 atom@end

⌨️ 快捷键说明

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