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

Writes the items of a right-hand side the way Bison spells them.

Methods§

public function __construct(
    private SymbolPrinter $symbols = new \BisonParser\Printer\SymbolPrinter(),
    private DeclarationPrinter $declarations = new \BisonParser\Printer\DeclarationPrinter(),
)

Parameters

$symbolsSymbolPrinterWrites symbols and literals
$declarationsDeclarationPrinterWrites `#line` directives
Calls 2
public function print(RhsItem $item): string

Writes one item.

Parameters

$itemRhsItemThe item

Returns

string The item text

Throws

LogicException When the item is of a class the printer does not know
Test cases 1
Called from 1
Calls 14
public function reference(string|null $name): string

Writes a [name] reference, or nothing when there is none.

Parameters

$namestring|nullThe name

Returns

string The bracketed name or an empty string
Test cases 1
Called from 2

Private surface 2§

Implementation details, listed for orientation only.

private SymbolPrinter $symbols = new \BisonParser\Printer\SymbolPrinter()
private DeclarationPrinter $declarations = new \BisonParser\Printer\DeclarationPrinter()

Test cases 5§

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 3

Relations§

Instantiated in 1
Method calls 1
Type declarations 1