public function parse(Twig_Token $token)
{
$lineno = $token->getLine();
+
$stream = $this->parser->getStream();
$name = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
if ($this->parser->hasBlock($name))
{
throw new Twig_SyntaxError("The block '$name' has already been defined", $lineno);
}
+
+ if (null !== $current = $this->parser->getCurrentBlock())
+ {
+ throw new Twig_SyntaxError("Blocks cannot be nested (you are trying to define a '$name' block inside the '$current' block)", $lineno);
+ }
+
$this->parser->setCurrentBlock($name);
if ($stream->test(Twig_Token::BLOCK_END_TYPE))