taozhi8833998 / taozhi8833998/node-sql-parser
Add a way to find out the original range of characters for an AST node
@taozhi8833998 is already working on this.
Since May 22, 2020.
- Dominant language
- PEG.js
- Stars
- 1k
- Forks
- 244
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.