taozhi8833998 / node-sql-parser

Parse simple SQL statements into an abstract syntax tree (AST) with the visited tableList and convert it back to SQL
https://taozhi8833998.github.io/node-sql-parser/
Apache License 2.0
820 stars 183 forks source link

Is it possible to extend the grammar #2187

Open evil-shrike opened 1 month ago

evil-shrike commented 1 month ago

Hi

I want to parse queries in my own SQL flavor (extension to Google Ads Query Language):

SELECT
  ad_group_ad.policy_summary.policy_topic_entries:topic~0 as topic_id
FROM ad_group_ad

mostly it's basic SQL-compatible but columns can have ~ symbols (it's kinda operator to extract resource id from resource name). Currently the parsing fails at ~ symbols. Is it possible to extend the grammar somehow? I guess parser is a generated code (pegjs? btw why didn't you move to peggyjs), so I doubt, but want to confirm.