Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking token source positions #793

Open
dylanscott opened this issue Oct 18, 2024 · 0 comments
Open

Tracking token source positions #793

dylanscott opened this issue Oct 18, 2024 · 0 comments

Comments

@dylanscott
Copy link

dylanscott commented Oct 18, 2024

Hello 👋 We're big fans of sqlparse, particularly its leniency in the face of weird or just plain invalid syntax, and use it to power some aspects of a SQL editing interface. We've long maintained a fork with a few minor tweaks and fixes (e.g. removing keywords irrelevant in our context). With the recent work to make it easier to customize the lexer it seems like we can handle most of this customization in a first-class way. But there is one other addition we made that is critical to our use-case which I wanted to inquire if you would be open to upstreaming: Tracking of source positions for tokens, which we use for syntax highlighting.

I've prepared a PR - #794 - with the changes we made to implement this. It's pretty non-invasive - the main thing I'm not sure about is if it would be considered a breaking change. As far as I can tell it does not change any of the API surface area covered in the documentation, so it may not be. It would only potentially be breaking for folks using the lexer directly, as it expands the raw/unwrapped token stream from 2-tuples to 3-tuples (in fact only two of the cases in test_tokenize.py had to be updated).

In any case, thank you for your work building and maintaining this library!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant