interface LexicalGrammar
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.

Generates lexical values and realizes grammar terminals using fixed dialect definitions. Output validity is checked against the target database; tokenizer identity is not a success condition.

Methods§

public function generate(GenerationPlan<bool> $plan): non-empty-string

Writes the one lexeme a lexical generation plan asks for.

Parameters

$planGenerationPlan<bool>Plan naming the lexeme kind and its bounds

Returns

non-empty-string The lexeme
Test cases 1
Called from 1
public function version(): string

Names the server version this grammar generates for.

Returns

string Exact release identifier supplied by the dialect implementation
Test cases 1
Called from 2
public function isNonOutput(string $terminal): bool
public function realize(list<string> $terminals, GenerationPlan<bool>|null $plan = null): string

Resolves lexical candidates and their boundary constraints into SQL.

Parameters

$terminalslist<string>Terminals to write, in order
$planGenerationPlan<bool>|nullPlan that may pin exact lexemes for some terminals

Returns

string SQL assembled from resolved lexical candidates

Throws

LexicalException When no compatible lexical candidate is available
Test cases 1
public function realizeSequence(
    TerminalSequence $sequence,
    GenerationPlan<bool>|null $plan = null,
): string

Realizes terminal occurrences using their grammar context, without requiring tokenizer identity.

Parameters

$sequenceTerminalSequence
$planGenerationPlan<bool>|null

Returns

string

Throws

LexicalException When no applicable realization exists
public function resolveSequence(
    TerminalSequence $sequence,
    GenerationPlan<bool>|null $plan,
    Closure(int): int $choose,
    Closure(positive-int): ?int|null $valueChoice = null,
): ResolvedOutput

Resolves and exposes complete choices through the same lexical pipeline used to generate SQL.

Parameters

$sequenceTerminalSequence
$planGenerationPlan<bool>|null
$chooseClosure(int): int
$valueChoiceClosure(positive-int): ?int|nullConstructive values selected only while compiling a plan

Throws

LexicalException When no applicable realization exists
Called from 2

Test cases 34§

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

Dedicated tests 3
Other tests reaching this symbol 31

Relations§

Implemented by 3
Method calls 8
Type declarations 5