classKeywordIndex
final class KeywordIndex
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
Turns a terminal's spellings into a lookup from spelling to terminal.
Lexical declarations list, for each terminal, every word that spells it. Both directions are needed: realization picks a spelling for a terminal, and tokenizing recognises a terminal from the spelling it met. Deriving the second from the first keeps the profile a single statement of the mapping.
Methods§
public function reversed(array<string, list<string>> $keywords): array<string, string>Inverts a terminal-to-spellings map.
Spellings are upper-cased because SQL keywords are matched without regard to case, so the index is keyed the way a tokenizer will ask.
Parameters
$keywords | array<string, list<string>> | Spellings by terminal name |
Returns
array<string, string> Terminal name by upper-cased spellingTest cases 4
KeywordIndexTest::testReversedIsEmptyForAProfileThatSpellsNothingcovers and callsKeywordIndexTest::testReversedKeysSpellingsInUpperCasecovers and callsKeywordIndexTest::testReversedLetsTheLastTerminalWinAContestedSpellingcovers and callsKeywordIndexTest::testReversedMapsEverySpellingBackToItsTerminalcovers and calls
Calls 1
- function-call
strtoupperline 34
Test cases 9§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 4
KeywordIndexTest::testReversedIsEmptyForAProfileThatSpellsNothingcovers and callsKeywordIndexTest::testReversedKeysSpellingsInUpperCasecovers and callsKeywordIndexTest::testReversedLetsTheLastTerminalWinAContestedSpellingcovers and callsKeywordIndexTest::testReversedMapsEverySpellingBackToItsTerminalcovers and calls
Other tests reaching this symbol 5
LexicalExceptionTestcallsGenerationContextTestcallsLexicalGrammarTestcallsPostgreSqlProviderTestcallsSqlGeneratorFactoryTestcalls