Example #1
0
 internal static IndentedTextWriter GetIndentedTextWriter(TextWriter writer, JsFormatter formatter)
 {
     return(new IndentedTextWriter(writer, formatter.TabString)
     {
         NewLine = formatter.Newline
     });
 }
Example #2
0
 internal override void Write(System.CodeDom.Compiler.IndentedTextWriter writer, JsFormatter formatter)
 {
     writer.Write("while");
     writer.Write(formatter.Padding + "(");
     Condition.Write(writer, formatter);
     writer.Write(")" + formatter.Padding);
     Action.Write(writer, formatter);
 }
Example #3
0
        public virtual string ToString(JsFormatter formatter)
        {
            using (var sw = new StringWriter())
            {
                Write(sw, formatter);

                return sw.ToString();
            }
        }
Example #4
0
 internal override void Write(System.CodeDom.Compiler.IndentedTextWriter writer, JsFormatter formatter)
 {
     writer.WriteLine("{");
     writer.Indent++;
     foreach (var js in Body)
         js.Write(writer, formatter);
     writer.Indent--;
     writer.Write("}");
 }
Example #5
0
        public virtual string ToString(JsFormatter formatter)
        {
            using (var sw = new StringWriter())
            {
                Write(sw, formatter);

                return(sw.ToString());
            }
        }
Example #6
0
        public void Write(TextWriter tw, JsFormatter formatter = null)
        {
            if (formatter == null)
                formatter = JsFormatter.Default;

            using (var writer = GetIndentedTextWriter(tw, formatter))
            {
                Write(writer, formatter);
            }
        }
Example #7
0
        public void Write(TextWriter tw, JsFormatter formatter = null)
        {
            if (formatter == null)
            {
                formatter = JsFormatter.Default;
            }

            using (var writer = GetIndentedTextWriter(tw, formatter))
            {
                Write(writer, formatter);
            }
        }
Example #8
0
 internal override void Write(System.CodeDom.Compiler.IndentedTextWriter writer, JsFormatter formatter)
 {
     writer.Write("if");
     writer.Write(formatter.Padding + "(");
     Condition.Write(writer, formatter);
     writer.Write(")" + formatter.Padding);
     Action.Write(writer, formatter);
     if (Else != null)
     {
         writer.Write("else");
         writer.Write(Else is JsBlock ? formatter.Padding : " ");
         Else.Write(writer, formatter);
     }
 }
 internal override void Write(System.CodeDom.Compiler.IndentedTextWriter writer, JsFormatter formatter)
 {
     writer.Write("function");
     if (!string.IsNullOrEmpty(Name))
         writer.Write(string.Concat(" ", Name));
     writer.Write(formatter.Padding + "(");
     writer.Write(string.Join("," + formatter.Padding, Parameters));
     writer.Write(")" + formatter.Padding);
     writer.WriteLine("{");
     writer.Indent++;
     foreach (var js in Body)
         js.Write(writer, formatter);
     writer.Indent--;
     writer.Write("}");
 }
Example #10
0
 internal virtual void Write(IndentedTextWriter writer, JsFormatter formatter)
 {
     throw new InvalidOperationException();
 }
 internal override void Write(System.CodeDom.Compiler.IndentedTextWriter writer, JsFormatter formatter)
 {
     Left.Write(writer, formatter);
     writer.Write(string.Format("{1}{0}{1}", Operator, " "));
     Right.Write(writer, formatter);
 }
Example #12
0
 internal override void Write(System.CodeDom.Compiler.IndentedTextWriter writer, JsFormatter formatter)
 {
     writer.Write(Name);
 }
Example #13
0
 internal static IndentedTextWriter GetIndentedTextWriter(TextWriter writer, JsFormatter formatter)
 {
     return new IndentedTextWriter(writer, formatter.TabString) { NewLine = formatter.Newline };
 }
Example #14
0
 internal override void Write(System.CodeDom.Compiler.IndentedTextWriter writer, JsFormatter formatter)
 {
     Left.Write(writer, formatter);
     writer.Write(string.Format("{1}{0}{1}", Operator, formatter.Padding));
     Right.Write(writer, formatter);
 }
Example #15
0
 internal override void Write(System.CodeDom.Compiler.IndentedTextWriter writer, JsFormatter formatter)
 {
     base.Write(writer, formatter);
     writer.WriteLine(";");
 }
Example #16
0
 internal override void Write(System.CodeDom.Compiler.IndentedTextWriter writer, JsFormatter formatter)
 {
     writer.Write("return ");
     Expression.Write(writer, formatter);
     writer.WriteLine(";");
 }
Example #17
0
 internal override void Write(System.CodeDom.Compiler.IndentedTextWriter writer, JsFormatter formatter)
 {
     writer.Write("if");
     writer.Write(formatter.Padding + "(");
     Condition.Write(writer, formatter);
     writer.Write(")" + formatter.Padding);
     Action.Write(writer, formatter);
     if (Else != null)
     {
         writer.Write("else");
         writer.Write(Else is JsBlock ? formatter.Padding : " ");
         Else.Write(writer, formatter);
     }
 }
Example #18
0
 internal override void Write(System.CodeDom.Compiler.IndentedTextWriter writer, JsFormatter formatter)
 {
     writer.Write("return ");
     Expression.Write(writer, formatter);
     writer.WriteLine(";");
 }
Example #19
0
 internal override void Write(System.CodeDom.Compiler.IndentedTextWriter writer, JsFormatter formatter)
 {
     writer.Write(Name);
 }
Example #20
0
 internal override void Write(System.CodeDom.Compiler.IndentedTextWriter writer, JsFormatter formatter)
 {
     writer.Write("while");
     writer.Write(formatter.Padding + "(");
     Condition.Write(writer, formatter);
     writer.Write(")" + formatter.Padding);
     Action.Write(writer, formatter);
 }
Example #21
0
 internal override void Write(System.CodeDom.Compiler.IndentedTextWriter writer, JsFormatter formatter)
 {
     writer.Write("function");
     if (!string.IsNullOrEmpty(Name))
     {
         writer.Write(string.Concat(" ", Name));
     }
     writer.Write(formatter.Padding + "(");
     writer.Write(string.Join("," + formatter.Padding, Parameters));
     writer.Write(")" + formatter.Padding);
     writer.WriteLine("{");
     writer.Indent++;
     foreach (var js in Body)
     {
         js.Write(writer, formatter);
     }
     writer.Indent--;
     writer.Write("}");
 }
Example #22
0
 internal override void Write(System.CodeDom.Compiler.IndentedTextWriter writer, JsFormatter formatter)
 {
     writer.WriteLine("{");
     writer.Indent++;
     foreach (var js in Body)
     {
         js.Write(writer, formatter);
     }
     writer.Indent--;
     writer.Write("}");
 }
 internal override void Write(System.CodeDom.Compiler.IndentedTextWriter writer, JsFormatter formatter)
 {
     base.Write(writer, formatter);
     writer.WriteLine(";");
 }
Example #24
0
 internal virtual void Write(IndentedTextWriter writer, JsFormatter formatter)
 {
     throw new InvalidOperationException();
 }