Add format and cformat modules from RustPython (#24)

* Add `format` and `cformat` modules from `RustPython`

* Introduce `rustpython-format` crate

* Remove unused dependencies
This commit is contained in:
Micha Reiser 2023-05-12 11:27:05 +02:00 committed by GitHub
parent 947fb53d0b
commit a983f4383f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 2297 additions and 15 deletions

View file

@ -11,14 +11,14 @@ include = ["LICENSE", "Cargo.toml", "src/**/*.rs"]
[workspace]
resolver = "2"
members = [
"ast", "core", "literal", "parser",
"ast", "core", "format", "literal", "parser",
"ruff_text_size", "ruff_source_location",
]
[workspace.dependencies]
rustpython-ast = { path = "ast", version = "0.2.0", default-features = false }
rustpython-parser-core = { path = "core", version = "0.2.0", default-features = false }
rustpython-literal = { path = "literal", version = "0.2.0" }
rustpython-ast = { path = "ast", default-features = false }
rustpython-parser-core = { path = "core", default-features = false }
rustpython-literal = { path = "literal" }
ahash = "0.7.6"
anyhow = "1.0.45"

View file

@ -4,7 +4,7 @@ version = "0.2.0"
description = "AST definitions for RustPython"
authors = ["RustPython Team"]
edition = "2021"
repository = "https://github.com/RustPython/RustPython"
repository = "https://github.com/RustPython/Parser/"
license = "MIT"
[features]

View file

@ -4,20 +4,15 @@ description = "RustPython parser data types."
version = "0.2.0"
authors = ["RustPython Team"]
edition = "2021"
repository = "https://github.com/RustPython/RustPython"
repository = "https://github.com/RustPython/Parser/"
license = "MIT"
[dependencies]
itertools = { workspace = true }
num-bigint = { workspace = true }
num-complex = { workspace = true }
# ruff dependency shouldn't be placed out of this crate
ruff_text_size = { path = "../ruff_text_size" }
ruff_source_location = { path = "../ruff_source_location", optional = true }
serde = { version = "1.0.133", optional = true, default-features = false, features = ["derive"] }
lz4_flex = "0.9.2"
[features]
default = []

16
format/Cargo.toml Normal file
View file

@ -0,0 +1,16 @@
[package]
name = "rustpython-format"
edition = "2021"
version = "0.2.0"
description = "Format helpers for RustPython"
authors = ["RustPython Team"]
repository = "https://github.com/RustPython/Parser/"
license = "MIT"
[dependencies]
rustpython-literal = { workspace = true }
bitflags = "2.2.1"
itertools = "0.10.5"
num-bigint = { workspace = true }
num-traits = { workspace = true }

1044
format/src/cformat.rs Normal file

File diff suppressed because it is too large Load diff

1224
format/src/format.rs Normal file

File diff suppressed because it is too large Load diff

4
format/src/lib.rs Normal file
View file

@ -0,0 +1,4 @@
pub mod cformat;
mod format;
pub use crate::format::*;

View file

@ -4,14 +4,13 @@ version = "0.2.0"
description = "Common literal handling utilities mostly useful for unparse and repr."
authors = ["RustPython Team"]
edition = "2021"
repository = "https://github.com/RustPython/RustPython"
repository = "https://github.com/RustPython/Parser/"
license = "MIT"
[dependencies]
num-traits = { workspace = true }
hexf-parse = "0.2.1"
lexical-parse-float = { version = "0.8.0", features = ["format"] }
num-traits = { workspace = true }
unic-ucd-category = "0.9"
[dev-dependencies]

View file

@ -4,7 +4,7 @@ version = "0.2.0"
description = "Parser for python code."
authors = ["RustPython Team"]
build = "build.rs"
repository = "https://github.com/RustPython/RustPython"
repository = "https://github.com/RustPython/Parser/"
license = "MIT"
edition = "2021"