final class TokenGenerator

Derives grammar terminals without choosing spellings or pruning unsupported lexemes.

Methods§

public function __construct(
    private Grammar $grammar,
    private Generator $faker,
    Closure(string): bool $nonOutput,
)

Fixes grammar and production choices; marker metadata affects emptiness, never handler availability.

Parameters

$grammarGrammar
$fakerGenerator
$nonOutputClosure(string): bool
Test cases 2
Calls 2
public function generate(
    string $root,
    GenerationPlan<bool> $plan,
    Closure(int): ?int|null $choose = null,
): TerminalSequence

Produces the selected terminal occurrences and their grammar provenance.

Parameters

$rootstring
$planGenerationPlan<bool>
$chooseClosure(int): ?int|null

Throws

GenerationException When the grammar cannot complete the plan
LogicException When derivation failed to retain its trace
Test cases 2
Called from 1
Calls 3

Private surface 4§

Implementation details, listed for orientation only.

private TerminationAnalyzer $termination
private CompletionCosts $completion
private Grammar $grammar
private Generator $faker

Test cases 16§

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

Dedicated tests 2
Other tests reaching this symbol 14

Relations§

Instantiated in 2
Method calls 1
Type declarations 2