public override Template Visit(ExprDict expr) { Template template = new Template("<expr><list>"); template.Add("expr", expr.Expr.Accept(this)); List<Template> list = new List<Template>(); foreach (var index in expr.Index) { Template item = new Template("[<index>]"); item.Add("index", index.Accept(this)); list.Add(item); } template.Add("list", list); return template; }
private Expr dict_expr() { EnterRule_dict_expr(); EnterRule("dict_expr", 40); TraceIn("dict_expr", 40); Expr value = default(Expr); Expr a = default(Expr); List<Expr> b = default(List<Expr>); try { DebugEnterRule(GrammarFileName, "dict_expr"); DebugLocation(485, 1); try { // SugarWalker.g:486:2: ( ^( Expr_Dict a= expr (b= expr_list )? ) ) DebugEnterAlt(1); // SugarWalker.g:486:4: ^( Expr_Dict a= expr (b= expr_list )? ) { DebugLocation(486, 4); DebugLocation(486, 6); Match(input,Expr_Dict,Follow._Expr_Dict_in_dict_expr1940); Match(input, TokenTypes.Down, null); DebugLocation(486, 17); PushFollow(Follow._expr_in_dict_expr1944); a=expr(); PopFollow(); DebugLocation(486, 23); // SugarWalker.g:486:23: (b= expr_list )? int alt64=2; try { DebugEnterSubRule(64); try { DebugEnterDecision(64, false); int LA64_0 = input.LA(1); if (((LA64_0>=Expr_Access && LA64_0<=Expr_Tuple)||LA64_0==IDENT||LA64_0==Match_Tuple||LA64_0==NUMBER||LA64_0==STRING||LA64_0==75||LA64_0==78||LA64_0==82||LA64_0==85||LA64_0==89||LA64_0==95||LA64_0==98||LA64_0==102||LA64_0==104||LA64_0==110||LA64_0==113||LA64_0==117||LA64_0==150||LA64_0==DOUBLE)) { alt64 = 1; } } finally { DebugExitDecision(64); } switch (alt64) { case 1: DebugEnterAlt(1); // SugarWalker.g:486:24: b= expr_list { DebugLocation(486, 25); PushFollow(Follow._expr_list_in_dict_expr1949); b=expr_list(); PopFollow(); } break; } } finally { DebugExitSubRule(64); } Match(input, TokenTypes.Up, null); DebugLocation(487, 2); value = new ExprDict(a, b); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); } finally { TraceOut("dict_expr", 40); LeaveRule("dict_expr", 40); LeaveRule_dict_expr(); } DebugLocation(490, 1); } finally { DebugExitRule(GrammarFileName, "dict_expr"); } return value; }
public abstract Template Visit(ExprDict expr);
private Expr dict_expr() { EnterRule_dict_expr(); EnterRule("dict_expr", 49); TraceIn("dict_expr", 49); Expr value = default(Expr); Expr a = default(Expr); List<Expr> b = default(List<Expr>); try { DebugEnterRule(GrammarFileName, "dict_expr"); DebugLocation(633, 1); try { // SugarWalker.g:634:2: ( ^( Expr_Dict a= expr b= expr_list ) ) DebugEnterAlt(1); // SugarWalker.g:634:4: ^( Expr_Dict a= expr b= expr_list ) { DebugLocation(634, 4); DebugLocation(634, 6); Match(input,Expr_Dict,Follow._Expr_Dict_in_dict_expr2416); Match(input, TokenTypes.Down, null); DebugLocation(634, 17); PushFollow(Follow._expr_in_dict_expr2420); a=expr(); PopFollow(); DebugLocation(634, 24); PushFollow(Follow._expr_list_in_dict_expr2424); b=expr_list(); PopFollow(); Match(input, TokenTypes.Up, null); DebugLocation(635, 2); value = new ExprDict(a, b); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); } finally { TraceOut("dict_expr", 49); LeaveRule("dict_expr", 49); LeaveRule_dict_expr(); } DebugLocation(638, 1); } finally { DebugExitRule(GrammarFileName, "dict_expr"); } return value; }