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
|
@ -13,8 +13,7 @@
|
|||
/**
|
||||
* Represents a token stream.
|
||||
*
|
||||
* @package twig
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class Twig_TokenStream
|
||||
{
|
||||
|
@ -45,6 +44,11 @@ class Twig_TokenStream
|
|||
return implode("\n", $this->tokens);
|
||||
}
|
||||
|
||||
public function injectTokens(array $tokens)
|
||||
{
|
||||
$this->tokens = array_merge(array_slice($this->tokens, 0, $this->current), $tokens, array_slice($this->tokens, $this->current));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the pointer to the next token and returns the old one.
|
||||
*
|
||||
|
@ -53,7 +57,7 @@ class Twig_TokenStream
|
|||
public function next()
|
||||
{
|
||||
if (!isset($this->tokens[++$this->current])) {
|
||||
throw new Twig_Error_Syntax('Unexpected end of template', -1, $this->filename);
|
||||
throw new Twig_Error_Syntax('Unexpected end of template', $this->tokens[$this->current - 1]->getLine(), $this->filename);
|
||||
}
|
||||
|
||||
return $this->tokens[$this->current - 1];
|
||||
|
@ -92,7 +96,7 @@ class Twig_TokenStream
|
|||
public function look($number = 1)
|
||||
{
|
||||
if (!isset($this->tokens[$this->current + $number])) {
|
||||
throw new Twig_Error_Syntax('Unexpected end of template', -1, $this->filename);
|
||||
throw new Twig_Error_Syntax('Unexpected end of template', $this->tokens[$this->current + $number - 1]->getLine(), $this->filename);
|
||||
}
|
||||
|
||||
return $this->tokens[$this->current + $number];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue