public override void Format(PositionedWriter writer, bool semi) { writer.Write("["); var first = true; var indented = false; foreach (var elem in this.Elements) { if (first) { first = false; } else { writer.Write(", "); } if (writer.ReachLineEnd()) { if (!indented) { indented = true; writer.IndentForward(); } writer.NewLine(); writer.Indent(); } elem.Format(writer, semi); } if (indented) { writer.IndentBack(); } writer.Write("]"); }
public override void Format(PositionedWriter writer, bool semi) { writer.Write("catch("); this.Param.Format(writer, semi); writer.Write(")"); this.Body.Format(writer, semi); }
public override void Format(PositionedWriter writer, bool semi) { if (semi) { writer.Write(";"); } }
public override void Format(PositionedWriter writer, bool semi) { writer.Write("{"); if (this.Properties.Length > 0) { writer.IndentForward(); var first = true; foreach (var p in this.Properties) { if (first) { first = false; } else { writer.Write(", "); } writer.NewLine(); writer.Indent(); p.Format(writer, semi); } writer.NewLine(); writer.IndentBack(); writer.Indent(); } writer.Write("}"); }
public override void Format(PositionedWriter writer, bool semi) { writer.Write("<"); this.Name.Format(writer, semi); var indented = false; foreach (var attr in this.Attributes) { writer.Write(" "); if (writer.ReachLineEnd()) { if (!indented) { indented = true; writer.IndentForward(); } writer.NewLine(); writer.Indent(); } attr.Format(writer, semi); } if (indented) { writer.IndentBack(); } if (this.SelfClosing) { writer.Write("/>"); } else { writer.Write(">"); } }
public override void Format(PositionedWriter writer, bool semi) { if (this.Callee is FunctionExpression) { writer.Write("("); this.Callee.Format(writer, semi); writer.Write(")"); } else { this.Callee.Format(writer, semi); } writer.Write("("); var first = true; foreach (var a in this.Arguments) { if (first) { first = false; } else { writer.Write(", "); } a.Format(writer, semi); } writer.Write(")"); }
public override void Format(PositionedWriter writer, bool semi) { writer.Write("function "); if (this.Id != null) { this.Id.Format(writer, semi); } writer.Write("("); var first = true; foreach (var p in this.Params) { if (first) { first = false; } else { writer.Write(", "); } p.Format(writer, semi); } writer.Write(")"); this.Body.Format(writer, semi); }
public override void Format(PositionedWriter writer, bool semi) { foreach (var statement in Body) { statement.Format(writer, semi); writer.NewLine(); } }
public override void Format(PositionedWriter writer, bool semi) { writer.Write("for("); this.Left.Format(writer, semi); writer.Write("in"); this.Right.Format(writer, semi); this.Body.Format(writer, semi); }
public override void Format(PositionedWriter writer, bool semi) { this.Test.Format(writer, semi); writer.Write(" ? "); this.Consequent.Format(writer, semi); writer.Write(" : "); this.Alternate.Format(writer, semi); }
public override void Format(PositionedWriter writer, bool semi) { this.Expression.Format(writer, semi); if (semi) { writer.Write(";"); } }
public override void Format(PositionedWriter writer, bool semi) { this.Left.Format(writer, semi); writer.Write(" "); writer.Write(this.Op); writer.Write(" "); this.Right.Format(writer, semi); }
public override void Format(PositionedWriter writer, bool semi) { writer.Write("throw "); this.Argument.Format(writer, semi); if (semi) { writer.Write(";"); } }
public override void Format(PositionedWriter writer, bool semi) { this.Label.Format(writer, semi); writer.WriteLine(": "); writer.IndentForward(); writer.Indent(); this.Body.Format(writer, semi); writer.IndentBack(); }
public override void Format(PositionedWriter writer, bool semi) { this.Id.Format(writer, semi); if (this.Init != null) { writer.Write(" = "); this.Init.Format(writer, semi); } }
public override void Format(PositionedWriter writer, bool semi) { writer.Write("do"); this.Body.Format(writer, semi); writer.NewLine(); writer.Indent(); writer.Write("while("); this.Test.Format(writer, semi); writer.Write(")"); }
public override void Format(PositionedWriter writer, bool semi) { if (semi) { writer.Write("debugger;"); } else { writer.Write("debugger"); } }
public override void Format(PositionedWriter writer, bool semi) { writer.Write("for("); this.Init.Format(writer, false); writer.Write(";"); this.Test.Format(writer, false); writer.Write(";"); this.Update.Format(writer, false); writer.Write(";)"); this.Body.Format(writer, semi); }
public override void Format(PositionedWriter writer, bool semi) { if (semi) { writer.Write("continue;"); } else { writer.Write("continue"); } }
public string Format(bool semi) { var writer = new PositionedWriter(); foreach (var statement in Body) { statement.Format(writer, semi); writer.NewLine(); } return(writer.ToString()); }
public override void Format(PositionedWriter writer, bool semi) { if (this.Prefix) { writer.Write(this.Op); this.Argument.Format(writer, semi); } else { this.Argument.Format(writer, semi); writer.Write(this.Op); } }
public override void Format(PositionedWriter writer, bool semi) { writer.Write("return"); if (this.Argument != null) { writer.Write(" "); this.Argument.Format(writer, semi); } if (semi) { writer.Write(";"); } }
public override void Format(PositionedWriter writer, bool semi) { writer.WriteLine("{"); writer.IndentForward(); foreach (var statement in this.Body) { writer.Indent(); statement.Format(writer, semi); writer.NewLine(); } writer.IndentBack(); writer.Indent(); writer.Write("}"); }
public override void Format(PositionedWriter writer, bool semi) { writer.Write("if("); this.Test.Format(writer, semi); writer.Write(")"); this.Consequent.Format(writer, semi); if (this.Alternate != null) { writer.NewLine(); writer.Indent(); writer.Write("else "); this.Alternate.Format(writer, semi); } }
public override void Format(PositionedWriter writer, bool semi) { this.Object.Format(writer, semi); if (this.Computed) { writer.Write("["); this.Property.Format(writer, semi); writer.Write("]"); } else { writer.Write("."); this.Property.Format(writer, semi); } }
protected static void SpacePad(PositionedWriter writer, int length) { while (length >= 32) { writer.Write(SPACES[5]); length -= 32; } for (int i = 4; i >= 0; i--) { if ((length & (1 << i)) != 0) { writer.Write(SPACES[i]); } } }
public override void Format(PositionedWriter writer, bool semi) { writer.Write("switch("); this.Discriminant.Format(writer, semi); writer.Write("){"); writer.NewLine(); writer.IndentForward(); foreach (var c in this.Cases) { writer.Indent(); c.Format(writer, semi); writer.NewLine(); } writer.IndentBack(); writer.Indent(); writer.Write("}"); }
public override void Format(PositionedWriter writer, bool semi) { var first = true; foreach (var expr in this.Expressions) { if (first) { first = false; expr.Format(writer, semi); } else { writer.Write(", "); expr.Format(writer, semi); } } }
public override void Format(PositionedWriter writer, bool semi) { writer.Write("try "); this.Block.Format(writer, semi); if (this.Handler != null) { writer.NewLine(); writer.Indent(); this.Handler.Format(writer, semi); writer.NewLine(); } if (this.Finalizer != null) { writer.Indent(); writer.Write("finally"); this.Finalizer.Format(writer, semi); } }
public override void Format(PositionedWriter writer, bool semi) { this.OpeningElement.Format(writer, semi); if (this.Children.Length > 0) { writer.IndentForward(); foreach (var child in this.Children) { writer.NewLine(); writer.Indent(); child.Format(writer, semi); } writer.IndentBack(); } if (this.ClosingElement != null) { writer.NewLine(); writer.Indent(); this.ClosingElement.Format(writer, semi); } }