Skip to content

Always wrap token streams in SoftKeywordTransformer#4542

Merged
youknowone merged 2 commits into
RustPython:mainfrom
astral-sh:charlie/expose
Feb 22, 2023
Merged

Always wrap token streams in SoftKeywordTransformer#4542
youknowone merged 2 commits into
RustPython:mainfrom
astral-sh:charlie/expose

Conversation

@charliermarsh

@charliermarsh charliermarsh commented Feb 22, 2023

Copy link
Copy Markdown
Collaborator

In Ruff, we often generate token streams outside of the parse step. Right now, that's causing failures for lint rules in certain cases that rely on the token stream rather than the AST. This PR always wraps the lexer in the soft keyword transformer. The primary downside is that we now have to thread through the Mode to all lexer calls.

@charliermarsh charliermarsh changed the title Expose SoftKeywordTransformer on public API Expose SoftKeywordTransformer on public API Feb 22, 2023
@charliermarsh charliermarsh changed the title Expose SoftKeywordTransformer on public API Always wrap token streams in SoftKeywordTransformer Feb 22, 2023
@youknowone youknowone merged commit 6d5bbd9 into RustPython:main Feb 22, 2023
@charliermarsh charliermarsh deleted the charlie/expose branch February 22, 2023 14:22
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.

2 participants