internal static HCode Clause(ICode clause, params ICode[] args)
 {
     var code = new HCode() { AddIndentNewLine = true, Separator = " " };
     code.Add(clause);
     code.AddRange(args);
     return code;
 }
        internal static HCode Clause(ICode clause, params ICode[] args)
        {
            var code = new HCode()
            {
                AddIndentNewLine = true, Separator = " "
            };

            code.Add(clause);
            code.AddRange(args);
            return(code);
        }
示例#3
0
        ICode Layout(ICode[] code)
        {
            ICode[] front, back;
            TakeAndSkip(code, _firstLineElemetCount, out front, out back);

            if (FormatDirection == FormatDirection.Vertical)
            {
                var mustFirstLine = new HCode(front)
                {
                    EnableChangeLine = false
                };
                var layout = new VCode(mustFirstLine)
                {
                    Indent = Indent
                };

                //after line, add indent.
                for (int i = 0; i < back.Length; i++)
                {
                    layout.Add(new HCode(back[i])
                    {
                        Indent = 1
                    });
                }
                return(layout);
            }
            else
            {
                var mustFirstLine = new HCode(front)
                {
                    EnableChangeLine = false
                };
                var layout = new HCode(mustFirstLine)
                {
                    AddIndentNewLine = true, Indent = Indent
                };
                layout.AddRange(back);
                return(layout);
            }
        }