classSymbolDeclaration
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.
$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 $classpublic list<SymbolEntry> $entriespublic Location $locationMethods§
public function __construct(
public SymbolClass $class,
public list<SymbolEntry> $entries,
public Location $location,
)Parameters
$class | SymbolClass | Which directive it is |
$entries | list<SymbolEntry> | The symbols in order, at least one |
$location | Location | Where the directive is written |
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
- new BisonParser\Syntax\DeclarationParser::directive() packages/bison-parser/src/Syntax/DeclarationParser.php:130
- new BisonParser\Syntax\DeclarationParser::directive() packages/bison-parser/src/Syntax/DeclarationParser.php:131
- new BisonParser\Syntax\DeclarationParser::directive() packages/bison-parser/src/Syntax/DeclarationParser.php:132