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

Reads the alternatives on the right-hand side of one rule.

Bison lets the final semicolon be left out, so an alternative list also ends where the next rule begins — an identifier followed by a colon — or at the end of the section. All three endings complete the alternative in hand, which is why the reader looks two tokens ahead before it consumes anything.

Methods§

public function endsTheRule(BisonTokenStream $stream): bool
public function readPart(BisonTokenStream $stream, BisonAlternativeDraft $draft): void

Reads one symbol, action or inline directive into the alternative.

Parameters

$streamBisonTokenStreamStream positioned on the part to read
$draftBisonAlternativeDraftAlternative being assembled
Test cases 9
Called from 1
Calls 22
public function readPrecedenceSymbol(BisonTokenStream $stream): string|null
public function readDynamicPrecedence(BisonTokenStream $stream): int|null

Reads the rank %dprec assigns to this alternative.

Parameters

$streamBisonTokenStreamStream positioned just after `%dprec`

Returns

int|null The rank, or null when the directive named none
Test cases 2
Called from 1
Calls 2
public function readMergeFunction(BisonTokenStream $stream): string|null

Reads the merge function %merge names for this alternative.

Parameters

$streamBisonTokenStreamStream positioned just after `%merge`

Returns

string|null The function name, or null when the directive named none
Test cases 2
Called from 1
Calls 2

Test cases 23§

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

Dedicated tests 21
Other tests reaching this symbol 2

Relations§

Instantiated in 1
Method calls 1
Type declarations 2