public override Template Visit(ExprNewArray expr) { Template template = new Template("new <elem>[<list; separator=\", \">]"); template.Add("elem", expr.ElemType); template.Add("list", expr.Args.Select(x => x.Accept(this))); return template; }
private Expr new_expr() { EnterRule_new_expr(); EnterRule("new_expr", 42); TraceIn("new_expr", 42); Expr value = default(Expr); string a = default(string); List<Expr> b = default(List<Expr>); try { DebugEnterRule(GrammarFileName, "new_expr"); DebugLocation(503, 1); try { // SugarWalker.g:504:2: ( ^( Expr_New_Type a= type_name (b= expr_list )? ) | ^( Expr_New_Array a= type_name b= expr_list ) ) int alt69=2; try { DebugEnterDecision(69, false); int LA69_0 = input.LA(1); if ((LA69_0==Expr_New_Type)) { alt69 = 1; } else if ((LA69_0==Expr_New_Array)) { alt69 = 2; } else { NoViableAltException nvae = new NoViableAltException("", 69, 0, input); DebugRecognitionException(nvae); throw nvae; } } finally { DebugExitDecision(69); } switch (alt69) { case 1: DebugEnterAlt(1); // SugarWalker.g:504:4: ^( Expr_New_Type a= type_name (b= expr_list )? ) { DebugLocation(504, 4); DebugLocation(504, 6); Match(input,Expr_New_Type,Follow._Expr_New_Type_in_new_expr2027); Match(input, TokenTypes.Down, null); DebugLocation(504, 21); PushFollow(Follow._type_name_in_new_expr2031); a=type_name(); PopFollow(); DebugLocation(504, 33); // SugarWalker.g:504:33: (b= expr_list )? int alt68=2; try { DebugEnterSubRule(68); try { DebugEnterDecision(68, false); int LA68_0 = input.LA(1); if (((LA68_0>=Expr_Access && LA68_0<=Expr_Tuple)||LA68_0==IDENT||LA68_0==Match_Tuple||LA68_0==NUMBER||LA68_0==STRING||LA68_0==75||LA68_0==78||LA68_0==82||LA68_0==85||LA68_0==89||LA68_0==95||LA68_0==98||LA68_0==102||LA68_0==104||LA68_0==110||LA68_0==113||LA68_0==117||LA68_0==150||LA68_0==DOUBLE)) { alt68 = 1; } } finally { DebugExitDecision(68); } switch (alt68) { case 1: DebugEnterAlt(1); // SugarWalker.g:504:33: b= expr_list { DebugLocation(504, 33); PushFollow(Follow._expr_list_in_new_expr2035); b=expr_list(); PopFollow(); } break; } } finally { DebugExitSubRule(68); } Match(input, TokenTypes.Up, null); DebugLocation(505, 2); value = new ExprNewType(a, b); } break; case 2: DebugEnterAlt(2); // SugarWalker.g:508:4: ^( Expr_New_Array a= type_name b= expr_list ) { DebugLocation(508, 4); DebugLocation(508, 6); Match(input,Expr_New_Array,Follow._Expr_New_Array_in_new_expr2046); Match(input, TokenTypes.Down, null); DebugLocation(508, 22); PushFollow(Follow._type_name_in_new_expr2050); a=type_name(); PopFollow(); DebugLocation(508, 34); PushFollow(Follow._expr_list_in_new_expr2054); b=expr_list(); PopFollow(); Match(input, TokenTypes.Up, null); DebugLocation(509, 2); value = new ExprNewArray(a, b); } break; } } catch (RecognitionException re) { ReportError(re); Recover(input,re); } finally { TraceOut("new_expr", 42); LeaveRule("new_expr", 42); LeaveRule_new_expr(); } DebugLocation(512, 1); } finally { DebugExitRule(GrammarFileName, "new_expr"); } return value; }
public abstract Template Visit(ExprNewArray expr);
private Expr new_expr() { EnterRule_new_expr(); EnterRule("new_expr", 51); TraceIn("new_expr", 51); Expr value = default(Expr); SugarType a = default(SugarType); List<Expr> b = default(List<Expr>); try { DebugEnterRule(GrammarFileName, "new_expr"); DebugLocation(659, 1); try { // SugarWalker.g:660:2: ( ^( Expr_New_Type a= type_name b= expr_list ) | ^( Expr_New_Array a= type_name b= expr_list ) ) int alt83=2; try { DebugEnterDecision(83, false); int LA83_0 = input.LA(1); if ((LA83_0==Expr_New_Type)) { alt83 = 1; } else if ((LA83_0==Expr_New_Array)) { alt83 = 2; } else { NoViableAltException nvae = new NoViableAltException("", 83, 0, input); DebugRecognitionException(nvae); throw nvae; } } finally { DebugExitDecision(83); } switch (alt83) { case 1: DebugEnterAlt(1); // SugarWalker.g:660:4: ^( Expr_New_Type a= type_name b= expr_list ) { DebugLocation(660, 4); DebugLocation(660, 6); Match(input,Expr_New_Type,Follow._Expr_New_Type_in_new_expr2574); Match(input, TokenTypes.Down, null); DebugLocation(660, 21); PushFollow(Follow._type_name_in_new_expr2578); a=type_name(); PopFollow(); DebugLocation(660, 33); PushFollow(Follow._expr_list_in_new_expr2582); b=expr_list(); PopFollow(); Match(input, TokenTypes.Up, null); DebugLocation(661, 2); value = new ExprNewType(a, b); } break; case 2: DebugEnterAlt(2); // SugarWalker.g:664:4: ^( Expr_New_Array a= type_name b= expr_list ) { DebugLocation(664, 4); DebugLocation(664, 6); Match(input,Expr_New_Array,Follow._Expr_New_Array_in_new_expr2592); Match(input, TokenTypes.Down, null); DebugLocation(664, 22); PushFollow(Follow._type_name_in_new_expr2596); a=type_name(); PopFollow(); DebugLocation(664, 34); PushFollow(Follow._expr_list_in_new_expr2600); b=expr_list(); PopFollow(); Match(input, TokenTypes.Up, null); DebugLocation(665, 2); value = new ExprNewArray(a, b); } break; } } catch (RecognitionException re) { ReportError(re); Recover(input,re); } finally { TraceOut("new_expr", 51); LeaveRule("new_expr", 51); LeaveRule_new_expr(); } DebugLocation(668, 1); } finally { DebugExitRule(GrammarFileName, "new_expr"); } return value; }