/**
* @param AbstractBlock $block
*
* @return AbstractBlock
*/
public function addBlock(AbstractBlock $block)
{
$this->getBlockCloser()->closeUnmatchedBlocks();
$block->setStartLine($this->lineNumber);
while (!$this->tip->canContain($block)) {
$this->tip->finalize($this);
}
$this->tip->addChild($block);
$this->tip = $block;
$this->container = $block;
return $block;
}