mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 18:58:04 +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
|
@ -21,10 +21,13 @@ arbitrary = { version = "1.3.0", features = ["derive"] }
|
|||
libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer", default-features = false }
|
||||
ruff = { path = "../crates/ruff" }
|
||||
ruff_python_ast = { path = "../crates/ruff_python_ast" }
|
||||
ruff_python_codegen = { path = "../crates/ruff_python_codegen" }
|
||||
ruff_python_formatter = { path = "../crates/ruff_python_formatter" }
|
||||
ruff_source_file = { path = "../crates/ruff_source_file" }
|
||||
similar = { version = "2.2.1" }
|
||||
|
||||
rustpython-parser = { git = "https://github.com/astral-sh/RustPython-Parser.git", rev = "593b46be5e0336fe01917f8ef400bd12d81df8c1" }
|
||||
rustpython-ast = { git = "https://github.com/astral-sh/RustPython-Parser.git", rev = "593b46be5e0336fe01917f8ef400bd12d81df8c1" }
|
||||
|
||||
# Prevent this from interfering with workspaces
|
||||
[workspace]
|
||||
|
|
|
@ -4,11 +4,13 @@
|
|||
#![no_main]
|
||||
|
||||
use libfuzzer_sys::{fuzz_target, Corpus};
|
||||
use ruff_python_ast::source_code::round_trip;
|
||||
use ruff_python_codegen::round_trip;
|
||||
use similar::TextDiff;
|
||||
|
||||
fn do_fuzz(case: &[u8]) -> Corpus {
|
||||
let Ok(code) = std::str::from_utf8(case) else { return Corpus::Reject; };
|
||||
let Ok(code) = std::str::from_utf8(case) else {
|
||||
return Corpus::Reject;
|
||||
};
|
||||
|
||||
// round trip it once to get a formatted version
|
||||
if let Ok(first) = round_trip(code, "fuzzed-source.py") {
|
||||
|
|
|
@ -4,12 +4,15 @@
|
|||
#![no_main]
|
||||
|
||||
use libfuzzer_sys::{fuzz_target, Corpus};
|
||||
use ruff_python_ast::source_code::{Generator, Locator, Stylist};
|
||||
use rustpython_parser::ast::Suite;
|
||||
use ruff_python_codegen::{Generator, Stylist};
|
||||
use ruff_source_file::Locator;
|
||||
use rustpython_ast::Suite;
|
||||
use rustpython_parser::{lexer, Mode, Parse, ParseError};
|
||||
|
||||
fn do_fuzz(case: &[u8]) -> Corpus {
|
||||
let Ok(code) = std::str::from_utf8(case) else { return Corpus::Reject; };
|
||||
let Ok(code) = std::str::from_utf8(case) else {
|
||||
return Corpus::Reject;
|
||||
};
|
||||
|
||||
// just round-trip it once to trigger both parse and unparse
|
||||
let locator = Locator::new(code);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue