classGrammarAdaptation
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 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
$ruleMap | array<string, ProductionRule> | Rules to add the statement rules to |
$cmd | ProductionRule | The `cmd` rule every statement is an alternative of |
Returns
array<string, ProductionRule> Rules a statement kind can be named inTest cases 2
Called from 1
Calls 2
- method-call GrammarAdaptation::statementAlternatives() line 43
- new ProductionRule line 46
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
$cmd | ProductionRule | The `cmd` rule every statement is an alternative of |
Returns
array<string, list<Production>> Alternatives by statement kindTest cases 5
GrammarAdaptationTest::testAdaptedGivesEachStatementKindARuleOfItsOwncoversGrammarAdaptationTest::testStatementAlternativesKeepsAlterAndDropOnlyWhenTheyActOnATablecovers and callsGrammarAdaptationTest::testStatementAlternativesSortsAnAlternativeByTheKeywordItLeadsWithcovers and callsGrammarAdaptationTest::testStatementAlternativesSortsAnAlternativeThatBeginsWithAnOptionalWithClausecovers and callsGrammarAdaptationTest::testWithStatementRulesPreservesEveryImportedAlternativecovers
Test cases 11§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 6
GrammarAdaptationTest::testAdaptedGivesEachStatementKindARuleOfItsOwncovers and callsGrammarAdaptationTest::testAdaptedLeavesAGrammarWithoutACmdRuleAlonecovers and callsGrammarAdaptationTest::testStatementAlternativesKeepsAlterAndDropOnlyWhenTheyActOnATablecovers and callsGrammarAdaptationTest::testStatementAlternativesSortsAnAlternativeByTheKeywordItLeadsWithcovers and callsGrammarAdaptationTest::testStatementAlternativesSortsAnAlternativeThatBeginsWithAnOptionalWithClausecovers and callsGrammarAdaptationTest::testWithStatementRulesPreservesEveryImportedAlternativecovers and calls
Other tests reaching this symbol 5
MySqlProviderTestcallsPostgreSqlProviderTestcallsSqlGeneratorFactoryTestcallsGenerationContextTestcallsSqliteProviderTestcalls