Lines Matching refs:code

25     protected $code;  variable in Twig\\Lexer
82 public function tokenize($code, $name = null) argument
84 if (!$code instanceof Source) {
86 $this->source = new Source($code, $name);
88 $this->source = $code;
102 $this->code = str_replace(["\r\n", "\r"], "\n", $this->source->getCode());
106 $this->end = \strlen($this->code);
114 … preg_match_all($this->regexes['lex_tokens_start'], $this->code, $matches, PREG_OFFSET_CAPTURE);
161 $this->pushToken(Token::TEXT_TYPE, substr($this->code, $this->cursor));
177 $text = $textContent = substr($this->code, $this->cursor, $position[1] - $this->cursor);
191 … if (preg_match($this->regexes['lex_block_raw'], $this->code, $match, null, $this->cursor)) {
195 …} elseif (preg_match($this->regexes['lex_block_line'], $this->code, $match, null, $this->cursor)) {
215 …if (empty($this->brackets) && preg_match($this->regexes['lex_block'], $this->code, $match, null, $…
226 …if (empty($this->brackets) && preg_match($this->regexes['lex_var'], $this->code, $match, null, $th…
238 if (preg_match('/\s+/A', $this->code, $match, null, $this->cursor)) {
247 if (preg_match($this->regexes['operator'], $this->code, $match, null, $this->cursor)) {
252 elseif (preg_match(self::REGEX_NAME, $this->code, $match, null, $this->cursor)) {
257 elseif (preg_match(self::REGEX_NUMBER, $this->code, $match, null, $this->cursor)) {
266 elseif (false !== strpos(self::PUNCTUATION, $this->code[$this->cursor])) {
268 if (false !== strpos('([{', $this->code[$this->cursor])) {
269 $this->brackets[] = [$this->code[$this->cursor], $this->lineno];
272 elseif (false !== strpos(')]}', $this->code[$this->cursor])) {
274 …throw new SyntaxError(sprintf('Unexpected "%s".', $this->code[$this->cursor]), $this->lineno, $thi…
278 if ($this->code[$this->cursor] != strtr($expect, '([{', ')]}')) {
283 $this->pushToken(Token::PUNCTUATION_TYPE, $this->code[$this->cursor]);
287 elseif (preg_match(self::REGEX_STRING, $this->code, $match, null, $this->cursor)) {
292 elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) {
299 …throw new SyntaxError(sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->li…
309 …if (!preg_match(str_replace('%s', $tag, $this->regexes['lex_raw_data']), $this->code, $match, PREG…
313 $text = substr($this->code, $this->cursor, $match[0][1] - $this->cursor);
325 …if (!preg_match($this->regexes['lex_comment'], $this->code, $match, PREG_OFFSET_CAPTURE, $this->cu…
329 … $this->moveCursor(substr($this->code, $this->cursor, $match[0][1] - $this->cursor).$match[0][0]);
334 … if (preg_match($this->regexes['interpolation_start'], $this->code, $match, null, $this->cursor)) {
339 …} elseif (preg_match(self::REGEX_DQ_STRING_PART, $this->code, $match, null, $this->cursor) && \str…
342 … } elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) {
344 if ('"' != $this->code[$this->cursor]) {
352 …throw new SyntaxError(sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->li…
359 …=== $bracket[0] && preg_match($this->regexes['interpolation_end'], $this->code, $match, null, $thi…