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

Add a lexer as an argument on public functions #715

Open
YiuRULE opened this issue Apr 19, 2023 · 0 comments
Open

Add a lexer as an argument on public functions #715

YiuRULE opened this issue Apr 19, 2023 · 0 comments

Comments

@YiuRULE
Copy link

YiuRULE commented Apr 19, 2023

An use case that I think about it when I work on a project who depends of sqlparse.

We can currently extend the lexer with using a singleton, as described on the documentation there: https://github.com/andialbrecht/sqlparse/blob/907fb496f90f2719095a1f01fe24db1e5c0e15a8/docs/source/extending.rst

I think the current behavior may be a problem on a project who use two different dependencies who depends of sqlparse. Project foo use two dependencies, A ask for the default configuration, B clear the entire lexer as written the configuration, the dependency A is likely to be broken due of an external dependencies as both A and B use the same singleton.

My suggestion is to be able to send a lexer parameter, if it's empty, we may use the default lexer who is the current singleton and if not, we use the lexer who was send as a parameter.

If needed I can contribute so let me know if my suggestion make sense.

@YiuRULE YiuRULE changed the title Add a lexer as an argument on public function Add a lexer as an argument on public functions Apr 19, 2023
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