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

A %prec modifier naming the token whose precedence the alternative takes.

Reading a precedence modifierdoctest
$file = (new \BisonParser\Parser())->parse("%%\nexpr: '-' expr %prec NEG ;\n");
    $file->rules()[0]->alternatives[0]->items[2]->symbol->value // => 'NEG'

Properties§

public Symbol $symbol
public Location $location

Methods§

public function __construct(public Symbol $symbol, public Location $location)

Parameters

$symbolSymbolThe token named
$locationLocationWhere the modifier is written
public function location(): Location

Answers where the item begins.

Returns

Location Line and column of the modifier
Test cases 1

Test cases 9§

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 8

Relations§

Instantiated in 1
Constant reads 1
Type checks 1