mirror of
https://github.com/mtshiba/pylyzer.git
synced 2025-07-07 17:45:00 +00:00
refactor: add pylyzer_core
crate
This commit is contained in:
parent
f5503d6f9e
commit
6828ddcf56
11 changed files with 51 additions and 22 deletions
9
Cargo.lock
generated
9
Cargo.lock
generated
|
@ -567,6 +567,15 @@ name = "pylyzer"
|
|||
version = "0.0.60"
|
||||
dependencies = [
|
||||
"els",
|
||||
"erg_common",
|
||||
"erg_compiler",
|
||||
"pylyzer_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pylyzer_core"
|
||||
version = "0.0.60"
|
||||
dependencies = [
|
||||
"erg_common",
|
||||
"erg_compiler",
|
||||
"py2erg",
|
||||
|
|
20
Cargo.toml
20
Cargo.toml
|
@ -12,6 +12,7 @@ repository.workspace = true
|
|||
[workspace]
|
||||
members = [
|
||||
"crates/py2erg",
|
||||
"crates/pylyzer_core",
|
||||
]
|
||||
|
||||
[workspace.package]
|
||||
|
@ -37,19 +38,16 @@ rustpython-ast = { git = "https://github.com/RustPython/Parser", version = "0.4.
|
|||
# els = { path = "../erg/crates/els", features = ["py_compat"] }
|
||||
|
||||
[features]
|
||||
debug = ["erg_compiler/debug", "erg_common/debug", "py2erg/debug"]
|
||||
large_thread = ["erg_compiler/large_thread", "erg_common/large_thread", "els/large_thread"]
|
||||
pretty = ["erg_compiler/pretty", "erg_common/pretty"]
|
||||
backtrace = ["erg_common/backtrace"]
|
||||
experimental = ["els/experimental", "erg_compiler/experimental", "erg_common/experimental"]
|
||||
debug = ["erg_common/debug", "pylyzer_core/debug"]
|
||||
large_thread = ["erg_common/large_thread", "els/large_thread", "pylyzer_core/large_thread"]
|
||||
pretty = ["erg_common/pretty", "pylyzer_core/pretty"]
|
||||
backtrace = ["erg_common/backtrace", "els/backtrace", "pylyzer_core/backtrace"]
|
||||
experimental = ["erg_common/experimental", "els/experimental", "pylyzer_core/experimental"]
|
||||
|
||||
[dependencies]
|
||||
erg_compiler = { workspace = true }
|
||||
pylyzer_core = { version = "0.0.60", path = "./crates/pylyzer_core" }
|
||||
erg_common = { workspace = true }
|
||||
els = { workspace = true }
|
||||
rustpython-parser = { workspace = true }
|
||||
rustpython-ast = { workspace = true }
|
||||
py2erg = { version = "0.0.60", path = "./crates/py2erg" }
|
||||
|
||||
[lib]
|
||||
path = "src/lib.rs"
|
||||
[dev-dependencies]
|
||||
erg_compiler = { workspace = true }
|
||||
|
|
|
@ -3,6 +3,9 @@ if [[ "$PWD" == */pylyzer ]]; then
|
|||
cd crates/py2erg
|
||||
echo "publish py2erg ..."
|
||||
cargo publish
|
||||
cd ../pylyzer_core
|
||||
echo "publish pylyzer_core ..."
|
||||
cargo publish
|
||||
cd ../../
|
||||
cargo publish
|
||||
if [ "$1" = "--cargo-only" ]; then
|
||||
|
|
24
crates/pylyzer_core/Cargo.toml
Normal file
24
crates/pylyzer_core/Cargo.toml
Normal file
|
@ -0,0 +1,24 @@
|
|||
[package]
|
||||
name = "pylyzer_core"
|
||||
version.workspace = true
|
||||
authors.workspace = true
|
||||
license.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[features]
|
||||
debug = ["erg_compiler/debug", "erg_common/debug", "py2erg/debug"]
|
||||
large_thread = ["erg_compiler/large_thread", "erg_common/large_thread"]
|
||||
pretty = ["erg_compiler/pretty", "erg_common/pretty"]
|
||||
backtrace = ["erg_common/backtrace"]
|
||||
experimental = ["erg_compiler/experimental", "erg_common/experimental"]
|
||||
|
||||
[dependencies]
|
||||
erg_common = { workspace = true }
|
||||
erg_compiler = { workspace = true }
|
||||
rustpython-parser = { workspace = true }
|
||||
rustpython-ast = { workspace = true }
|
||||
py2erg = { version = "0.0.60", path = "../py2erg" }
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
4
crates/pylyzer_core/lib.rs
Normal file
4
crates/pylyzer_core/lib.rs
Normal file
|
@ -0,0 +1,4 @@
|
|||
mod analyze;
|
||||
mod handle_err;
|
||||
|
||||
pub use analyze::{PythonAnalyzer, SimplePythonParser};
|
|
@ -23,7 +23,6 @@ fn copy_dir(from: impl AsRef<Path>, to: impl AsRef<Path>) -> std::io::Result<()>
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub(crate) fn copy_dot_erg() {
|
||||
if erg_path().exists() {
|
||||
return;
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
mod analyze;
|
||||
mod config;
|
||||
mod copy;
|
||||
mod handle_err;
|
||||
|
||||
pub use analyze::PythonAnalyzer;
|
|
@ -1,12 +1,10 @@
|
|||
mod analyze;
|
||||
mod config;
|
||||
mod copy;
|
||||
mod handle_err;
|
||||
|
||||
use analyze::{PythonAnalyzer, SimplePythonParser};
|
||||
use els::Server;
|
||||
use erg_common::config::ErgMode;
|
||||
use erg_common::spawn::exec_new_thread;
|
||||
use pylyzer_core::{PythonAnalyzer, SimplePythonParser};
|
||||
|
||||
use crate::copy::copy_dot_erg;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ use erg_common::config::ErgConfig;
|
|||
use erg_common::io::Input;
|
||||
use erg_common::spawn::exec_new_thread;
|
||||
use erg_compiler::artifact::{CompleteArtifact, IncompleteArtifact};
|
||||
use pylyzer::PythonAnalyzer;
|
||||
use pylyzer_core::PythonAnalyzer;
|
||||
|
||||
pub fn exec_analyzer(file_path: &'static str) -> Result<CompleteArtifact, IncompleteArtifact> {
|
||||
let cfg = ErgConfig {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue