classKeywords
final class Keywords
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
$release | GrammarRelease | The grammar release whose keywords are read |
public function categories(string $word): list<string>Answers the category nonterminals of a lower-case word; none when the word is not a keyword.
Parameters
$word | string |
Returns
list<string>Test cases 1
Called from 2
Calls 1
- method-call Keywords::table() line 55
public function bare(string $word, NameUse $use): boolTells whether a lower-case word is read as that name when written without quotes at a position.
Parameters
$word | string | |
$use | NameUse |
Returns
boolTest cases 1
Called from 1
Calls 9
- method-call Keywords::categories() line 63
- class-const NameUse::Identifier() line 64
- function-call
in_arrayline 64 - class-const NameUse::Column() line 69
- class-const NameUse::Relation() line 69
- class-const NameUse::Alias() line 69
- class-const NameUse::Routine() line 70
- class-const NameUse::Qualifier() line 71
- class-const NameUse::Label() line 72
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
- static-call Productions::load() line 87
- function-call
dirnameline 87 - function-call
explodeline 89 - function-call
in_arrayline 90 - class-const Keywords::CATEGORIES() line 90
- method-call VersionRegistry::resolve() line 95
- new VersionRegistry line 95
- class-const PostgreSqlVersion::DIALECT() line 95
- function-call
is_arrayline 96 - function-call
is_stringline 98 - function-call
strtolowerline 99
Private surface 2§
Implementation details, listed for orientation only.
private static array<string, array<string, list<string>>> $loaded = []private GrammarRelease $releaseTest cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.