Revision 1938
Added by darkviper almost 11 years ago
Lexer.php | ||
---|---|---|
13 | 13 |
/** |
14 | 14 |
* Lexes a template string. |
15 | 15 |
* |
16 |
* @package twig |
|
17 |
* @author Fabien Potencier <fabien@symfony.com> |
|
16 |
* @author Fabien Potencier <fabien@symfony.com> |
|
18 | 17 |
*/ |
19 | 18 |
class Twig_Lexer implements Twig_LexerInterface |
20 | 19 |
{ |
... | ... | |
32 | 31 |
protected $regexes; |
33 | 32 |
protected $position; |
34 | 33 |
protected $positions; |
34 |
protected $currentVarBlockLine; |
|
35 | 35 |
|
36 | 36 |
const STATE_DATA = 0; |
37 | 37 |
const STATE_BLOCK = 1; |
... | ... | |
186 | 186 |
} else { |
187 | 187 |
$this->pushToken(Twig_Token::BLOCK_START_TYPE); |
188 | 188 |
$this->pushState(self::STATE_BLOCK); |
189 |
$this->currentVarBlockLine = $this->lineno; |
|
189 | 190 |
} |
190 | 191 |
break; |
191 | 192 |
|
192 | 193 |
case $this->options['tag_variable'][0]: |
193 | 194 |
$this->pushToken(Twig_Token::VAR_START_TYPE); |
194 | 195 |
$this->pushState(self::STATE_VAR); |
196 |
$this->currentVarBlockLine = $this->lineno; |
|
195 | 197 |
break; |
196 | 198 |
} |
197 | 199 |
} |
... | ... | |
225 | 227 |
$this->moveCursor($match[0]); |
226 | 228 |
|
227 | 229 |
if ($this->cursor >= $this->end) { |
228 |
throw new Twig_Error_Syntax(sprintf('Unexpected end of file: Unclosed "%s"', $this->state === self::STATE_BLOCK ? 'block' : 'variable'), $this->lineno, $this->filename);
|
|
230 |
throw new Twig_Error_Syntax(sprintf('Unclosed "%s"', $this->state === self::STATE_BLOCK ? 'block' : 'variable'), $this->currentVarBlockLine, $this->filename);
|
|
229 | 231 |
} |
230 | 232 |
} |
231 | 233 |
|
Also available in: Unified diff
update Twig template engine to version 1.13.1