Example #1
0
 public abstract Template Visit(ExprWhere expr);
Example #2
0
 public override Template Visit(ExprWhere expr)
 {
     Template template = new Template("({\n    <list; separator=\"\n\">\n})");
     List<Template> list = new List<Template>();
     foreach (var x in expr.StmtList) list.Add(x.Accept(this));
     list.Add((new StmtExpr(expr.Expr)).Accept(this));
     template.Add("list", list);
     return template;
 }
Example #3
0
	private Expr where_expr()
	{
		EnterRule_where_expr();
		EnterRule("where_expr", 57);
		TraceIn("where_expr", 57);
		Expr value = default(Expr);


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


			List<Stmt> stmt_list = new List<Stmt>();

		try { DebugEnterRule(GrammarFileName, "where_expr");
		DebugLocation(735, 1);
		try
		{
			// SugarWalker.g:740:2: ( ^( Expr_Where a= expr (b= stmt )+ ) )
			DebugEnterAlt(1);
			// SugarWalker.g:740:4: ^( Expr_Where a= expr (b= stmt )+ )
			{
			DebugLocation(740, 4);
			DebugLocation(740, 6);
			Match(input,Expr_Where,Follow._Expr_Where_in_where_expr2890); 

			Match(input, TokenTypes.Down, null); 
			DebugLocation(740, 18);
			PushFollow(Follow._expr_in_where_expr2894);
			a=expr();
			PopFollow();

			DebugLocation(740, 24);
			// SugarWalker.g:740:24: (b= stmt )+
			int cnt86=0;
			try { DebugEnterSubRule(86);
			while (true)
			{
				int alt86=2;
				try { DebugEnterDecision(86, false);
				int LA86_0 = input.LA(1);

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


				} finally { DebugExitDecision(86); }
				switch (alt86)
				{
				case 1:
					DebugEnterAlt(1);
					// SugarWalker.g:740:25: b= stmt
					{
					DebugLocation(740, 26);
					PushFollow(Follow._stmt_in_where_expr2899);
					b=stmt();
					PopFollow();

					DebugLocation(740, 32);
					 foreach (var x in b) stmt_list.Add(x); 

					}
					break;

				default:
					if (cnt86 >= 1)
						goto loop86;

					EarlyExitException eee86 = new EarlyExitException( 86, input );
					DebugRecognitionException(eee86);
					throw eee86;
				}
				cnt86++;
			}
			loop86:
				;

			} finally { DebugExitSubRule(86); }


			Match(input, TokenTypes.Up, null); 

			DebugLocation(741, 2);

					value = new ExprWhere(stmt_list, a);
				

			}

		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		}
		finally
		{
			TraceOut("where_expr", 57);
			LeaveRule("where_expr", 57);
			LeaveRule_where_expr();
		}
		DebugLocation(744, 1);
		} finally { DebugExitRule(GrammarFileName, "where_expr"); }
		return value;

	}