public void WriteControlStructure(ControlStructureBlock block) { WriteIndent(); WriteLine(block.Keyword.Text); StartBlock(); VisitContainer(block.VMembers); EndBlock(); }
/// <summary> /// Tries to UnIndent the current line - /// if this line is inside some ControlStructureBlock, /// move this line out and after its parent. /// </summary> /// <returns>Parent control structure if UnIndent is possible, null otherwise.</returns> protected virtual Block CanUnIndent() { ControlStructureBlock par = ParentParent as ControlStructureBlock; if (par == null || this.Prev == null || this.Next != null) { return(null); } return(par); }
public void WriteControlStructureWithString(ControlStructureBlock block, string title) { WriteIndent(); Write(block.Keyword.Text); Write("("); Write(title); WriteLine(")"); StartBlock(); VisitContainer(block.VMembers); EndBlock(); }
/// <summary> /// Tries to "indent" the current line - which is, /// if a previous block is a ControlStructureBlock, it tries to /// append this line to the end of the previous block, thus "raising" it. /// </summary> /// <returns>A block after which the current block must be placed, /// to be indented. null if no such block exists.</returns> protected Block CanIndent() { ControlStructureBlock prev = this.Prev as ControlStructureBlock; if (prev == null) { return(null); } return(prev.VMembers.Children.Tail); }