final class DirectiveScanner
    implements BisonScanner
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.

Consumes the three lexemes a percent sign can open.

%% separates the grammar's sections, %{ ... %} wraps a prologue of host code, and anything else is a named directive such as %token. They share a starting character but nothing else, so the second character decides which of the three is being read.

Methods§

public function handles(string $character): bool

Reports whether a directive can start here.

Parameters

$characterstringA single character; never the empty string

Returns

bool True for a percent sign
Test cases 1
public function scanSectionSeparator(SourceCursor $cursor): BisonToken
public function scanPrologue(SourceCursor $cursor): BisonToken

Consumes a %{ ... %} prologue of host-language code.

An unterminated prologue takes the rest of the file as its body, which matches how Bison itself reads a grammar that was cut short.

Parameters

$cursorSourceCursorCursor positioned on the percent sign

Returns

BisonToken The prologue and its contents
Test cases 3
Called from 1
Calls 5

Test cases 25§

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

Dedicated tests 8
Other tests reaching this symbol 17

Relations§

Instantiated in 1