/** * Parse indented block token. * * @return BlockNode */ protected function parseBlock() { $node = new BlockNode($this->lexer->getCurrentLine()); $this->expectTokenType('indent'); while ($this->lexer->predictToken()->type !== 'outdent') { if ($this->lexer->predictToken()->type === 'newline') { $this->lexer->getAdvancedToken(); } else { $node->addChild($this->parseExpression()); } } $this->expectTokenType('outdent'); return $node; }