Revision 1852
Added by darkviper almost 13 years ago
| TokenStream.php | ||
|---|---|---|
| 45 | 45 |
return implode("\n", $this->tokens);
|
| 46 | 46 |
} |
| 47 | 47 |
|
| 48 |
public function injectTokens(array $tokens) |
|
| 49 |
{
|
|
| 50 |
$this->tokens = array_merge(array_slice($this->tokens, 0, $this->current), $tokens, array_slice($this->tokens, $this->current)); |
|
| 51 |
} |
|
| 52 |
|
|
| 48 | 53 |
/** |
| 49 | 54 |
* Sets the pointer to the next token and returns the old one. |
| 50 | 55 |
* |
| ... | ... | |
| 53 | 58 |
public function next() |
| 54 | 59 |
{
|
| 55 | 60 |
if (!isset($this->tokens[++$this->current])) {
|
| 56 |
throw new Twig_Error_Syntax('Unexpected end of template', -1, $this->filename);
|
|
| 61 |
throw new Twig_Error_Syntax('Unexpected end of template', $this->token[$this->current - 1]->getLine(), $this->filename);
|
|
| 57 | 62 |
} |
| 58 | 63 |
|
| 59 | 64 |
return $this->tokens[$this->current - 1]; |
| ... | ... | |
| 92 | 97 |
public function look($number = 1) |
| 93 | 98 |
{
|
| 94 | 99 |
if (!isset($this->tokens[$this->current + $number])) {
|
| 95 |
throw new Twig_Error_Syntax('Unexpected end of template', -1, $this->filename);
|
|
| 100 |
throw new Twig_Error_Syntax('Unexpected end of template', $this->token[$this->current + $number - 1]->getLine(), $this->filename);
|
|
| 96 | 101 |
} |
| 97 | 102 |
|
| 98 | 103 |
return $this->tokens[$this->current + $number]; |
Also available in: Unified diff
updated Twig template engine to stable version 1.11.1 step2