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

            PushBlock(block);
        }
示例#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);
        }
示例#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);
                }
            }
        }
示例#5
0
 public Block FindBlock(BlockKind kind)
 {
     return(FindBlocks(kind).SingleOrDefault());
 }
示例#6
0
 public IEnumerable <Block> FindBlocks(BlockKind kind)
 {
     return(RootBlock.FindBlocks(kind));
 }