classRhsPrinter
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
$symbols | SymbolPrinter | Writes symbols and literals |
$declarations | DeclarationPrinter | Writes `#line` directives |
Calls 2
public function print(RhsItem $item): stringWrites one item.
Parameters
$item | RhsItem | The item |
Returns
string The item textThrows
LogicException When the item is of a class the printer does not knowTest cases 1
Called from 1
Calls 14
- class-const SymbolItem::class() line 48
- method-call SymbolPrinter::symbol() line 48
- method-call RhsPrinter::reference() line 48
- class-const Action::class() line 49
- method-call SymbolPrinter::code() line 49
- class-const Predicate::class() line 50
- class-const EmptyItem::class() line 51
- class-const PrecItem::class() line 52
- class-const DprecItem::class() line 53
- class-const MergeItem::class() line 54
- class-const ExpectItem::class() line 55
- class-const Line::class() line 56
- method-call DeclarationPrinter::line() line 56
- new
LogicExceptionline 57
public function reference(string|null $name): stringWrites a [name] reference, or nothing when there is none.
Parameters
$name | string|null | The name |
Returns
string The bracketed name or an empty stringTest cases 1
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
BisonGrammarCompilerTestcallsBisonGrammarReaderTestcallsPrinterTestcalls