classKeywordTable
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
$keywords | array<string, string> | Terminal name by upper-cased keyword |
public static function load(string $path): selfLoads the table generated for one release.
Parameters
$path | string | Keyword resource file |
Returns
self The tableThrows
RuntimeException When the file is missing or malformedTest cases 2
Called from 1
public function lookup(string $word): string|nullAnswers the terminal a word stands for, if it is a keyword.
Parameters
$word | string | Word as written |
Returns
string|null Terminal name, or null for an identifierTest cases 1
Calls 1
- function-call
strtoupperline 55
Private surface 1§
Implementation details, listed for orientation only.
private array<string, string> $keywordsTest 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
NumberScannerTest::testRejectJunkcallsNumberScannerTest::testScancallsNumberScannerTest::testScanRejectsAnEmptyHexadecimalLiteralcallsNumberScannerTest::testScanRejectsAnIncompleteExponentcallsNumberScannerTest::testScanRejectsTrailingJunkcallsOperatorScannerTest::testScancallsOperatorScannerTest::testScanRejectsAForeignCharactercallsOperatorScannerTest::testScanRejectsAnOverlongOperatorcallsPostgreSqlLexerTest::testScancallsPostgreSqlLexerTest::testScanRejectsAnUnreadableCharactercallsQuotedScannerTest::testBodycallsQuotedScannerTest::testDollarQuotedcallsQuotedScannerTest::testDollarQuotedRejectsAnUnterminatedStringcallsQuotedScannerTest::testIdentifiercallsQuotedScannerTest::testIdentifierRejectsAnEmptyIdentifiercallsQuotedScannerTest::testIdentifierRejectsAnUnterminatedIdentifiercallsQuotedScannerTest::testScanReadsEverySpellingOfAStringcallsQuotedScannerTest::testScanReadsTheNationalPrefixAsAKeywordcallsQuotedScannerTest::testStringcallsQuotedScannerTest::testStringRejectsAnUnterminatedStringcallsScanTest::testLexemecallsTriviaScannerTest::testBlockCommentcallsTriviaScannerTest::testBlockCommentRejectsAnUnterminatedCommentcallsTriviaScannerTest::testSkipcallsWordScannerTest::testScancallsPostgreSqlParserTestcalls