mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-16 12:26:30 +00:00
added the possibility to look at more than just the very next token
This commit is contained in:
@@ -69,15 +69,17 @@ class Twig_TokenStream
|
||||
/**
|
||||
* Looks at the next token.
|
||||
*
|
||||
* @param integer $number
|
||||
*
|
||||
* @return Twig_Token
|
||||
*/
|
||||
public function look()
|
||||
public function look($number = 1)
|
||||
{
|
||||
if (!isset($this->tokens[$this->current + 1])) {
|
||||
if (!isset($this->tokens[$this->current + $number])) {
|
||||
throw new Twig_Error_Syntax('Unexpected end of template');
|
||||
}
|
||||
|
||||
return $this->tokens[$this->current + 1];
|
||||
return $this->tokens[$this->current + $number];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user