Ejemplo n.º 1
0
 public Block(BlockKind kind)
 {
     Kind             = kind;
     Blocks           = new List <Block>();
     Text             = new TextGenerator();
     hasIndentChanged = false;
 }
Ejemplo n.º 2
0
        public void PushBlock(BlockKind kind = BlockKind.Unknown, object obj = null)
        {
            var block = new Block {
                Kind = kind, Object = obj
            };

            PushBlock(block);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
                }
            }
        }
Ejemplo n.º 5
0
 public Block FindBlock(BlockKind kind)
 {
     return(FindBlocks(kind).SingleOrDefault());
 }
Ejemplo n.º 6
0
 public IEnumerable <Block> FindBlocks(BlockKind kind)
 {
     return(RootBlock.FindBlocks(kind));
 }