final class QuotedScanner
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.

Reads MySQL's quoted tokens: strings, quoted identifiers and prefixed literals.

A single-quoted run is a string, and so is a double-quoted one unless ANSI_QUOTES makes it an identifier. Backticks always quote identifiers. A quote right after N, X or B opens a national string, a hexadecimal literal or a bit literal.

Methods§

public function scan(Scan $scan): Lexeme|null

Reads the quoted token at the cursor, if one starts there.

Parameters

$scanScanThe tokenization in progress

Returns

Lexeme|null The lexeme, or null when no quoted token starts here

Throws

LexicalException When the token never closes or a hexadecimal literal has an odd length
Test cases 3
Called from 1
Calls 6
public function string(Scan $scan, string $name, string $quote, int|null $start = null): Lexeme

Reads a string literal delimited by a quote.

Parameters

$scanScanThe tokenization in progress, positioned on the quote
$namestringTerminal the string stands for
$quotestringThe quote character
$startint|nullOffset the lexeme began at, when a prefix came first

Returns

Lexeme The lexeme

Throws

LexicalException When the string never closes
Test cases 2
Called from 2
Calls 2
public function quotedIdentifier(Scan $scan, string $quote): Lexeme

Reads an identifier delimited by backticks or, under ANSI_QUOTES, double quotes.

Parameters

$scanScanThe tokenization in progress, positioned on the quote
$quotestringThe quote character

Returns

Lexeme The lexeme

Throws

LexicalException When the identifier never closes
Test cases 2
Called from 1
Calls 2

Test cases 9§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 7
Other tests reaching this symbol 2

Relations§

Instantiated in 1
Method calls 1
Type declarations 1