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

Lowers the identifier productions of every release into decoded names.

Rule: MYSQL-NAME-001. Scope: ident, IDENT_sys, label_ident, role_ident, lvalue_ident, ident_or_text, role_ident_or_text, schema, the keyword-as-identifier rules, opt_ident, ident_or_empty, opt_component, storage_engines, known_storage_engines, table_ident, table_name, table_ident_nodb, table_ident_opt_wild, sp_name, table_list, opt_table_list, ident_string_list, simple_ident, simple_ident_nospvar, simple_ident_q, field_ident, table_wild. An identifier token is decoded by MYSQL-IDENTIFIER-DECODE-001; a keyword at a keyword-as-identifier production is the name it spells, letter case kept; a string or a host name at a name position is the name it holds. The leading dot of .table and .table.column names the default database and is not kept. Every name is recorded as an operand leaf. Constructs: Name, QualifiedName, ColumnUse, ColumnName, TableWildcard. Terminates: unit productions are followed in a loop over strict subtrees and lists are flattened iteratively. Source: https://dev.mysql.com/doc/refman/8.4/en/identifiers.html, https://dev.mysql.com/doc/refman/8.4/en/identifier-qualifiers.html, https://dev.mysql.com/doc/refman/8.4/en/keywords.html. Status: Implemented.

Methods§

public function __construct(private Lowering $lowering)

Parameters

$loweringLoweringThe lowering this rule belongs to
public function identifier(Node $name): Name

Lowers a position that holds exactly one unqualified name.

Parameters

$nameNode

Returns

Throws

ImplementationGap When the production has no rule
Called from 10
Calls 7
public function keyword(string $signature): bool

Tells whether a production reads a keyword as the identifier it spells.

Parameters

$signaturestring

Returns

bool
Test cases 1
Called from 1
Calls 4
public function optional(Node $name): ?Name

Lowers a position that holds a name or nothing.

Parameters

$nameNode

Returns

Throws

ImplementationGap When the production has no rule
Calls 2
public function qualified(Node $name): QualifiedName

Lowers the name of a table, view or routine with its optional database qualifier.

Parameters

$nameNode

Throws

ImplementationGap When the production has no rule
Called from 1
Calls 5
public function dotted(Node $name): bool

Tells whether a table name is written after a leading dot, .t (MySQL 5.6 and 5.7).

Parameters

$nameNode

Returns

bool
Calls 1
public function qualifiedList(Node $list): list<QualifiedName>

Lowers a comma-separated list of table names; an absent list is empty.

Parameters

$listNode

Returns

Throws

ImplementationGap When a production has no rule
Test cases 1
Calls 4
public function identifiers(Node $list): list<Name>

Lowers a comma-separated list of unqualified names.

Parameters

$listNode

Returns

list<Name>

Throws

ImplementationGap When a production has no rule
Test cases 1
Calls 4
public function column(Node $column): ColumnUse

Lowers a name used as a value into a column use.

Parameters

$columnNode

Returns

Throws

ImplementationGap When the production has no rule
Calls 9
public function columnName(Node $field): ColumnName

Lowers the name of a column at a position that defines or alters it.

Parameters

$fieldNode

Returns

Throws

ImplementationGap When the production has no rule
Test cases 1
Called from 1
Calls 6
public function optionalColumnName(Node $name): ?ColumnName

Lowers the optional name of an index or constraint, which MySQL 5.x lets a table name qualify.

Parameters

$nameNode

Returns

Throws

ImplementationGap When the production has no rule
Test cases 1
Calls 4
public function wildcard(Node $wildcard): TableWildcard

Lowers a qualified star.

Parameters

$wildcardNode

Throws

ImplementationGap When the production has no rule
Test cases 1
Calls 4
public function claimed(Form $form, list<string> $signatures): void

Confirms that a list production is one this rule flattens.

Parameters

$formForm
$signatureslist<string>The list productions of the rule

Throws

ImplementationGap When the production has no rule
Test cases 1
Called from 2
Calls 2

Private surface 7§

Implementation details, listed for orientation only.

private const FORWARD = ['ident: IDENT_sys' => true, 'ident: keyword' => true, 'ident: ident_keyword' =…
private const TOKENS = ['IDENT_sys: IDENT' => 'identifier', 'IDENT_sys: IDENT_QUOTED' => 'identifier',…
private const QUALIFIED = ['table_ident: ident' => [0, null], 'table_ident: ident . ident' => [2, 0], 'ta…
private const COLUMNS = ['simple_ident: ident' => [0, null, null], 'simple_ident_nospvar: ident' => [0,…
private const ABSENT = ['opt_ident:' => true, 'ident_or_empty:' => true, 'opt_component:' => true]
private static array<string, true>|null $keywords = null
private Lowering $lowering

Test cases 8§

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

Dedicated tests 8

Relations§

Instantiated in 1
Type declarations 1