mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 22:55:08 +00:00
Remove parser dependency from ruff-python-ast (#6096)
This commit is contained in:
parent
99127243f4
commit
2cf00fee96
658 changed files with 1714 additions and 1546 deletions
|
@ -275,7 +275,7 @@ impl Strategy for StrategyRemoveToken {
|
|||
input: &'a str,
|
||||
_ast: &'a Suite,
|
||||
) -> Result<Box<dyn ExactSizeStringIter + 'a>> {
|
||||
let token_ranges: Vec<_> = ruff_rustpython::tokenize(input)
|
||||
let token_ranges: Vec<_> = ruff_python_parser::tokenize(input)
|
||||
.into_iter()
|
||||
// At this point we know we have valid python code
|
||||
.map(Result::unwrap)
|
||||
|
@ -320,9 +320,9 @@ fn minimization_step(
|
|||
pattern: &Regex,
|
||||
last_strategy_and_idx: Option<(&'static dyn Strategy, usize)>,
|
||||
) -> Result<Option<(&'static dyn Strategy, usize, String)>> {
|
||||
let tokens = ruff_rustpython::tokenize(input);
|
||||
let tokens = ruff_python_parser::tokenize(input);
|
||||
let ast =
|
||||
ruff_rustpython::parse_program_tokens(tokens, "input.py").context("not valid python")?;
|
||||
ruff_python_parser::parse_program_tokens(tokens, "input.py").context("not valid python")?;
|
||||
|
||||
// Try the last succeeding strategy first, skipping all that failed last time
|
||||
if let Some((last_strategy, last_idx)) = last_strategy_and_idx {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue