protected function parseExtends($token)
{
if (!is_null($this->extends)) {
throw new SyntaxError('multiple extends tags', $token);
}
if (!empty($this->currentBlock)) {
throw new SyntaxError('cannot declare extends inside blocks', $token);
}
if ($this->inMacro) {
throw new SyntaxError('cannot declare extends inside macros', $token);
}
$parent = $this->parseExpression();
$params = null;
if ($this->stream->consume(Token::NAME, 'with')) {
$this->stream->expect(Token::OPERATOR, '[');
$params = $this->parseArrayExpression();
$this->stream->expect(Token::OPERATOR, ']');
}
$this->extends = $this->parseIfModifier($token, new Node\ExtendsNode($parent, $params, $token->getLine()));
$this->stream->expect(Token::BLOCK_END);
return null;
}