classLexHeader
final class LexHeader
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
Extracts the keyword tables from MySQL's sql/lex.h.
Releases before 8.0 keep two arrays, symbols[] for keywords and sql_functions[] for function names. From 8.0 on a single array marks each entry with its group: SYM and SYM_HK are keywords, SYM_FN are function names, and SYM_H are optimizer hints, which the SQL lexer never produces.
Methods§
public function parse(string $source): array{keywords: array<string, string>, functions: array<string, string>}Reads the keyword tables.
Parameters
$source | string | Contents of `lex.h` |
Returns
array{keywords: array<string, string>, functions: array<string, string>} Terminal name by upper-cased spellingThrows
RuntimeException When the file declares no keywordTest cases 3
Calls 4
- function-call
strposline 33 - method-call LexHeader::entries() line 36
- new
RuntimeExceptionline 47 - function-call
ksortline 49
public function entries(string $source): list<array{string, string, string, int}>Reads every keyword entry, in either release's spelling.
An entry may span two lines, so the whole file is searched and each entry is reported with the offset it was found at.
Parameters
$source | string | Contents of `lex.h` |
Returns
list<array{string, string, string, int}> Macro, upper-cased spelling, terminal and offset of each entryTest cases 1
Called from 1
Test cases 4§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.