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

Exposes statement aliases for SQLite's cmd alternatives without filtering the upstream grammar.

Methods§

public function adapted(Grammar $grammar): Grammar

Answers the grammar with every adaptation applied.

Parameters

$grammarGrammarGrammar as SQLite's parser declares it

Returns

Grammar Grammar a generator can be aimed at
Test cases 2
Called from 1
Calls 2
public function withStatementRules(
    array<string, ProductionRule> $ruleMap,
    ProductionRule $cmd,
): array<string, ProductionRule>

Gives each statement kind embedded in cmd a rule of its own.

Build-time conditionals have already been resolved by LemonParser. Every selected source alternative remains reachable through its alias.

Parameters

$ruleMaparray<string, ProductionRule>Rules to add the statement rules to
$cmdProductionRuleThe `cmd` rule every statement is an alternative of

Returns

array<string, ProductionRule> Rules a statement kind can be named in
Test cases 2
Called from 1
Calls 2
public function statementAlternatives(ProductionRule $cmd): array<string, list<Production>>

Sorts the alternatives of cmd by the statement each one writes.

An alternative announces itself either with a keyword or, when it begins with an optional WITH clause, with the keyword right after it. ALTER and DROP say what they act on in their second word, and only the ones acting on a table are wanted here.

Parameters

$cmdProductionRuleThe `cmd` rule every statement is an alternative of

Returns

array<string, list<Production>> Alternatives by statement kind
Test cases 5
Called from 1

Test cases 11§

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

Dedicated tests 6
Other tests reaching this symbol 5

Relations§

Instantiated in 1
Method calls 1