Changeset 1101:7273894e61b8 for inc/libs/twig/Lexer.php
- Timestamp:
- 02/15/13 08:35:19 (13 years ago)
- Branch:
- twig
- Children:
- 1106:a4487f3ca4b4, 1147:2e5cb79e4782
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/libs/twig/Lexer.php
r991 r1101 62 62 'lex_var' => '/\s*'.preg_quote($this->options['whitespace_trim'].$this->options['tag_variable'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_variable'][1], '/').'/A', 63 63 'lex_block' => '/\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')\n?/A', 64 'lex_raw_data' => '/('.preg_quote($this->options['tag_block'][0].$this->options['whitespace_trim'], '/').'|'.preg_quote($this->options['tag_block'][0], '/').')\s* endraw\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')/s',64 'lex_raw_data' => '/('.preg_quote($this->options['tag_block'][0].$this->options['whitespace_trim'], '/').'|'.preg_quote($this->options['tag_block'][0], '/').')\s*(?:end%s)\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')/s', 65 65 'operator' => $this->getOperatorRegex(), 66 66 'lex_comment' => '/(?:'.preg_quote($this->options['whitespace_trim'], '/').preg_quote($this->options['tag_comment'][1], '/').'\s*|'.preg_quote($this->options['tag_comment'][1], '/').')\n?/s', 67 'lex_block_raw' => '/\s* raw\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')/As',67 'lex_block_raw' => '/\s*(raw|verbatim)\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')/As', 68 68 'lex_block_line' => '/\s*line\s+(\d+)\s*'.preg_quote($this->options['tag_block'][1], '/').'/As', 69 69 'lex_tokens_start' => '/('.preg_quote($this->options['tag_variable'][0], '/').'|'.preg_quote($this->options['tag_block'][0], '/').'|'.preg_quote($this->options['tag_comment'][0], '/').')('.preg_quote($this->options['whitespace_trim'], '/').')?/s', … … 179 179 if (preg_match($this->regexes['lex_block_raw'], $this->code, $match, null, $this->cursor)) { 180 180 $this->moveCursor($match[0]); 181 $this->lexRawData( );181 $this->lexRawData($match[1]); 182 182 // {% line \d+ %} 183 183 } elseif (preg_match($this->regexes['lex_block_line'], $this->code, $match, null, $this->cursor)) { … … 287 287 } 288 288 289 protected function lexRawData( )290 { 291 if (!preg_match( $this->regexes['lex_raw_data'], $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) {292 throw new Twig_Error_Syntax(sprintf('Unexpected end of file: Unclosed " block"'), $this->lineno, $this->filename);289 protected function lexRawData($tag) 290 { 291 if (!preg_match(str_replace('%s', $tag, $this->regexes['lex_raw_data']), $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) { 292 throw new Twig_Error_Syntax(sprintf('Unexpected end of file: Unclosed "%s" block', $tag), $this->lineno, $this->filename); 293 293 } 294 294
Note: See TracChangeset
for help on using the changeset viewer.