classScopedGeneration
final class ScopedGeneration
Resolves lexical conditions after structural rewriting, retaining ancestor identity for inserted terminals.
Properties§
public TerminalSequence $sequenceMethods§
public function __construct(
public TerminalSequence $sequence,
private array<int, array<string, LexemeConstraint>> $bindings = [],
)Parameters
$sequence | TerminalSequence | |
$bindings | array<int, array<string, LexemeConstraint>> |
public function lexicalPlan<T of bool>(
TerminalSequence $sequence,
GenerationPlan<T> $plan,
Closure(positive-int): int $choose,
): GenerationPlan<T>Parameters
$sequence | TerminalSequence | |
$plan | GenerationPlan<T> | |
$choose | Closure(positive-int): int |
Returns
Throws
LexicalException When an explicit lexeme violates a scoped conditionTest cases 4
ScopedGenerationTest::testLexicalPlanExplicitLexemesCannotSilentlyOverrideScopedConditionscallsScopedGenerationTest::testLexicalPlanMatchesRenamedOccurrencesByIdentityAndHonorsFinalTokenOverridescallsScopedGenerationTest::testLexicalPlanPreservesLegacySpellingsWhenARewriterRenamesTokenscallsScopedGenerationTest::testLexicalPlanRewrittenAndSiblingTokensKeepTheirOwnDomainscalls
Calls 4
- method-call GenerationPlan::lexemeAt() line 41
- method-call ScopedGeneration::constraint() line 48
- new LexicalException line 51
- method-call GenerationPlan::withLexemes() line 59
public function constraint(TerminalOccurrence $terminal): ?LexemeConstraintFinds the nearest applicable lexical scope, including for rewritten terminals.
Parameters
$terminal | TerminalOccurrence |
Returns
Test cases 1
Called from 1
Calls 1
- function-call
array_reverseline 67
Private surface 1§
Implementation details, listed for orientation only.
private array<int, array<string, LexemeConstraint>> $bindings = []Test cases 10§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
ScopedGenerationTest::testConstraintResolvesNearestAncestorWithoutAffectingOtherTokenscallsScopedGenerationTest::testLexicalPlanExplicitLexemesCannotSilentlyOverrideScopedConditionscallsScopedGenerationTest::testLexicalPlanMatchesRenamedOccurrencesByIdentityAndHonorsFinalTokenOverridescallsScopedGenerationTest::testLexicalPlanPreservesLegacySpellingsWhenARewriterRenamesTokenscallsScopedGenerationTest::testLexicalPlanRewrittenAndSiblingTokensKeepTheirOwnDomainscalls
Other tests reaching this symbol 5
PlanBuilderTestcallsTokenGeneratorTestcallsPreparedGrammarTestcallsMySqlProviderTestcallsPostgreSqlProviderTestcalls