You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I have a use case where I would like to use node-sql-parser for syntax highlighting. For this, I would need to have access to the range of characters in the original string that correspond to parsed AST nodes. It looks like Peg.js makes this information available as a 'location' variable in the parser functions (see https://pegjs.org/documentation).
Adding this should therefore pretty easy. I am not that familiar with the node-sql-parser codebase, but would love to give it a shot if someone can give me some pointers on how this should be implemented. Expected behavior
For each AST node, have a start and end property indicating the character range in the parsed SQL that maps to the AST node.
The text was updated successfully, but these errors were encountered:
This would be really great to have. There are lots of applications for a parser where being able to reference the original source location is of crucial importance.
I'm personally investigating this library for use inside SQL Formatter. There are currently two main blockers for being able to use it:
@taozhi8833998@pixelspark after merging #1680, version 5.0.0 now supports the includeLocations option, which adds a loc object to the last nodes.
It's still partial and only in some dialects, but the implementation is easy enough so adding support is a no brainer. You can try it in the bigquery dialect
Describe the bug
I have a use case where I would like to use
node-sql-parser
for syntax highlighting. For this, I would need to have access to the range of characters in the original string that correspond to parsed AST nodes. It looks like Peg.js makes this information available as a 'location' variable in the parser functions (see https://pegjs.org/documentation).Adding this should therefore pretty easy. I am not that familiar with the node-sql-parser codebase, but would love to give it a shot if someone can give me some pointers on how this should be implemented.
Expected behavior
For each AST node, have a
start
andend
property indicating the character range in the parsed SQL that maps to the AST node.The text was updated successfully, but these errors were encountered: