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

A %define directive: a variable and, optionally, its value.

%define api.pure sets the variable without a value, which Bison reads as the keyword true; the tree keeps the value absent so that the file prints back as written.

Reading a definitiondoctest
$file = (new \BisonParser\Parser())->parse("%define api.prefix {my_}\n%%\ns: 'a';\n");
    $file->declarations[0]->variable // => 'api.prefix'
    $file->declarations[0]->value // => 'my_'
    $file->declarations[0]->form?->value // => 'code'

Properties§

public string $variable
public string|null $value
public DefineForm|null $form
public Location $location

Methods§

public function __construct(
    public string $variable,
    public string|null $value,
    public DefineForm|null $form,
    public Location $location,
)

Parameters

$variablestringThe variable name
$valuestring|nullThe keyword, the decoded string, or the code without its braces; null when omitted
$formDefineForm|nullWhich form the value was written in, null when omitted
$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 2
Constant reads 1
Type declarations 2