Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Lexer.php

function Lexer::next

Return value

0|1|3|4|6|8|10|11|14|17|18|21|22|23|24|30|31|32|-1

2 calls to Lexer::next()
Lexer::lex in vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php
Lexer::skipUntil in vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php

File

vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php, line 221

Class

Lexer
Lexer class

Namespace

Seld\JsonLint

Code

private function next() {
    if ($this->done) {
        return self::EOF;
    }
    if ($this->offset === \strlen($this->input)) {
        $this->done = true;
    }
    $token = null;
    $match = null;
    $col = null;
    $lines = null;
    if (!$this->more) {
        $this->yytext = '';
        $this->match = '';
    }
    $rulesLen = count($this->rules);
    for ($i = 0; $i < $rulesLen; $i++) {
        if (preg_match($this->rules[$i], $this->input, $match, 0, $this->offset)) {
            $lines = explode("\n", $match[0]);
            array_shift($lines);
            $lineCount = \count($lines);
            $this->yylineno += $lineCount;
            $this->yylloc = array(
                'first_line' => $this->yylloc['last_line'],
                'last_line' => $this->yylineno + 1,
                'first_column' => $this->yylloc['last_column'],
                'last_column' => $lineCount > 0 ? \strlen($lines[$lineCount - 1]) : $this->yylloc['last_column'] + \strlen($match[0]),
            );
            $this->yytext .= $match[0];
            $this->match .= $match[0];
            $this->yyleng = \strlen($this->yytext);
            $this->more = false;
            $this->offset += \strlen($match[0]);
            return $this->performAction($i);
        }
    }
    if ($this->offset === \strlen($this->input)) {
        return self::EOF;
    }
    $this->parseError('Lexical error on line ' . ($this->yylineno + 1) . ". Unrecognized text.\n" . $this->showPosition());
}
RSS feed
Powered by Drupal