interface BisonDirectiveReader
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.

Reads the arguments of one kind of Bison declaration.

The eight declaration kinds share a spelling — a percent sign and a name — and nothing else: %expect takes a number, %token takes a list of names with optional codes and aliases, %parse-param takes a block of host code. Each shape is its own reader so that it can be exercised against the tokens it is meant to read, rather than through a whole grammar file.

Methods§

public function handles(string $directive): bool

Reports whether this reader knows the directive.

Parameters

$directivestringDirective name including its percent sign, e.g. "%token"

Returns

bool True when this reader should consume the arguments
Test cases 2
public function read(BisonTokenStream $stream, string $directive): BisonDeclaration|null

Consumes the directive's arguments from the stream.

Parameters

$streamBisonTokenStreamStream positioned just after the directive name
$directivestringDirective name including its percent sign

Returns

BisonDeclaration|null The declaration, or null when the arguments were not the expected shape
Test cases 1

Test cases 3§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 3

Relations§

Implemented by 8