GraphQL\Language\Lexer::positionAfterWhitespace PHP Méthode

positionAfterWhitespace() private méthode

Reads from body starting at startPosition until it finds a non-whitespace or commented character, then returns the position of that character for lexing.
private positionAfterWhitespace ( $startPosition ) : integer
$startPosition
Résultat integer
    private function positionAfterWhitespace($startPosition)
    {
        $body = $this->source->body;
        $bodyLength = $this->source->length;
        $position = $startPosition;
        while ($position < $bodyLength) {
            $code = Utils::charCodeAt($body, $position);
            // Skip whitespace
            // tab | space | comma | BOM
            if ($code === 9 || $code === 32 || $code === 44 || $code === 0xfeff) {
                $position++;
            } else {
                if ($code === 10) {
                    // new line
                    $position++;
                    $this->line++;
                    $this->lineStart = $position;
                } else {
                    if ($code === 13) {
                        // carriage return
                        if (Utils::charCodeAt($body, $position + 1) === 10) {
                            $position += 2;
                        } else {
                            $position++;
                        }
                        $this->line++;
                        $this->lineStart = $position;
                    } else {
                        break;
                    }
                }
            }
        }
        return $position;
    }