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

A %token, %nterm or %type directive and the symbols it lists.

Each entry carries the tag in force where it was written, so %token <a> X <b> Y yields two entries with different tags.

Reading typed symbolsdoctest
$file = (new \BisonParser\Parser())->parse("%type <node> expr stmt\n%%\nexpr: 'a';\n");
    $file->declarations[0]->class->value // => 'type'
    array_map(static fn ($entry) => $entry->symbol->value, $file->declarations[0]->entries) // => ['expr', 'stmt']

Properties§

public SymbolClass $class
public list<SymbolEntry> $entries
public Location $location

Methods§

public function __construct(
    public SymbolClass $class,
    public list<SymbolEntry> $entries,
    public Location $location,
)

Parameters

$classSymbolClassWhich directive it is
$entrieslist<SymbolEntry>The symbols 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 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 3
Constant reads 1
Type checks 2