예제 #1
0
        /// <summary>
        ///     Appends a statement block to the context with correct indentation.
        /// </summary>
        /// <param name="block">The block to append.</param>
        /// <param name="visitor">The visitor to use for printing each statement.</param>
        /// <param name="withBrackets">If false, opening and closing brackets will be omitted.</param>
        public SSTPrintingContext StatementBlock(IKaVEList <IStatement> block,
                                                 ISSTNodeVisitor <SSTPrintingContext> visitor,
                                                 bool withBrackets = true)
        {
            if (!block.Any())
            {
                if (withBrackets)
                {
                    Text(" { }");
                }

                return(this);
            }

            if (withBrackets)
            {
                NewLine().Indentation().Text("{");
            }

            IndentationLevel++;

            foreach (var statement in block)
            {
                NewLine();
                statement.Accept(visitor, this);
            }

            IndentationLevel--;

            if (withBrackets)
            {
                NewLine().Indentation().Text("}");
            }

            return(this);
        }
예제 #2
0
 public TReturn Accept <TContext, TReturn>(ISSTNodeVisitor <TContext, TReturn> visitor, TContext context)
 {
     return(visitor.Visit(this, context));
 }
예제 #3
0
 public void Accept <TContext>(ISSTNodeVisitor <TContext> visitor, TContext context)
 {
     visitor.Visit(this, context);
 }