Introduce rustpython-format crate

This commit is contained in:
Micha Reiser 2023-05-12 11:11:05 +02:00
parent 263f96fe7b
commit 895f923567
No known key found for this signature in database
11 changed files with 1254 additions and 1238 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,7 +4,7 @@ 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]

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 }

View file

@ -1,9 +1,9 @@
//! Implementation of Printf-Style string formatting
//! as per the [Python Docs](https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting).
use crate::{float, format::Case};
use bitflags::bitflags;
use num_bigint::{BigInt, Sign};
use num_traits::Signed;
use rustpython_literal::{float, format::Case};
use std::{
cmp, fmt,
iter::{Enumerate, Peekable},

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,16 +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]
bitflags = "2.2.1"
itertools = "0.10.5"
num-bigint = { workspace = true }
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]

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,3 @@
pub mod cformat;
pub mod char;
pub mod escape;
pub mod float;

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"