Example #1
0
        public override ICode Printout()
        {
            var code = new CodeDiv(this, this.instructions.Select(it => new CodeSpan(it).Append(";")).ToArray()).Indent();

            code.Prepend("{").Append("}");
            return(code);
        }
Example #2
0
        public override ICode Printout()
        {
            var code = new CodeDiv(this, new CodeSpan(base.Printout()).Append("(").Append(this.Parameters, ",").Append(") -> ")
                                   .Append(this.ResultTypeName));

            if (this.UserBody != null)
            {
                code.Append(this.UserBody);
            }
            return(code);
        }
Example #3
0
File: Loop.cs Project: macias/Skila
        public ICode Printout()
        {
            var code = new CodeDiv(this, this.Body.ToArray()).Indent();

            code.Prepend("{").Append("}");
            code.Prepend(new CodeSpan("for (").Append(";").Append(PreCondition).Append(";").Append(PostStep, " ;, ").Append(")"));
            if (PostCondition != null)
            {
                code.Append(new CodeSpan("endfor (").Append(PostCondition).Append(")"));
            }
            else
            {
                code.Append(new CodeSpan("endfor"));
            }

            return(code);
        }
Example #4
0
        public ICode Printout()
        {
            CodeDiv code = new CodeDiv(this, this.Body);

            if (IsElse)
            {
                code.Prepend("else");
            }
            else
            {
                code.Prepend(new CodeSpan("(if ").Append(Condition).Append(" then"));
            }
            if (this.Next != null)
            {
                code.Append(this.Next);
            }
            code.Append(")");

            return(code);
        }