private static SyntaxNode Compound(RParser.CompoundContext compound, Func <ParserRuleContext, Scope, SyntaxNode> transform, Scope scope) { //create a new context for the block var inner = new Scope(scope); inner.InitR(); var pre = inner.PreStatements(); var statements = new List <StatementSyntax>(); var exprlist = compound.exprlist(); if (exprlist is RParser.ExpressionListContext) { var list = exprlist as RParser.ExpressionListContext; foreach (var expr in list.expr_or_assign()) { pre.Clear(); var statement = transform(expr, inner) as StatementSyntax; Debug.Assert(statement != null); statements.AddRange(pre); statements.Add(statement); } } return(CSharp.Block(statements)); }
/// <summary> /// Exit a parse tree produced by <see cref="RParser.Compound"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitCompound([NotNull] RParser.CompoundContext context) { }