public Block(BlockKind kind) { Kind = kind; Blocks = new List <Block>(); Text = new TextGenerator(); hasIndentChanged = false; }
public void PushBlock(BlockKind kind = BlockKind.Unknown, object obj = null) { var block = new Block { Kind = kind, Object = obj }; PushBlock(block); }
public void PushBlock(BlockKind kind = BlockKind.Unknown, object obj = null) { var block = new Block { Kind = kind, Object = obj }; block.Text.CurrentIndentation = CurrentIndentation; block.Text.IsStartOfLine = ActiveBlock.Text.IsStartOfLine; block.Text.NeedsNewLine = ActiveBlock.Text.NeedsNewLine; PushBlock(block); }
public IEnumerable <Block> FindBlocks(BlockKind kind) { foreach (var block in Blocks) { if (block.Kind == kind) { yield return(block); } foreach (var childBlock in block.FindBlocks(kind)) { yield return(childBlock); } } }
public Block FindBlock(BlockKind kind) { return(FindBlocks(kind).SingleOrDefault()); }
public IEnumerable <Block> FindBlocks(BlockKind kind) { return(RootBlock.FindBlocks(kind)); }