Align ECPG lexer more closely with the core and psql lexers

Enterprise / PostgreSQL - Tom Lane [] - 13 November 2018 17:57 EST

Make a bunch of basically-cosmetic changes to reduce the diffs between the flex rules in scan.l, psqlscan.l, and pgc.l. Reorder some code, adjust a lot of whitespace, sync some comments, make use of flex start condition scopes to do that.

There are a few non-cosmetic changes in the ECPG lexer:

- Bring over the decimalfail rule (and support function process_integer_literal) so that ECPG will lex "1..10" into the same tokens as the backend would. I'm not sure this makes any
visible difference to users, but I'm not sure it doesn't, either.

- <> gets its own rule so as to produce a more on-point error message.

- Remove duplicate {xdstart} rule.

John Naylor, with a few additional changes by me


ec937d0805 Align ECPG lexer more closely with the core and psql lexers.
src/backend/parser/scan.l | 23 +-
src/fe_utils/psqlscan.l | 22 +-
src/interfaces/ecpg/preproc/pgc.l | 991 ++++++++++++++++++++++----------------
3 files changed, 594 insertions(+), 442 deletions(-)


  • Share