final class SymbolItem
    implements RhsItem
Public API: explicitly declared with @visibility public.

A symbol on a right-hand side, with the [name] reference that may follow it.

Reading a named symboldoctest
$file = (new \BisonParser\Parser())->parse("%%\ns: expr[left] '+' expr[right] ;\n");
    $item = $file->rules()[0]->alternatives[0]->items[0];
    $item->symbol->value // => 'expr'
    $item->namedReference // => 'left'

Properties§

public Symbol $symbol
public string|null $namedReference

Methods§

public function __construct(public Symbol $symbol, public string|null $namedReference)

Parameters

$symbolSymbolThe symbol
$namedReferencestring|nullThe `[name]` after it, or null when none is given
public function location(): Location

Answers where the item begins.

Returns

Location Line and column of the symbol
Test cases 1

Test cases 12§

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

Dedicated tests 1
Other tests reaching this symbol 11

Relations§

Instantiated in 1
Constant reads 1
Type checks 4