classCode
final class Code
implements Declaration
Public API: explicitly declared with
@visibility public.A %code directive, with the qualifier that says where the code goes.
$file = (new \BisonParser\Parser())->parse("%code requires { #include <stdint.h> }\n%%\ns: 'a';\n");
$file->declarations[0]->qualifier // => 'requires'
$file->declarations[0]->code // => ' #include <stdint.h> 'Properties§
public string|null $qualifierpublic string $codepublic Location $locationMethods§
public function __construct(
public string|null $qualifier,
public string $code,
public Location $location,
)Parameters
$qualifier | string|null | The qualifier such as `requires`, or null for unqualified code |
$code | string | The code without its braces |
$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
CodeTest::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
CodeTest::testLocationcalls