forked from leftypol/leftypol
Upgrade Twig library
This commit is contained in:
parent
22f3a95e0e
commit
0fe5528574
133 changed files with 5080 additions and 1386 deletions
|
@ -35,8 +35,9 @@ class Twig_TokenParser_Block extends Twig_TokenParser
|
|||
$stream = $this->parser->getStream();
|
||||
$name = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
|
||||
if ($this->parser->hasBlock($name)) {
|
||||
throw new Twig_Error_Syntax("The block '$name' has already been defined", $lineno);
|
||||
throw new Twig_Error_Syntax(sprintf("The block '$name' has already been defined line %d", $this->parser->getBlock($name)->getLine()), $stream->getCurrent()->getLine(), $stream->getFilename());
|
||||
}
|
||||
$this->parser->setBlock($name, $block = new Twig_Node_Block($name, new Twig_Node(array()), $lineno));
|
||||
$this->parser->pushLocalScope();
|
||||
$this->parser->pushBlockStack($name);
|
||||
|
||||
|
@ -48,7 +49,7 @@ class Twig_TokenParser_Block extends Twig_TokenParser
|
|||
$value = $stream->next()->getValue();
|
||||
|
||||
if ($value != $name) {
|
||||
throw new Twig_Error_Syntax(sprintf("Expected endblock for block '$name' (but %s given)", $value), $lineno);
|
||||
throw new Twig_Error_Syntax(sprintf("Expected endblock for block '$name' (but %s given)", $value), $stream->getCurrent()->getLine(), $stream->getFilename());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -58,8 +59,7 @@ class Twig_TokenParser_Block extends Twig_TokenParser
|
|||
}
|
||||
$stream->expect(Twig_Token::BLOCK_END_TYPE);
|
||||
|
||||
$block = new Twig_Node_Block($name, $body, $lineno);
|
||||
$this->parser->setBlock($name, $block);
|
||||
$block->setNode('body', $body);
|
||||
$this->parser->popBlockStack();
|
||||
$this->parser->popLocalScope();
|
||||
|
||||
|
@ -74,7 +74,7 @@ class Twig_TokenParser_Block extends Twig_TokenParser
|
|||
/**
|
||||
* Gets the tag name associated with this token parser.
|
||||
*
|
||||
* @param string The tag name
|
||||
* @return string The tag name
|
||||
*/
|
||||
public function getTag()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue