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

Remembers what Lemon's symbol table would know while the file is read.

Lemon rejects a second precedence, type, fallback or wildcard for a symbol and a token class named after a symbol already seen; this keeps enough to raise the same errors in the same places.

Methods§

public function see(string $name): void

Records a symbol as Lemon's Symbol_new does.

Parameters

$namestringThe symbol
Test cases 2
Called from 13
public function rank(string $name, Location $location): void

Records a precedence for a terminal.

Parameters

$namestringThe terminal
$locationLocationWhere it is written

Throws

SyntaxException When the terminal already has one
Test cases 2
Called from 1
Calls 2
public function type(string $name, Location $location): void

Records a type for a symbol.

Parameters

$namestringThe symbol
$locationLocationWhere it is written

Throws

SyntaxException When the symbol already has one
Test cases 1
Called from 1
Calls 2
public function fallBack(string $name, Location $location): void

Records that a token falls back to another.

Parameters

$namestringThe token
$locationLocationWhere it is written

Throws

SyntaxException When the token already falls back
Test cases 1
Called from 1
Calls 2
public function wildcard(string $name, Location $location): void

Records the wildcard token.

Parameters

$namestringThe token
$locationLocationWhere it is written

Throws

SyntaxException When a wildcard was already named
Test cases 1
Called from 1
Calls 2

Private surface 5§

Implementation details, listed for orientation only.

private array<string, true> $seen = []
private array<string, true> $ranked = []
private array<string, true> $typed = []
private array<string, true> $fallen = []
private ?string $wildcard = null

Test cases 43§

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

Dedicated tests 6
Other tests reaching this symbol 37

Relations§

Instantiated in 1
Method calls 14
Type declarations 11