Skip to content

Commit 8a36fad

Browse files
committed
feat: bring flay's transformer to rustpython-unparser
1 parent 9355635 commit 8a36fad

File tree

4 files changed

+1532
-1
lines changed

4 files changed

+1532
-1
lines changed

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ description = "A complete unparser for RustPython ASTs"
99
license-file = "LICENSE"
1010
rust-version = "1.72.1"
1111

12+
[features]
13+
transformer = []
14+
1215
[dependencies]
1316
rustpython-ast = { version = ">=0.4.0" }
1417
rustpython-literal = ">=0.4.0"

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,7 @@ fn main() {
3434
// ...
3535
}
3636
```
37+
38+
# Transformer
39+
40+
This crate also contains a transformer trait for easy transformation of ASTs with the possibility of removing nodes. Enable the `transformer` feature to use it. It is similar to rustpython-ast's visitor, with the difference that a visit functions always return `Option<...>` and statements/expressions are passed as mutable.

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
pub mod unparser;
22
mod utils;
33
pub use crate::unparser::Unparser;
4-
4+
#[cfg(feature = "transformer")]
5+
pub mod transformer;
56
#[cfg(test)]
67
mod tests {
78
use super::*;

0 commit comments

Comments
 (0)