Skip to content

Commit

Permalink
remove fuzzy matcher dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
ekiwi committed Dec 10, 2024
1 parent 075b7ac commit 83ca52a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ debug = true
# for samply: https://github.com/mstange/samply/?tab=readme-ov-file#turn-on-debug-info-for-full-stacks
[profile.profiling]
inherits = "release"
debug = true
debug = true
3 changes: 1 addition & 2 deletions patronus/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "patronus"
version = "0.28.1"
version = "0.28.2"
description = "Hardware bug-finding toolkit."
homepage = "https://kevinlaeufer.com"
keywords = ["RTL", "btor", "model-checking", "SMT", "bit-vector"]
Expand All @@ -14,7 +14,6 @@ rust-version.workspace = true
[dependencies]
indexmap = "2.0.0"
codespan-reporting = "0.11.1"
fuzzy-matcher = "0.3.7"
lazy_static = "1.4.0"
easy-smt.workspace = true
smallvec = { version = "1.x", features = ["union"] }
Expand Down
22 changes: 7 additions & 15 deletions patronus/src/btor2/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use crate::expr::*;
use crate::system::transform::do_transform;
use crate::system::*;
use baa::{BitVecValue, WidthInt};
use fuzzy_matcher::FuzzyMatcher;
use rustc_hash::{FxHashMap, FxHashSet};
use smallvec::SmallVec;
use std::borrow::Cow;
Expand Down Expand Up @@ -785,23 +784,16 @@ impl<'a> Parser<'a> {
.iter()
.chain(BINARY_OPS.iter())
.chain(TERNARY_OPS.iter())
.chain(OTHER_OPS.iter());
let matcher = fuzzy_matcher::skim::SkimMatcherV2::default();
let mut matches: Vec<(&&str, i64)> = all_ops
.flat_map(|other| matcher.fuzzy_match(other, op).map(|s| (other, s)))
.collect();
matches.sort_by_key(|(_, s)| -(*s));
let n_matches = std::cmp::min(matches.len(), 5);
let suggestions = matches
.iter()
.take(n_matches)
.map(|(n, _)| **n)
.collect::<Vec<&str>>()
.join(", ");
.chain(OTHER_OPS.iter())
.cloned()
.collect::<Vec<_>>();
self.add_error(
line,
op,
format!("Invalid op {op}. Did you mean: {suggestions}?"),
format!(
"Invalid op {op}. Available ops are: {}?",
all_ops.join(", ")
),
)
}
}
Expand Down

0 comments on commit 83ca52a

Please sign in to comment.