classDestructor
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.
$file = (new \LemonParser\Parser())->parse("%destructor expr { freeExpr($$); }\n");
$destructor = $file->declarations()[0];
[$destructor->symbol->name, $destructor->value] // => ['expr', ' freeExpr($$); ']Properties§
public Symbol $symbolpublic string $valuepublic ArgumentForm $formpublic Location $locationMethods§
public function __construct(
public Symbol $symbol,
public string $value,
public ArgumentForm $form,
public Location $location,
)Parameters
$symbol | Symbol | The symbol whose values it destroys |
$value | string | The argument without its delimiters |
$form | ArgumentForm | How the argument was written |
$location | Location | Where the `%` sign is |
public function location(): LocationTest cases 6§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.