// $ANTLR start "statement" // C:\\Development\\TT.Net\\TT\\Template.g:80:1: statement : ( getExpr | setExpr ); public TemplateParser.statement_return statement() // throws RecognitionException [1] { TemplateParser.statement_return retval = new TemplateParser.statement_return(); retval.Start = input.LT(1); CommonTree root_0 = null; TemplateParser.getExpr_return getExpr5 = default(TemplateParser.getExpr_return); TemplateParser.setExpr_return setExpr6 = default(TemplateParser.setExpr_return); try { dbg.EnterRule(GrammarFileName, "statement"); if ( RuleLevel==0 ) {dbg.Commence();} IncRuleLevel(); dbg.Location(80, 1); try { // C:\\Development\\TT.Net\\TT\\Template.g:81:2: ( getExpr | setExpr ) int alt2 = 2; try { dbg.EnterDecision(2); switch ( input.LA(1) ) { case ILITERAL: case LITERAL: case 55: { alt2 = 1; } break; case ID: { int LA2_2 = input.LA(2); if ( (LA2_2 == ASSIGN) ) { alt2 = 2; } else if ( (LA2_2 == TSTOP) ) { alt2 = 1; } else { NoViableAltException nvae_d2s2 = new NoViableAltException("", 2, 2, input); dbg.RecognitionException(nvae_d2s2); throw nvae_d2s2; } } break; case 56: { alt2 = 2; } break; default: NoViableAltException nvae_d2s0 = new NoViableAltException("", 2, 0, input); dbg.RecognitionException(nvae_d2s0); throw nvae_d2s0; } } finally { dbg.ExitDecision(2); } switch (alt2) { case 1 : dbg.EnterAlt(1); // C:\\Development\\TT.Net\\TT\\Template.g:81:4: getExpr { root_0 = (CommonTree)adaptor.GetNilNode(); dbg.Location(81,4); PushFollow(FOLLOW_getExpr_in_statement506); getExpr5 = getExpr(); state.followingStackPointer--; adaptor.AddChild(root_0, getExpr5.Tree); } break; case 2 : dbg.EnterAlt(2); // C:\\Development\\TT.Net\\TT\\Template.g:82:4: setExpr { root_0 = (CommonTree)adaptor.GetNilNode(); dbg.Location(82,4); PushFollow(FOLLOW_setExpr_in_statement511); setExpr6 = setExpr(); state.followingStackPointer--; adaptor.AddChild(root_0, setExpr6.Tree); } break; } retval.Stop = input.LT(-1); retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, (IToken) retval.Start, (IToken) retval.Stop); } catch (RecognitionException re) { ReportError(re); Recover(input,re); // Conversion of the second argument necessary, but harmless retval.Tree = (CommonTree)adaptor.ErrorNode(input, (IToken) retval.Start, input.LT(-1), re); } finally { } dbg.Location(83, 2); } finally { dbg.ExitRule(GrammarFileName, "statement"); DecRuleLevel(); if ( RuleLevel==0 ) {dbg.Terminate();} } return retval; }
// $ANTLR start "statement" // TT\\Template.g:82:1: statement : ( getExpr | setExpr | defaultExpr | ifStatement | forEachLoop ); public TemplateParser.statement_return statement() // throws RecognitionException [1] { TemplateParser.statement_return retval = new TemplateParser.statement_return(); retval.Start = input.LT(1); CommonTree root_0 = null; TemplateParser.getExpr_return getExpr5 = default(TemplateParser.getExpr_return); TemplateParser.setExpr_return setExpr6 = default(TemplateParser.setExpr_return); TemplateParser.defaultExpr_return defaultExpr7 = default(TemplateParser.defaultExpr_return); TemplateParser.ifStatement_return ifStatement8 = default(TemplateParser.ifStatement_return); TemplateParser.forEachLoop_return forEachLoop9 = default(TemplateParser.forEachLoop_return); try { // TT\\Template.g:83:2: ( getExpr | setExpr | defaultExpr | ifStatement | forEachLoop ) int alt2 = 5; switch ( input.LA(1) ) { case ILITERAL: case LITERAL: case 57: { alt2 = 1; } break; case ID: { int LA2_2 = input.LA(2); if ( (LA2_2 == ASSIGN) ) { alt2 = 2; } else if ( ((LA2_2 >= TSTART && LA2_2 <= TSTOP) || LA2_2 == END) ) { alt2 = 1; } else { NoViableAltException nvae_d2s2 = new NoViableAltException("", 2, 2, input); throw nvae_d2s2; } } break; case 58: { alt2 = 2; } break; case DEFAULT: { alt2 = 3; } break; case IF: { alt2 = 4; } break; case FOREACH: { alt2 = 5; } break; default: NoViableAltException nvae_d2s0 = new NoViableAltException("", 2, 0, input); throw nvae_d2s0; } switch (alt2) { case 1 : // TT\\Template.g:83:4: getExpr { root_0 = (CommonTree)adaptor.GetNilNode(); PushFollow(FOLLOW_getExpr_in_statement524); getExpr5 = getExpr(); state.followingStackPointer--; adaptor.AddChild(root_0, getExpr5.Tree); } break; case 2 : // TT\\Template.g:84:4: setExpr { root_0 = (CommonTree)adaptor.GetNilNode(); PushFollow(FOLLOW_setExpr_in_statement529); setExpr6 = setExpr(); state.followingStackPointer--; adaptor.AddChild(root_0, setExpr6.Tree); } break; case 3 : // TT\\Template.g:85:4: defaultExpr { root_0 = (CommonTree)adaptor.GetNilNode(); PushFollow(FOLLOW_defaultExpr_in_statement534); defaultExpr7 = defaultExpr(); state.followingStackPointer--; adaptor.AddChild(root_0, defaultExpr7.Tree); } break; case 4 : // TT\\Template.g:86:4: ifStatement { root_0 = (CommonTree)adaptor.GetNilNode(); PushFollow(FOLLOW_ifStatement_in_statement539); ifStatement8 = ifStatement(); state.followingStackPointer--; adaptor.AddChild(root_0, ifStatement8.Tree); } break; case 5 : // TT\\Template.g:87:4: forEachLoop { root_0 = (CommonTree)adaptor.GetNilNode(); PushFollow(FOLLOW_forEachLoop_in_statement544); forEachLoop9 = forEachLoop(); state.followingStackPointer--; adaptor.AddChild(root_0, forEachLoop9.Tree); } break; } retval.Stop = input.LT(-1); retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, (IToken) retval.Start, (IToken) retval.Stop); } catch (RecognitionException re) { ReportError(re); Recover(input,re); // Conversion of the second argument necessary, but harmless retval.Tree = (CommonTree)adaptor.ErrorNode(input, (IToken) retval.Start, input.LT(-1), re); } finally { } return retval; }