📄 simplectptreeparser.m
字号:
// $ANTLR end block// $ANTLR start stat// /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:45:1: stat : ( forStat | expr | block );- (void) stat{ @try { // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:45:7: ( forStat | expr | block ) //ruleblock int alt6=3; switch ([input LA:1]) { case SimpleCTPTreeParser_FOR: alt6 = 1; break; case SimpleCTPTreeParser_ID: case SimpleCTPTreeParser_EQ: case SimpleCTPTreeParser_INT: case SimpleCTPTreeParser_EQEQ: case SimpleCTPTreeParser_LT: case SimpleCTPTreeParser_PLUS: alt6 = 2; break; case SimpleCTPTreeParser_BLOCK: alt6 = 3; break; default: { ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException exceptionWithDecision:6 state:0 stream:input]; @throw nvae; }} switch (alt6) { case 1 : // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:45:7: forStat // alt { [following addObject:FOLLOW_forStat_in_stat292]; [self forStat]; [following removeLastObject]; } break; case 2 : // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:46:7: expr // alt { [following addObject:FOLLOW_expr_in_stat300]; [self expr]; [following removeLastObject]; } break; case 3 : // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:47:7: block // alt { [following addObject:FOLLOW_block_in_stat308]; [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 forStat// /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:50:1: forStat : ^( 'for' expr expr expr block ) ;- (void) forStat{ @try { // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:51:9: ( ^( 'for' expr expr expr block ) ) // ruleBlockSingleAlt // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:51:9: ^( 'for' expr expr expr block ) // alt { [self match:input tokenType:SimpleCTPTreeParser_FOR follow:FOLLOW_SimpleCTPTreeParser_FOR_in_forStat328]; [self match:input tokenType:ANTLRTokenTypeDOWN follow:nil]; [following addObject:FOLLOW_expr_in_forStat330]; [self expr]; [following removeLastObject]; [following addObject:FOLLOW_expr_in_forStat332]; [self expr]; [following removeLastObject]; [following addObject:FOLLOW_expr_in_forStat334]; [self expr]; [following removeLastObject]; [following addObject:FOLLOW_block_in_forStat336]; [self block]; [following removeLastObject]; [self match:input tokenType:ANTLRTokenTypeUP follow:nil]; } } @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 expr// /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:54:1: expr : ( ^( EQEQ expr expr ) | ^( LT expr expr ) | ^( PLUS expr expr ) | ^( EQ ID expr ) | atom );- (void) expr{ @try { // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:54:9: ( ^( EQEQ expr expr ) | ^( LT expr expr ) | ^( PLUS expr expr ) | ^( EQ ID expr ) | atom ) //ruleblock int alt7=5; switch ([input LA:1]) { case SimpleCTPTreeParser_EQEQ: alt7 = 1; break; case SimpleCTPTreeParser_LT: alt7 = 2; break; case SimpleCTPTreeParser_PLUS: alt7 = 3; break; case SimpleCTPTreeParser_EQ: alt7 = 4; break; case SimpleCTPTreeParser_ID: case SimpleCTPTreeParser_INT: alt7 = 5; break; default: { 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/simplecTreeParser/SimpleCTP.g:54:9: ^( EQEQ expr expr ) // alt { [self match:input tokenType:SimpleCTPTreeParser_EQEQ follow:FOLLOW_SimpleCTPTreeParser_EQEQ_in_expr352]; [self match:input tokenType:ANTLRTokenTypeDOWN follow:nil]; [following addObject:FOLLOW_expr_in_expr354]; [self expr]; [following removeLastObject]; [following addObject:FOLLOW_expr_in_expr356]; [self expr]; [following removeLastObject]; [self match:input tokenType:ANTLRTokenTypeUP follow:nil]; } break; case 2 : // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:55:9: ^( LT expr expr ) // alt { [self match:input tokenType:SimpleCTPTreeParser_LT follow:FOLLOW_SimpleCTPTreeParser_LT_in_expr368]; [self match:input tokenType:ANTLRTokenTypeDOWN follow:nil]; [following addObject:FOLLOW_expr_in_expr370]; [self expr]; [following removeLastObject]; [following addObject:FOLLOW_expr_in_expr372]; [self expr]; [following removeLastObject]; [self match:input tokenType:ANTLRTokenTypeUP follow:nil]; } break; case 3 : // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:56:9: ^( PLUS expr expr ) // alt { [self match:input tokenType:SimpleCTPTreeParser_PLUS follow:FOLLOW_SimpleCTPTreeParser_PLUS_in_expr384]; [self match:input tokenType:ANTLRTokenTypeDOWN follow:nil]; [following addObject:FOLLOW_expr_in_expr386]; [self expr]; [following removeLastObject]; [following addObject:FOLLOW_expr_in_expr388]; [self expr]; [following removeLastObject]; [self match:input tokenType:ANTLRTokenTypeUP follow:nil]; } break; case 4 : // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:57:9: ^( EQ ID expr ) // alt { [self match:input tokenType:SimpleCTPTreeParser_EQ follow:FOLLOW_SimpleCTPTreeParser_EQ_in_expr400]; [self match:input tokenType:ANTLRTokenTypeDOWN follow:nil]; [self match:input tokenType:SimpleCTPTreeParser_ID follow:FOLLOW_SimpleCTPTreeParser_ID_in_expr402]; [following addObject:FOLLOW_expr_in_expr404]; [self expr]; [following removeLastObject]; [self match:input tokenType:ANTLRTokenTypeUP follow:nil]; } break; case 5 : // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:58:9: atom // alt { [following addObject:FOLLOW_atom_in_expr415]; [self atom]; [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 expr// $ANTLR start atom// /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:61:1: atom : (ID|INT);- (void) atom{ @try { // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:62:5: ( (ID|INT)) // ruleBlockSingleAlt // /Users/kroepke/Projects/antlr3/code/antlr/main/lib/ObjC/Framework/examples/simplecTreeParser/SimpleCTP.g:62:7: (ID|INT) // alt { if ([input LA:1]==SimpleCTPTreeParser_ID||[input LA:1]==SimpleCTPTreeParser_INT) { [input consume]; errorRecovery = NO; } else { ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException exceptionWithSet:nil stream:input]; [self recoverFromMismatchedSet:input exception:mse follow:FOLLOW_set_in_atom432]; @throw mse; } } } @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 + -