classDirective
final class Directive
implements Declaration
Public API: explicitly declared with
@visibility public.A keyword with one argument, such as %name, %include or %extra_argument.
Lemon appends the arguments of repeated keywords; the tree keeps each occurrence where it is written.
$file = (new \LemonParser\Parser())->parse("%extra_argument {Parse *pParse}\n");
$directive = $file->declarations()[0];
[$directive->keyword->value, $directive->value, $directive->form->value] // => ['extra_argument', 'Parse *pParse', 'code']Properties§
public DirectiveKeyword $keywordpublic string $valuepublic ArgumentForm $formpublic Location $locationMethods§
public function __construct(
public DirectiveKeyword $keyword,
public string $value,
public ArgumentForm $form,
public Location $location,
)Parameters
$keyword | DirectiveKeyword | The keyword |
$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 7§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.