Skip to content

Commit 56bc5c1

Browse files
committed
add simple readme
1 parent 9210bee commit 56bc5c1

2 files changed

Lines changed: 32 additions & 3 deletions

File tree

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# rustpython-unparser
2+
3+
> [!IMPORTANT]
4+
> rustpython-unparser is in early development and WIP.
5+
6+
A complete unparser for rustpython-parser ASTs.
7+
8+
9+
## Simple usage example
10+
11+
```rust
12+
use rustpython_unparser::Unparser;
13+
use rustpython_parser::ast::Suite;
14+
use rustpython_parser::Parse;
15+
use std::fs;
16+
fn main() {
17+
// ...
18+
let unparser = Unparser::new();
19+
let stmts = Suite::parse(source_str, file_path);
20+
for stmt in &stmts {
21+
unparser.unparse_stmt(stmt);
22+
}
23+
let new_source = unparser.source;
24+
// ...
25+
}
26+
27+
28+
29+
```

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
pub mod unparser;
22

3+
pub use crate::unparser::Unparser;
4+
35
#[cfg(test)]
46
mod tests {
5-
7+
use super::*;
68
use rustpython_parser::ast::Suite;
79
use rustpython_parser::Parse;
810

9-
use crate::unparser::Unparser;
10-
1111
use std::fs;
1212
use std::io;
1313
use std::path::Path;

0 commit comments

Comments
 (0)