Automattic\WooCommerce\Vendor\GraphQL\Language

Lexer::readNameprivateWC 1.0

Reads an alphanumeric + underscore name from the source.

[_A-Za-z][_0-9A-Za-z]*

Method of the class: Lexer{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->readName( $line, $col, $prev ): Token;
$line(int) (required)
.
$col(int) (required)
.
$prev(Token) (required)
.

Lexer::readName() code WC 10.9.1

private function readName(int $line, int $col, Token $prev): Token
{
    $start = $this->position;
    $body = $this->source->body;
    $length = strspn($body, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_', $this->byteStreamPosition);
    $value = substr($body, $this->byteStreamPosition, $length);
    $this->moveStringCursor($length, $length);

    return new Token(
        Token::NAME,
        $start,
        $this->position,
        $line,
        $col,
        $prev,
        $value
    );
}