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.

Reading a directivedoctest
$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 $keyword
public string $value
public Location $location

Methods§

public function __construct(
    public DirectiveKeyword $keyword,
    public string $value,
    public ArgumentForm $form,
    public Location $location,
)

Parameters

$keywordDirectiveKeywordThe keyword
$valuestringThe argument without its delimiters
$formArgumentFormHow the argument was written
$locationLocationWhere the `%` sign is
public function location(): Location

{@inheritDoc}

Returns

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 1
Constant reads 1
Type checks 1