final class PrecedenceDeclaration
    implements Declaration
Public API: explicitly declared with @visibility public.

A %left, %right, %nonassoc or %precedence directive and the tokens it ranks.

Every directive ranks its tokens above those of the directives before it. A string here is a token of its own, not an alias of the identifier before it, which is how Bison reads %left FOO "foo".

Reading operator precedencedoctest
$file = (new \BisonParser\Parser())->parse("%left '+' '-'\n%left '*'\n%%\ns: 'a';\n");
    $file->declarations[1]->associativity->value // => 'left'
    $file->declarations[1]->entries[0]->symbol->value // => '*'

Properties§

public Associativity $associativity
public list<SymbolEntry> $entries
public Location $location

Methods§

public function __construct(
    public Associativity $associativity,
    public list<SymbolEntry> $entries,
    public Location $location,
)

Parameters

$associativityAssociativityWhich directive it is
$entrieslist<SymbolEntry>The tokens in order, at least one
$locationLocationWhere the directive is written
public function location(): Location

Answers where the declaration begins.

Returns

Location Line and column of the percent sign
Test cases 1

Test cases 8§

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 7

Relations§

Instantiated in 1
Constant reads 1
Type checks 1