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 3
Called from 1
Answers the typed view of the production a parse tree node matched.
Parameters
$node | Node |
Returns
Test cases 1
Called from 5
- method-call SqlSemantics\Platform\Sqlite\Lowering\Lowering::statements() packages/sql-semantics-sqlite/src/Lowering/Lowering.php:162
- method-call SqlSemantics\Platform\Sqlite\Lowering\Lowering::statements() packages/sql-semantics-sqlite/src/Lowering/Lowering.php:166
- method-call SqlSemantics\Platform\Sqlite\Lowering\Lowering::terminated() packages/sql-semantics-sqlite/src/Lowering/Lowering.php:188
- method-call SqlSemantics\Platform\Sqlite\Lowering\Lowering::unwrapped() packages/sql-semantics-sqlite/src/Lowering/Lowering.php:206
- method-call SqlSemantics\Platform\Sqlite\Lowering\Lowering::command() packages/sql-semantics-sqlite/src/Lowering/Lowering.php:219
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
stringTest cases 1
Called from 3
- method-call SqlSemantics\Platform\Sqlite\Model\Lowering\Productions::form() packages/sql-semantics-sqlite/src/Model/Lowering/Productions.php:66
- method-call SqlSemantics\Platform\Sqlite\Model\Validation\TokenCorrespondence::keys() packages/sql-semantics-sqlite/src/Model/Validation/TokenCorrespondence.php:33
- method-call SqlSemantics\Platform\Sqlite\Model\Validation\TokenCorrespondence::keys() packages/sql-semantics-sqlite/src/Model/Validation/TokenCorrespondence.php:49
Calls 1
- static-call Check::invariant() line 75
public function all(): list<string>Answers every signature of the release.
Returns
list<string>Test cases 1
Private surface 2§
Implementation details, listed for orientation only.
private static array<string, self> $loaded = []private array<string, list<string>> $signaturesTest cases 6§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
Other tests reaching this symbol 1
Relations§
Static calls 1
Method calls 7
- method-call SqlSemantics\Platform\Sqlite\Lowering\Lowering::statements() packages/sql-semantics-sqlite/src/Lowering/Lowering.php:162
- method-call SqlSemantics\Platform\Sqlite\Lowering\Lowering::statements() packages/sql-semantics-sqlite/src/Lowering/Lowering.php:166
- method-call SqlSemantics\Platform\Sqlite\Lowering\Lowering::terminated() packages/sql-semantics-sqlite/src/Lowering/Lowering.php:188
- method-call SqlSemantics\Platform\Sqlite\Lowering\Lowering::unwrapped() packages/sql-semantics-sqlite/src/Lowering/Lowering.php:206
- method-call SqlSemantics\Platform\Sqlite\Lowering\Lowering::command() packages/sql-semantics-sqlite/src/Lowering/Lowering.php:219
- method-call SqlSemantics\Platform\Sqlite\Model\Validation\TokenCorrespondence::keys() packages/sql-semantics-sqlite/src/Model/Validation/TokenCorrespondence.php:33
- method-call SqlSemantics\Platform\Sqlite\Model\Validation\TokenCorrespondence::keys() packages/sql-semantics-sqlite/src/Model/Validation/TokenCorrespondence.php:49
Type declarations 4
- type SqlSemantics\Platform\Sqlite\Lowering\Lowering packages/sql-semantics-sqlite/src/Lowering/Lowering.php:132
- type SqlSemantics\Platform\Sqlite\Model\Validation\Spellings packages/sql-semantics-sqlite/src/Model/Validation/Spellings.php:37
- type SqlSemantics\Platform\Sqlite\Model\Validation\TokenCorrespondence packages/sql-semantics-sqlite/src/Model/Validation/TokenCorrespondence.php:30
- type SqlSemantics\Platform\Sqlite\Platform packages/sql-semantics-sqlite/src/Platform.php:83