Repository navigation
Commit 3dc1869
committed
Name lexer token constants after the MySQL grammar
The token constants kept the names of the MySQL Workbench lexer the package
was ported from (OPEN_PAR_SYMBOL, INT_NUMBER, BACK_TICK_QUOTED_ID, ...), and
generate-tokens.php mapped them to grammar terminals. Name them after their
sql_yacc.yy terminals instead (IDENT, NUM, TEXT_STRING, GT_SYM, ...), the same
source as the AST rule names.
Single-character terminals have no usable Bison name, so they are named after
the character (LEFT_PAREN, ASTERISK, ...). The old role names were often wrong,
e.g., "*" is also the SELECT wildcard. The end marker is YYEOF, as in the C code
that Bison generates.
SINGLE_QUOTED_TEXT and DOUBLE_QUOTED_TEXT were aliases of one terminal, so they
become a single TEXT_STRING constant. A new test guards against such aliases.1 parent ca62f60 commit 3dc1869
6 files changed
Lines changed: 397 additions & 389 deletions
File tree
- packages/mysql-parser
- src
- tests
- tools
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
| 65 | + | |
70 | 66 | | |
71 | 67 | | |
72 | 68 | | |
| |||
79 | 75 | | |
80 | 76 | | |
81 | 77 | | |
82 | | - | |
| 78 | + | |
83 | 79 | | |
84 | 80 | | |
85 | 81 | | |
| |||
0 commit comments