示例#1
0
文件: Block.cs 项目: macias/Skila
        public override ICode Printout()
        {
            var code = new CodeDiv(this, this.instructions.Select(it => new CodeSpan(it).Append(";")).ToArray()).Indent();

            code.Prepend("{").Append("}");
            return(code);
        }
示例#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);
        }
示例#3
0
文件: Loop.cs 项目: 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);
        }
示例#4
0
文件: IfBranch.cs 项目: macias/Skila
        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);
        }