final class LeafKeys
    implements LeafKeys
Restricted visibility: declared "@visibility SqlSemantics\Platform\MySql". Code outside that scope must not name this declaration.

Keys MySQL tokens for the token correspondence check.

Rule: MYSQL-LEAF-KEYS-001. A keyword or punctuation token is keyed by its terminal: the server grammar sees only the terminal, so the words the lexer maps to one terminal (INT/INTEGER, DATABASE/SCHEMA, COLUMNS/FIELDS, <>/!=, DESCRIBE/EXPLAIN) are one request. An identifier token, a keyword at a keyword-as-identifier production, a string at a production that reads it as a name, and a host name are keyed by the decoded name. A string literal is keyed by its decoded bytes under the escape setting of the profile, a number by its exact text, a hexadecimal or bit literal by its digits whatever its spelling, an introducer by its character set, a parameter marker by its text. A position a family noise table lists has no key; a position a family synonym table lists has the key that table states, so two distinct terminals the manual defines as synonyms compare equal. The end marker has no text and no key. Status: Implemented.

Methods§

public function __construct(private LexicalSettings $lexical)

Parameters

$lexicalLexicalSettingsThe lexical settings strings are decoded under
public function key(Token $token, string $signature, int $position): ?string
public function name(Token $token): string

Decodes the name a token denotes at a name production.

Parameters

$tokenToken

Returns

string
Test cases 1
Called from 1
Calls 4
public function terminal(Token $token): string

Keys a token by what its terminal denotes outside the name productions.

Parameters

$tokenToken

Returns

string
Test cases 1
Called from 1
Calls 9
public static function synonyms(): array<string, array<int, string>>

Private surface 4§

Implementation details, listed for orientation only.

private const NAME_RULES = ['IDENT_sys' => true, 'keyword' => true, 'keyword_sp' => true, 'ident_keywords_…
private static array<string, list<int>>|null $noise = null
private static array<string, array<int, string>>|null $synonyms = null
private LexicalSettings $lexical

Test cases 10§

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

Dedicated tests 10

Relations§

Instantiated in 1
Type declarations 1