mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-10 06:35:17 +00:00
Make parser location optional
This commit is contained in:
parent
aabc96dde9
commit
cbe4e8c5f3
9 changed files with 18 additions and 14 deletions
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
|
@ -37,6 +37,8 @@ jobs:
|
|||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
- name: run tests with default features
|
||||
run: cargo test --all
|
||||
- name: run tests with embedded parser
|
||||
run: cargo test --all --no-default-features
|
||||
- name: run tests with generated parser
|
||||
|
|
|
@ -16,11 +16,9 @@ members = [
|
|||
]
|
||||
|
||||
[workspace.dependencies]
|
||||
rustpython-ast = { path = "ast", version = "0.2.0" }
|
||||
rustpython-parser-core = { path = "core", version = "0.2.0" }
|
||||
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" }
|
||||
ruff_text_size = { path = "ruff_text_size" }
|
||||
ruff_source_location = { path = "ruff_source_location" }
|
||||
|
||||
ahash = "0.7.6"
|
||||
anyhow = "1.0.45"
|
||||
|
|
|
@ -8,9 +8,9 @@ repository = "https://github.com/RustPython/RustPython"
|
|||
license = "MIT"
|
||||
|
||||
[features]
|
||||
default = ["constant-optimization", "fold", "source-code"]
|
||||
default = ["location"]
|
||||
constant-optimization = ["fold"]
|
||||
source-code = ["fold"]
|
||||
location = ["fold", "rustpython-parser-core/location"]
|
||||
fold = []
|
||||
unparse = ["rustpython-literal"]
|
||||
visitor = []
|
||||
|
|
|
@ -8,7 +8,7 @@ mod generic {
|
|||
include!("gen/generic.rs");
|
||||
}
|
||||
mod impls;
|
||||
#[cfg(feature = "source-code")]
|
||||
#[cfg(feature = "location")]
|
||||
mod source_locator;
|
||||
#[cfg(feature = "unparse")]
|
||||
mod unparse;
|
||||
|
@ -32,11 +32,12 @@ mod visitor {
|
|||
include!("gen/visitor.rs");
|
||||
}
|
||||
|
||||
#[cfg(feature = "source-code")]
|
||||
#[cfg(feature = "location")]
|
||||
pub mod located {
|
||||
include!("gen/located.rs");
|
||||
}
|
||||
|
||||
#[cfg(feature = "location")]
|
||||
pub use rustpython_parser_core::source_code;
|
||||
#[cfg(feature = "visitor")]
|
||||
pub use visitor::Visitor;
|
||||
|
|
|
@ -20,5 +20,5 @@ serde = { version = "1.0.133", optional = true, default-features = false, featur
|
|||
lz4_flex = "0.9.2"
|
||||
|
||||
[features]
|
||||
default = ["source-code"]
|
||||
source-code = ["ruff_source_location"]
|
||||
default = []
|
||||
location = ["ruff_source_location"]
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
mod error;
|
||||
mod format;
|
||||
pub mod mode;
|
||||
#[cfg(feature = "source-code")]
|
||||
#[cfg(feature = "location")]
|
||||
pub mod source_code;
|
||||
|
||||
pub use error::BaseError;
|
||||
|
|
|
@ -9,7 +9,8 @@ license = "MIT"
|
|||
edition = "2021"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
default = ["location"]
|
||||
location = ["rustpython-ast/location"]
|
||||
serde = ["dep:serde", "rustpython-parser-core/serde"]
|
||||
|
||||
[build-dependencies]
|
||||
|
|
|
@ -113,7 +113,9 @@
|
|||
#![doc(html_root_url = "https://docs.rs/rustpython-parser/")]
|
||||
|
||||
pub use rustpython_ast as ast;
|
||||
pub use rustpython_parser_core::{source_code, text_size, Mode};
|
||||
#[cfg(feature = "location")]
|
||||
pub use rustpython_parser_core::source_code;
|
||||
pub use rustpython_parser_core::{text_size, Mode};
|
||||
|
||||
mod function;
|
||||
// Skip flattening lexer to distinguish from full parser
|
||||
|
|
|
@ -11,7 +11,7 @@ rust-version = { workspace = true }
|
|||
[lib]
|
||||
|
||||
[dependencies]
|
||||
ruff_text_size = { workspace = true, features = ["serde"] }
|
||||
ruff_text_size = { path = "../ruff_text_size" }
|
||||
|
||||
memchr = "2.5.0"
|
||||
once_cell = { workspace = true }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue