mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-09 10:00:25 +00:00
![]() ## Summary This PR fixes the bug in the lexer where the `Mode::Ipython` wasn't being considered when initializing the soft keyword transformer which wraps the lexer. This means that if the source code starts with either `match` or `type` keyword, then the keywords were being considered as name tokens instead. For example, ```python match foo: case bar: pass ``` This would transform the `match` keyword into an identifier if the mode is `Ipython`. The fix is to reverse the condition in the soft keyword initializer so that any new modes are by default considered as the lexer being at start of line. ## Test Plan Add a new test case for `Mode::Ipython` and verify the snapshot. fixes: #8870 |
||
---|---|---|
.. | ||
flake8_to_ruff | ||
ruff_benchmark | ||
ruff_cache | ||
ruff_cli | ||
ruff_dev | ||
ruff_diagnostics | ||
ruff_formatter | ||
ruff_index | ||
ruff_linter | ||
ruff_macros | ||
ruff_notebook | ||
ruff_python_ast | ||
ruff_python_codegen | ||
ruff_python_formatter | ||
ruff_python_index | ||
ruff_python_literal | ||
ruff_python_parser | ||
ruff_python_resolver | ||
ruff_python_semantic | ||
ruff_python_stdlib | ||
ruff_python_trivia | ||
ruff_shrinking | ||
ruff_source_file | ||
ruff_text_size | ||
ruff_wasm | ||
ruff_workspace |