Beispiel #1
0
 public static string ToString(IEnumerable<IElement> elements, Indent indent)
 {
     return string.Join(
         Environment.NewLine,
         elements.Select(e => e.ToString(indent)).ToArray()
     );
 }
 public string ToString(Indent indent)
 {
     return string.Format(
         "{0}{1}[{2}] = {3}",
             indent.Value, this.Array, this.Index, this.Value
     );
 }
        public string ToString(Indent indent)
        {
            var target = this.Instance != null
                       ? this.Instance.ToString()
                       : this.Member.DeclaringType.FullName;

            return string.Format(
                "{0}{1}.{2} = {3}",
                    indent.Value, target, this.Member.Name, this.Value
            );
        }
Beispiel #4
0
        public string ToString(Indent indent)
        {
            var builder = new StringBuilder();
            var innerIndent = indent.Increment();
            builder.Append(indent.Value)
                   .AppendFormat("branch ({0}):", this.OpCode)
                   .AppendLine()
                   .Append(innerIndent.Value)
                   .Append("target:")
                   .AppendLine()
                   .Append(ElementHelper.ToString(this.Target, innerIndent.Increment()));

            builder.AppendLine()
                   .Append(innerIndent.Value)
                   .Append("fallback:")
                   .AppendLine()
                   .Append(ElementHelper.ToString(this.Fallback, innerIndent.Increment()));
            return builder.ToString();
        }
Beispiel #5
0
        public string ToString(Indent indent)
        {
            var builder = new StringBuilder();
            builder.Append(indent.Value)
                   .Append("if ")
                   .Append(this.Condition)
                   .Append(" then:")
                   .AppendLine()
                   .Append(ElementHelper.ToString(this.Then, indent.Increment()));

            if (this.Else.Count == 0)
                return builder.ToString();

            builder.AppendLine()
                   .Append(indent.Value)
                   .Append("else:")
                   .AppendLine()
                   .Append(ElementHelper.ToString(this.Else, indent.Increment()));
            return builder.ToString();
        }
Beispiel #6
0
 static Indent()
 {
     None = new Indent("", _ => _);
     FourSpaces = new Indent("", s => s + "    ");
 }
 public string ToString(Indent indent)
 {
     return indent.Value + this;
 }