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

Normalizes terminals according to supplied identifier and keyword declarations.

Methods§

public function __construct(
    private list<string> $identifiers,
    private list<string> $verbatim,
    private array<string, string> $aliases,
    private ?string $fallbackRule = null,
    private list<string> $fallbackLiterals = [],
    private ?string $excludedParent = null,
)

Parameters

$identifierslist<string>Rules that own identifiers
$verbatimlist<string>Terminal kinds whose spelling must be preserved
$aliasesarray<string, string>Canonical spellings by terminal kind
$fallbackRule?string
$fallbackLiteralslist<string>Literal kinds excluded from identifier fallback
$excludedParent?string
public function identifier(string $rule, ?Node $parent = null): bool

Determines whether a rule owns an identifier in this context.

Parameters

$rulestring
$parent?Node

Returns

bool
Calls 1
public function fallback(Token $token, ?Node $parent): bool

Determines whether a terminal was accepted in an identifier fallback position.

Parameters

$tokenToken
$parent?Node

Returns

bool
Calls 2
public function text(Token $token, bool $identifier): string

Canonicalizes known aliases while preserving names, literals, and directives.

Parameters

$tokenToken
$identifierbool

Returns

string
Calls 3

Private surface 6§

Implementation details, listed for orientation only.

private list<string> $identifiers
private list<string> $verbatim
private array<string, string> $aliases
private ?string $fallbackRule = null
private list<string> $fallbackLiterals = []
private ?string $excludedParent = null

Test cases 17§

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

Dedicated tests 1
Other tests reaching this symbol 16

Relations§

Instantiated in 3
Type declarations 1