Repository navigation
Commit b3c39da
committed
Derive token names instead of shipping a name table
Drop the generated TOKEN_NAMES map (half of tokens.php) and derive diagnostic
token names at runtime instead: a keyword token resolves to its keyword string
by inverting KEYWORDS, any other token to its WP_MySQL_Tokens constant name by
reflection. Every emittable token id is covered — the dropped map's extra
entries were terminals the lexer can never emit. On synonym collisions, plain
keywords win over paren-gated function variants (USER over SESSION_USER).
The map is built lazily on the first get_token_name() call, which is a
debug-only path. tokens.php shrinks from 41 KB to 20 KB.1 parent cdeb13a commit b3c39da
6 files changed
Lines changed: 97 additions & 892 deletions
File tree
- packages/mysql-parser
- src
- grammar
- tests
- tools
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
430 | 430 | | |
431 | 431 | | |
432 | 432 | | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
433 | 440 | | |
434 | 441 | | |
435 | 442 | | |
| |||
438 | 445 | | |
439 | 446 | | |
440 | 447 | | |
441 | | - | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
442 | 468 | | |
443 | 469 | | |
444 | 470 | | |
| |||
0 commit comments