public override Template Visit(MatchTuple match) { Template template = new Template("std::tie(<list; separator=\", \">)"); template.Add("list", match.ExprList.Select(x => x.Accept(this))); return template; }
private MatchTuple match_tuple() { EnterRule_match_tuple(); EnterRule("match_tuple", 37); TraceIn("match_tuple", 37); MatchTuple value = default(MatchTuple); Expr a = default(Expr); value = new MatchTuple(); try { DebugEnterRule(GrammarFileName, "match_tuple"); DebugLocation(462, 1); try { // SugarWalker.g:467:2: ( ^( Match_Tuple (a= expr )* ) ) DebugEnterAlt(1); // SugarWalker.g:467:4: ^( Match_Tuple (a= expr )* ) { DebugLocation(467, 4); DebugLocation(467, 6); Match(input,Match_Tuple,Follow._Match_Tuple_in_match_tuple1849); if (input.LA(1) == TokenTypes.Down) { Match(input, TokenTypes.Down, null); DebugLocation(467, 18); // SugarWalker.g:467:18: (a= expr )* try { DebugEnterSubRule(60); while (true) { int alt60=2; try { DebugEnterDecision(60, false); int LA60_0 = input.LA(1); if (((LA60_0>=Expr_Access && LA60_0<=Expr_Tuple)||LA60_0==IDENT||LA60_0==Match_Tuple||LA60_0==NUMBER||LA60_0==STRING||LA60_0==75||LA60_0==78||LA60_0==82||LA60_0==85||LA60_0==89||LA60_0==95||LA60_0==98||LA60_0==102||LA60_0==104||LA60_0==110||LA60_0==113||LA60_0==117||LA60_0==150||LA60_0==DOUBLE)) { alt60 = 1; } } finally { DebugExitDecision(60); } switch ( alt60 ) { case 1: DebugEnterAlt(1); // SugarWalker.g:467:19: a= expr { DebugLocation(467, 20); PushFollow(Follow._expr_in_match_tuple1854); a=expr(); PopFollow(); DebugLocation(467, 26); value.ExprList.Add(a); } break; default: goto loop60; } } loop60: ; } finally { DebugExitSubRule(60); } Match(input, TokenTypes.Up, null); } } } catch (RecognitionException re) { ReportError(re); Recover(input,re); } finally { TraceOut("match_tuple", 37); LeaveRule("match_tuple", 37); LeaveRule_match_tuple(); } DebugLocation(468, 1); } finally { DebugExitRule(GrammarFileName, "match_tuple"); } return value; }
public abstract Template Visit(MatchTuple match);
public abstract Template Visit(MatchTuple match);
private MatchTuple match_tuple() { EnterRule_match_tuple(); EnterRule("match_tuple", 46); TraceIn("match_tuple", 46); MatchTuple value = default(MatchTuple); Expr a = default(Expr); value = new MatchTuple(); try { DebugEnterRule(GrammarFileName, "match_tuple"); DebugLocation(610, 1); try { // SugarWalker.g:615:2: ( ^( Match_Tuple (a= expr )* ) ) DebugEnterAlt(1); // SugarWalker.g:615:4: ^( Match_Tuple (a= expr )* ) { DebugLocation(615, 4); DebugLocation(615, 6); Match(input,Match_Tuple,Follow._Match_Tuple_in_match_tuple2324); if (input.LA(1) == TokenTypes.Down) { Match(input, TokenTypes.Down, null); DebugLocation(615, 18); // SugarWalker.g:615:18: (a= expr )* try { DebugEnterSubRule(71); while (true) { int alt71=2; try { DebugEnterDecision(71, false); int LA71_0 = input.LA(1); if (((LA71_0>=Expr_Access && LA71_0<=Expr_Alloc_Equal)||(LA71_0>=Expr_Bin && LA71_0<=Expr_Where)||LA71_0==IDENT||LA71_0==Match_Expr||LA71_0==Match_Tuple||LA71_0==NUMBER||LA71_0==STRING||LA71_0==89||LA71_0==92||LA71_0==96||LA71_0==99||LA71_0==104||LA71_0==110||LA71_0==113||LA71_0==118||LA71_0==121||LA71_0==128||LA71_0==131||LA71_0==135||LA71_0==183||LA71_0==DOUBLE)) { alt71 = 1; } } finally { DebugExitDecision(71); } switch ( alt71 ) { case 1: DebugEnterAlt(1); // SugarWalker.g:615:19: a= expr { DebugLocation(615, 20); PushFollow(Follow._expr_in_match_tuple2329); a=expr(); PopFollow(); DebugLocation(615, 26); value.ExprList.Add(a); } break; default: goto loop71; } } loop71: ; } finally { DebugExitSubRule(71); } Match(input, TokenTypes.Up, null); } } } catch (RecognitionException re) { ReportError(re); Recover(input,re); } finally { TraceOut("match_tuple", 46); LeaveRule("match_tuple", 46); LeaveRule_match_tuple(); } DebugLocation(616, 1); } finally { DebugExitRule(GrammarFileName, "match_tuple"); } return value; }