classProductions
final class Productions
The productions of one grammar release, spelled as the grammar writes them.
A production is identified by its signature: the rule name, a colon, and the symbols of the alternative, terminals by terminal or token-class name, such as where_opt: WHERE expr or where_opt:. The list is generated from the grammar artifact of the release. Rules dispatch on signatures, so one rule serves every release that has the production, and the list of a release is the complete set of productions its rules must claim.
Methods§
public function __construct(private array<string, list<string>> $signatures)Parameters
$signatures | array<string, list<string>> | The signature of each alternative by rule name |
public static function load(string $path): selfLoads the generated production list of a release, once per file.
Parameters
$path | string |
Returns
selfTest cases 11
DefinitionRoutesTest::testFamilyRoutesEveryCreateAlterAndDropAlternativeOfEveryReleasecallsStatementRoutesTest::testFamilyRoutesEveryStatementAlternativeOfEveryReleasecallsAmbiguousKeywordsTest::testSignaturesListEveryKeywordAsIdentifierProductionOfTheReleasescallsLegacyKeywordsTest::testSignaturesListEveryKeywordAsIdentifierProductionOfTheReleasescallsUnambiguousKeywordsTest::testSignaturesListEveryKeywordAsIdentifierProductionOfTheReleasescallsDispatchNoiseTest::testPositionsNameOnlyTerminalPositionsOfProductionsOfTheGrammarscallsLeafNoiseTest::testPositionsNameOnlyTerminalPositionsOfProductionsOfTheGrammarscallsLeafNoiseTest::testSynonymsNameOnlyTerminalPositionsOfProductionsOfTheGrammarscallsQueryNoiseTest::testPositionsNameOnlyTerminalPositionsOfProductionsOfTheGrammarscallsTypeNoiseTest::testPositionsNameOnlyTerminalPositionsOfProductionsOfTheGrammarscallsTypeNoiseTest::testSynonymsNameOnlyTerminalPositionsOfProductionsOfTheGrammarscalls
Called from 1
Answers the typed view of the production a parse tree node matched.
Parameters
$node | Node |
Returns
Called from 7
- method-call SqlSemantics\Platform\MySql\Lowering\Lowering::statements() packages/sql-semantics-mysql/src/Lowering/Lowering.php:213
- method-call SqlSemantics\Platform\MySql\Lowering\Lowering::statements() packages/sql-semantics-mysql/src/Lowering/Lowering.php:216
- method-call SqlSemantics\Platform\MySql\Lowering\Lowering::statements() packages/sql-semantics-mysql/src/Lowering/Lowering.php:225
- method-call SqlSemantics\Platform\MySql\Lowering\Lowering::statement() packages/sql-semantics-mysql/src/Lowering/Lowering.php:242
- method-call SqlSemantics\Platform\MySql\Lowering\Lowering::statement() packages/sql-semantics-mysql/src/Lowering/Lowering.php:244
- method-call SqlSemantics\Platform\MySql\Lowering\Lowering::definition() packages/sql-semantics-mysql/src/Lowering/Lowering.php:261
- method-call SqlSemantics\Platform\MySql\Lowering\Lowering::form() packages/sql-semantics-mysql/src/Lowering/Lowering.php:301
Calls 2
- new Form line 66
- method-call Productions::signature() line 66
public function signature(Node $node): stringAnswers the signature of the production a parse tree node matched.
Parameters
$node | Node |
Returns
stringCalled from 3
- method-call SqlSemantics\Platform\MySql\Model\Lowering\Productions::form() packages/sql-semantics-mysql/src/Model/Lowering/Productions.php:66
- method-call SqlSemantics\Platform\MySql\Model\Validation\TokenCorrespondence::keys() packages/sql-semantics-mysql/src/Model/Validation/TokenCorrespondence.php:33
- method-call SqlSemantics\Platform\MySql\Model\Validation\TokenCorrespondence::keys() packages/sql-semantics-mysql/src/Model/Validation/TokenCorrespondence.php:49
Calls 1
- static-call Check::invariant() line 75
Private surface 2§
Implementation details, listed for orientation only.
private static array<string, self> $loaded = []private array<string, list<string>> $signaturesTest cases 11§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Other tests reaching this symbol 11
DefinitionRoutesTest::testFamilyRoutesEveryCreateAlterAndDropAlternativeOfEveryReleasecallsStatementRoutesTest::testFamilyRoutesEveryStatementAlternativeOfEveryReleasecallsAmbiguousKeywordsTest::testSignaturesListEveryKeywordAsIdentifierProductionOfTheReleasescallsLegacyKeywordsTest::testSignaturesListEveryKeywordAsIdentifierProductionOfTheReleasescallsUnambiguousKeywordsTest::testSignaturesListEveryKeywordAsIdentifierProductionOfTheReleasescallsDispatchNoiseTest::testPositionsNameOnlyTerminalPositionsOfProductionsOfTheGrammarscallsLeafNoiseTest::testPositionsNameOnlyTerminalPositionsOfProductionsOfTheGrammarscallsLeafNoiseTest::testSynonymsNameOnlyTerminalPositionsOfProductionsOfTheGrammarscallsQueryNoiseTest::testPositionsNameOnlyTerminalPositionsOfProductionsOfTheGrammarscallsTypeNoiseTest::testPositionsNameOnlyTerminalPositionsOfProductionsOfTheGrammarscallsTypeNoiseTest::testSynonymsNameOnlyTerminalPositionsOfProductionsOfTheGrammarscalls
Relations§
Static calls 1
Method calls 9
- method-call SqlSemantics\Platform\MySql\Lowering\Lowering::statements() packages/sql-semantics-mysql/src/Lowering/Lowering.php:213
- method-call SqlSemantics\Platform\MySql\Lowering\Lowering::statements() packages/sql-semantics-mysql/src/Lowering/Lowering.php:216
- method-call SqlSemantics\Platform\MySql\Lowering\Lowering::statements() packages/sql-semantics-mysql/src/Lowering/Lowering.php:225
- method-call SqlSemantics\Platform\MySql\Lowering\Lowering::statement() packages/sql-semantics-mysql/src/Lowering/Lowering.php:242
- method-call SqlSemantics\Platform\MySql\Lowering\Lowering::statement() packages/sql-semantics-mysql/src/Lowering/Lowering.php:244
- method-call SqlSemantics\Platform\MySql\Lowering\Lowering::definition() packages/sql-semantics-mysql/src/Lowering/Lowering.php:261
- method-call SqlSemantics\Platform\MySql\Lowering\Lowering::form() packages/sql-semantics-mysql/src/Lowering/Lowering.php:301
- method-call SqlSemantics\Platform\MySql\Model\Validation\TokenCorrespondence::keys() packages/sql-semantics-mysql/src/Model/Validation/TokenCorrespondence.php:33
- method-call SqlSemantics\Platform\MySql\Model\Validation\TokenCorrespondence::keys() packages/sql-semantics-mysql/src/Model/Validation/TokenCorrespondence.php:49
Type declarations 4
- type SqlSemantics\Platform\MySql\Lowering\Lowering packages/sql-semantics-mysql/src/Lowering/Lowering.php:178
- type SqlSemantics\Platform\MySql\Model\Validation\Spellings packages/sql-semantics-mysql/src/Model/Validation/Spellings.php:37
- type SqlSemantics\Platform\MySql\Model\Validation\TokenCorrespondence packages/sql-semantics-mysql/src/Model/Validation/TokenCorrespondence.php:30
- type SqlSemantics\Platform\MySql\Platform packages/sql-semantics-mysql/src/Platform.php:114