classPrecedenceDeclaration
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".
$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 $associativitypublic list<SymbolEntry> $entriespublic Location $locationMethods§
public function __construct(
public Associativity $associativity,
public list<SymbolEntry> $entries,
public Location $location,
)Parameters
$associativity | Associativity | Which directive it is |
$entries | list<SymbolEntry> | The tokens in order, at least one |
$location | Location | Where the directive is written |
Test cases 8§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.