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

One state of the Bison lexer, selected by the character it starts on.

The lexer holds no rule of its own: it asks the chain which scanner claims the character under the cursor and hands the cursor over. Whitespace and comments are already gone by the time a scanner is consulted, so a scanner that claims a character always produces a token from it.

Methods§

public function handles(string $character): bool

Reports whether this scanner recognises a lexeme starting at the character.

Parameters

$characterstringA single character; never the empty string

Returns

bool True when this scanner should consume the lexeme
Test cases 2
public function scan(SourceCursor $cursor): BisonToken

Consumes one lexeme, leaving the cursor after it.

Parameters

$cursorSourceCursorCursor positioned on the character this scanner claimed

Returns

BisonToken The recognised token
Test cases 1

Test cases 2§

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

Dedicated tests 2

Relations§

Implemented by 7
Type declarations 1