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

The words PostgreSQL's scanner turns into keyword tokens.

Every keyword is its own terminal in gram.y; whether it may also serve as an identifier is the grammar's business, not the scanner's.

Methods§

public function __construct(private array<string, string> $keywords)

Parameters

$keywordsarray<string, string>Terminal name by upper-cased keyword
public static function load(string $path): self

Loads the table generated for one release.

Parameters

$pathstringKeyword resource file

Returns

self The table

Throws

RuntimeException When the file is missing or malformed
Test cases 2
Called from 1
Calls 3
public function lookup(string $word): string|null

Answers the terminal a word stands for, if it is a keyword.

Parameters

$wordstringWord as written

Returns

string|null Terminal name, or null for an identifier
Test cases 1
Calls 1

Private surface 1§

Implementation details, listed for orientation only.

private array<string, string> $keywords

Test cases 29§

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

Dedicated tests 3
Other tests reaching this symbol 26

Relations§

Static calls 1
Type declarations 2