Ejemplo n.º 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
     );
 }
Ejemplo n.º 3
0
        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
            );
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 6
0
 static Indent()
 {
     None = new Indent("", _ => _);
     FourSpaces = new Indent("", s => s + "    ");
 }
Ejemplo n.º 7
0
 public string ToString(Indent indent)
 {
     return indent.Value + this;
 }