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

Remembers which names a Lemon grammar uses as tokens and which as rules.

Lemon does not declare every symbol. It declares its tokens, and everything else is a rule if some rule is written for it, so what a name means is only known once the whole file has been read. A reader therefore says what it has learned as it goes, and the question "is this a terminal" is answered here rather than by whichever reader happens to be looking at the name.

Methods§

public function declareTokensOn(string $line, string $splitPattern): void

Records every token named on one line of a directive.

A directive lists its tokens separated by whitespace or, for a token class, by an alternation bar, and the line may end in the period Lemon uses to close a declaration. Anything on such a line that is not spelled like a token is not one.

Parameters

$linestringEverything the directive named
$splitPatternstringPattern separating one name from the next
Test cases 2
Called from 2
Calls 4

Private surface 2§

Implementation details, listed for orientation only.

private array<string, true> $tokens = []
private array<string, true> $rules = []

Test cases 19§

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

Dedicated tests 7
Other tests reaching this symbol 12

Relations§

Instantiated in 1
Static calls 1
Method calls 8
Type declarations 3