From 0c0305456d26a19d7f4dcaac257af265fe6a6214 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Wed, 2 Oct 2024 00:17:10 -0700 Subject: [PATCH] Work --- Cargo.lock | 70 ------------------------------------------------- Cargo.toml | 2 -- src/compiler.rs | 40 +++++----------------------- 3 files changed, 7 insertions(+), 105 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 85fdf69101..c1be4e1688 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -460,30 +460,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" -[[package]] -name = "globset" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" -dependencies = [ - "aho-corasick", - "bstr", - "log", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "globwalk" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf760ebf69878d9fd8f110c89703d90ce35095324d1f1edcb595c63945ee757" -dependencies = [ - "bitflags", - "ignore", - "walkdir", -] - [[package]] name = "heck" version = "0.5.0" @@ -528,22 +504,6 @@ dependencies = [ "cc", ] -[[package]] -name = "ignore" -version = "0.4.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" -dependencies = [ - "crossbeam-deque", - "globset", - "log", - "memchr", - "regex-automata", - "same-file", - "walkdir", - "winapi-util", -] - [[package]] name = "is_terminal_polyfill" version = "1.70.1" @@ -583,8 +543,6 @@ dependencies = [ "edit-distance", "executable-path", "glob", - "globset", - "globwalk", "heck", "lexiclean", "libc", @@ -887,15 +845,6 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - [[package]] name = "semver" version = "1.0.23" @@ -1172,16 +1121,6 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -1271,15 +1210,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys 0.59.0", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" diff --git a/Cargo.toml b/Cargo.toml index bd2449ffd3..f6ab4f2747 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,8 +31,6 @@ dirs = "5.0.1" dotenvy = "0.15" edit-distance = "2.0.0" glob = "0.3.1" -globset = "0.4.15" -globwalk = "0.9.1" heck = "0.5.0" lexiclean = "0.0.1" libc = "0.2.0" diff --git a/src/compiler.rs b/src/compiler.rs index 03f99ac447..3ece28dd1c 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -79,43 +79,18 @@ impl Compiler { let has_glob = import_base_str.find('*').is_some(); if has_glob { - let walker = globwalk::glob_builder(import_base_str) - .build() - .map_err(|_err| Error::ImportGlob { - error: "FIX ERR".to_string(), - path: *path, - })?; - for maybe_entry in walker { - let Ok(entry) = maybe_entry else { continue }; - let import = entry.path().to_owned(); - println!("IMPORT: {}", import.display()); - - if import.is_file() { - if current.file_path.contains(&import) { - return Err(Error::CircularImport { - current: current.path, - import, - }); - } - absolute_paths.push(import.clone()); - stack.push(current.import(import, path.offset)); - } - } - - /* - let glob = globset::Glob::new(&import_base_str).map_err(|_err| - Error::ImportGlob { error: "FIX ERR".to_string(), path: *path } - )?.compile_matcher(); - */ - /* - let glob_options = glob::MatchOptions { case_sensitive: true, require_literal_separator: false, require_literal_leading_dot: false, }; - let import_paths = glob::glob_with(&import_base_str, glob_options) - .map_err(|error| Error::ImportGlob { error, path: *path })?; + let import_paths = + glob::glob_with(&import_base_str, glob_options).map_err(|error| { + Error::ImportGlob { + error: error.to_string(), + path: *path, + } + })?; for import in import_paths { let Ok(import) = import else { continue }; @@ -130,7 +105,6 @@ impl Compiler { stack.push(current.import(import, path.offset)); } } - */ } else if import.is_file() { if current.file_path.contains(&import) { return Err(Error::CircularImport {