Пример #1
0
 public override Template Visit(ExprList expr)
 {
     Template template = new Template("{ <list; separator=\", \"> }");
     template.Add("list", expr.List.Select(x => x.Accept(this)));
     return template;
 }
Пример #2
0
 public abstract Template Visit(ExprList expr);
Пример #3
0
	private ExprList list_expr()
	{
		EnterRule_list_expr();
		EnterRule("list_expr", 45);
		TraceIn("list_expr", 45);
		ExprList value = default(ExprList);


		List<Expr> a = default(List<Expr>);

		try { DebugEnterRule(GrammarFileName, "list_expr");
		DebugLocation(537, 1);
		try
		{
			// SugarWalker.g:538:2: ( ^( Expr_List (a= expr_list )? ) )
			DebugEnterAlt(1);
			// SugarWalker.g:538:4: ^( Expr_List (a= expr_list )? )
			{
			DebugLocation(538, 4);
			DebugLocation(538, 6);
			Match(input,Expr_List,Follow._Expr_List_in_list_expr2135); 

			if (input.LA(1) == TokenTypes.Down)
			{
				Match(input, TokenTypes.Down, null); 
				DebugLocation(538, 17);
				// SugarWalker.g:538:17: (a= expr_list )?
				int alt71=2;
				try { DebugEnterSubRule(71);
				try { DebugEnterDecision(71, false);
				int LA71_0 = input.LA(1);

				if (((LA71_0>=Expr_Access && LA71_0<=Expr_Tuple)||LA71_0==IDENT||LA71_0==Match_Tuple||LA71_0==NUMBER||LA71_0==STRING||LA71_0==75||LA71_0==78||LA71_0==82||LA71_0==85||LA71_0==89||LA71_0==95||LA71_0==98||LA71_0==102||LA71_0==104||LA71_0==110||LA71_0==113||LA71_0==117||LA71_0==150||LA71_0==DOUBLE))
				{
					alt71 = 1;
				}
				} finally { DebugExitDecision(71); }
				switch (alt71)
				{
				case 1:
					DebugEnterAlt(1);
					// SugarWalker.g:538:17: a= expr_list
					{
					DebugLocation(538, 17);
					PushFollow(Follow._expr_list_in_list_expr2139);
					a=expr_list();
					PopFollow();


					}
					break;

				}
				} finally { DebugExitSubRule(71); }


				Match(input, TokenTypes.Up, null); 
			}

			DebugLocation(539, 2);

					value = new ExprList(a);
				

			}

		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		}
		finally
		{
			TraceOut("list_expr", 45);
			LeaveRule("list_expr", 45);
			LeaveRule_list_expr();
		}
		DebugLocation(542, 1);
		} finally { DebugExitRule(GrammarFileName, "list_expr"); }
		return value;

	}
Пример #4
0
	private ExprList list_expr()
	{
		EnterRule_list_expr();
		EnterRule("list_expr", 54);
		TraceIn("list_expr", 54);
		ExprList value = default(ExprList);


		Expr a = default(Expr);


			var list = new List<Expr>();

		try { DebugEnterRule(GrammarFileName, "list_expr");
		DebugLocation(693, 1);
		try
		{
			// SugarWalker.g:698:2: ( ^( Expr_List (a= expr )* ) )
			DebugEnterAlt(1);
			// SugarWalker.g:698:4: ^( Expr_List (a= expr )* )
			{
			DebugLocation(698, 4);
			DebugLocation(698, 6);
			Match(input,Expr_List,Follow._Expr_List_in_list_expr2685); 

			if (input.LA(1) == TokenTypes.Down)
			{
				Match(input, TokenTypes.Down, null); 
				DebugLocation(698, 16);
				// SugarWalker.g:698:16: (a= expr )*
				try { DebugEnterSubRule(84);
				while (true)
				{
					int alt84=2;
					try { DebugEnterDecision(84, false);
					int LA84_0 = input.LA(1);

					if (((LA84_0>=Expr_Access && LA84_0<=Expr_Alloc_Equal)||(LA84_0>=Expr_Bin && LA84_0<=Expr_Where)||LA84_0==IDENT||LA84_0==Match_Expr||LA84_0==Match_Tuple||LA84_0==NUMBER||LA84_0==STRING||LA84_0==89||LA84_0==92||LA84_0==96||LA84_0==99||LA84_0==104||LA84_0==110||LA84_0==113||LA84_0==118||LA84_0==121||LA84_0==128||LA84_0==131||LA84_0==135||LA84_0==183||LA84_0==DOUBLE))
					{
						alt84 = 1;
					}


					} finally { DebugExitDecision(84); }
					switch ( alt84 )
					{
					case 1:
						DebugEnterAlt(1);
						// SugarWalker.g:698:17: a= expr
						{
						DebugLocation(698, 18);
						PushFollow(Follow._expr_in_list_expr2690);
						a=expr();
						PopFollow();

						DebugLocation(698, 24);
						 list.Add(a); 

						}
						break;

					default:
						goto loop84;
					}
				}

				loop84:
					;

				} finally { DebugExitSubRule(84); }


				Match(input, TokenTypes.Up, null); 
			}

			DebugLocation(699, 2);

					value = new ExprList(list);
				

			}

		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		}
		finally
		{
			TraceOut("list_expr", 54);
			LeaveRule("list_expr", 54);
			LeaveRule_list_expr();
		}
		DebugLocation(702, 1);
		} finally { DebugExitRule(GrammarFileName, "list_expr"); }
		return value;

	}