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

A %destructor or %printer directive: code attached to symbols or type tags.

Reading a destructordoctest
$file = (new \BisonParser\Parser())->parse("%destructor { free (\$\$); } <str> ID\n%%\ns: 'a';\n");
    $file->declarations[0]->printer // => false
    $file->declarations[0]->targets[0]->name // => 'str'
    $file->declarations[0]->targets[1]->value // => 'ID'

Properties§

public bool $printer
public string $code
public list<Symbol|Tag> $targets
public Location $location

Methods§

public function __construct(
    public bool $printer,
    public string $code,
    public list<Symbol|Tag> $targets,
    public Location $location,
)

Parameters

$printerboolWhether the directive is `%printer` rather than `%destructor`
$codestringThe code without its braces
$targetslist<Symbol|Tag>The symbols and tags the code applies to, 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 7§

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 6

Relations§

Instantiated in 1
Constant reads 1
Type declarations 1