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

The keyword categories of one PostgreSQL grammar release.

Rule: PG-KEYWORD-001. The categories are read from the grammar itself: a keyword terminal belongs to unreserved_keyword, col_name_keyword, type_func_name_keyword or reserved_keyword, and independently to bare_label_keyword. The grammar accepts a keyword as a name through ColId (unreserved and column-name keywords), type_function_name (unreserved and type-or-function-name keywords) and ColLabel (every keyword). The first part of a dotted name is read as ColId in some positions and as type_function_name in others, so a qualifier is written bare only when both accept it. Source: https://www.postgresql.org/docs/17/sql-keywords-appendix.html. Status: Implemented.

Constants§

public const CATEGORIES = ['unreserved_keyword', 'col_name_keyword', 'type_func_name_keyword', 'reserved_…

The nonterminals that turn a keyword terminal into a name.

Methods§

public function __construct(private GrammarRelease $release)

Parameters

$releaseGrammarReleaseThe grammar release whose keywords are read
public function categories(string $word): list<string>
public function bare(string $word, NameUse $use): bool

Tells whether a lower-case word is read as that name when written without quotes at a position.

Parameters

$wordstring
$useNameUse

Returns

bool
Test cases 1
Called from 1
Calls 9
public function table(): array<string, list<string>>

Answers the categories of every keyword of the release by lower-case word.

Returns

array<string, list<string>>
Test cases 1
Called from 1
Calls 11

Private surface 2§

Implementation details, listed for orientation only.

private static array<string, array<string, list<string>>> $loaded = []
private GrammarRelease $release

Test cases 3§

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

Dedicated tests 3

Relations§

Instantiated in 2
Method calls 2
Constant reads 1