mirror of
https://github.com/azur1s/bobbylisp.git
synced 2024-10-16 02:37:40 -05:00
cleanup
This commit is contained in:
parent
8021a0e31d
commit
74adfe1f0f
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -186,7 +186,6 @@ dependencies = [
|
||||||
name = "hir"
|
name = "hir"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"levenshtein",
|
|
||||||
"parser",
|
"parser",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -206,12 +205,6 @@ version = "1.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "levenshtein"
|
|
||||||
version = "1.0.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "db13adb97ab515a3691f56e4dbab09283d0b86cb45abd991d8634a9d6f501760"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lexer"
|
name = "lexer"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
|
@ -8,4 +8,3 @@ edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
parser = { path = "../parser" }
|
parser = { path = "../parser" }
|
||||||
levenshtein = "1.0.5" # Used for error reporting
|
|
|
@ -454,17 +454,3 @@ fn gen_type_hint(type_hint: &str) -> String {
|
||||||
_ => { dbg!(type_hint); todo!() }
|
_ => { dbg!(type_hint); todo!() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the closet intrinsic name to the given name
|
|
||||||
fn closet_intrinsic(got: String) -> String {
|
|
||||||
let mut closest = String::new();
|
|
||||||
let mut closest_dist = std::usize::MAX;
|
|
||||||
for intrinsic in INTRINSICS.iter() {
|
|
||||||
let dist = levenshtein::levenshtein(got.as_str(), intrinsic);
|
|
||||||
if dist < closest_dist {
|
|
||||||
closest = intrinsic.to_string();
|
|
||||||
closest_dist = dist;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
closest
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue