You are here

protected function Twig_Lexer::lexRawData in Translation template extractor 7.3

Same name and namespace in other branches
  1. 6.3 vendor/Twig/Lexer.php \Twig_Lexer::lexRawData()
  2. 7.2 vendor/Twig/Lexer.php \Twig_Lexer::lexRawData()
1 call to Twig_Lexer::lexRawData()
Twig_Lexer::lexData in vendor/Twig/Lexer.php

File

vendor/Twig/Lexer.php, line 288

Class

Twig_Lexer
Lexes a template string.

Code

protected function lexRawData($tag) {
  if ('raw' === $tag) {
    @trigger_error(sprintf('Twig Tag "raw" is deprecated. Use "verbatim" instead in %s at line %d.', $this->filename, $this->lineno), E_USER_DEPRECATED);
  }
  if (!preg_match(str_replace('%s', $tag, $this->regexes['lex_raw_data']), $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) {
    throw new Twig_Error_Syntax(sprintf('Unexpected end of file: Unclosed "%s" block.', $tag), $this->lineno, $this->filename);
  }
  $text = substr($this->code, $this->cursor, $match[0][1] - $this->cursor);
  $this
    ->moveCursor($text . $match[0][0]);
  if (false !== strpos($match[1][0], $this->options['whitespace_trim'])) {
    $text = rtrim($text);
  }
  $this
    ->pushToken(Twig_Token::TEXT_TYPE, $text);
}