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

%destructor symbol { code }: code run when a value of the symbol is discarded.

Reading a destructordoctest
$file = (new \LemonParser\Parser())->parse("%destructor expr { freeExpr($$); }\n");
    $destructor = $file->declarations()[0];
    [$destructor->symbol->name, $destructor->value] // => ['expr', ' freeExpr($$); ']

Properties§

public Symbol $symbol
public string $value
public Location $location

Methods§

public function __construct(
    public Symbol $symbol,
    public string $value,
    public ArgumentForm $form,
    public Location $location,
)

Parameters

$symbolSymbolThe symbol whose values it destroys
$valuestringThe argument without its delimiters
$formArgumentFormHow the argument was written
$locationLocationWhere the `%` sign is
public function location(): Location

{@inheritDoc}

Returns

Test cases 1

Test cases 6§

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 5

Relations§

Instantiated in 1
Constant reads 1
Type declarations 1