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

$sourcestringContents of `lex.h`

Returns

array{keywords: array<string, string>, functions: array<string, string>} Terminal name by upper-cased spelling

Throws

RuntimeException When the file declares no keyword
Test cases 3
Calls 4
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

$sourcestringContents of `lex.h`

Returns

list<array{string, string, string, int}> Macro, upper-cased spelling, terminal and offset of each entry
Test cases 1
Called from 1
Calls 2

Test cases 4§

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

Dedicated tests 4