final class BisonDirectiveReaderChain
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.

Routes a directive to the reader that knows its arguments.

The order matters here in a way it does not for the lexer's scanners: the reader for unknown directives accepts everything, so it has to be consulted last. Keeping that in one place is what lets every other reader answer only for itself.

Methods§

public static function forBisonGrammar(): self

Builds the chain covering the directives this parser models.

Returns

self A chain ending in the reader that accepts anything left over
Test cases 12
Called from 1
Calls 10
public function read(BisonTokenStream $stream, string $directive): BisonDeclaration|null

Consumes one declaration's arguments with the reader that claims it.

Parameters

$streamBisonTokenStreamStream positioned just after the directive name
$directivestringDirective name including its percent sign

Returns

BisonDeclaration|null The declaration, or null when no reader claimed it or the arguments were not the expected shape
Test cases 12
Called from 1

Private surface 1§

Implementation details, listed for orientation only.

private list<BisonDirectiveReader> $readers

Test cases 15§

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

Dedicated tests 13
Other tests reaching this symbol 2

Relations§

Static calls 1
Method calls 1
Type declarations 2