Skip to content

Allow custom lexer instances in FilterStack - #893

Open
RamiNoodle733 wants to merge 2 commits into
andialbrecht:masterfrom
RamiNoodle733:feature-filter-stack-custom-lexer-806
Open

Allow custom lexer instances in FilterStack#893
RamiNoodle733 wants to merge 2 commits into
andialbrecht:masterfrom
RamiNoodle733:feature-filter-stack-custom-lexer-806

Conversation

@RamiNoodle733

Copy link
Copy Markdown

Summary

Allow callers that use FilterStack directly to replace its lexer instance without changing sqlparse's public top-level APIs.

FilterStack now initializes self.lexer from Lexer.get_default_instance() and run() calls that instance's get_tokens() method. Existing behavior is unchanged by default, while advanced users can assign a custom Lexer or compatible lexer object before calling run().

A focused regression test verifies that an injected lexer controls the token stream.

Fixes #806.

Validation

  • ran the tests (pytest) - not run locally because this automation environment does not have the repository checkout/development dependencies available
  • all style issues addressed (ruff) - not run locally for the same reason
  • changes are covered by tests
  • documentation is not required because this exposes the capability requested in Allow customizing lexer instance in FilterStack #806 through the existing advanced FilterStack API rather than adding a new top-level public function

AI assistance was used to inspect the issue and repository guidance and to implement the focused change. The resulting diff was manually constrained to the requested FilterStack injection point plus its regression test.

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

Successfully merging this pull request may close these issues.

Allow customizing lexer instance in FilterStack

1 participant