classDefine
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.
$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 $variablepublic string|null $valuepublic DefineForm|null $formpublic Location $locationMethods§
public function __construct(
public string $variable,
public string|null $value,
public DefineForm|null $form,
public Location $location,
)Parameters
$variable | string | The variable name |
$value | string|null | The keyword, the decoded string, or the code without its braces; null when omitted |
$form | DefineForm|null | Which form the value was written in, null when omitted |
$location | Location | Where the directive is written |
public function location(): LocationAnswers where the declaration begins.
Returns
Location Line and column of the percent signTest cases 1
DefineTest::testLocationcalls
Test cases 7§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
DefineTest::testLocationcalls