MCPcopy Create free account
hub / github.com/boutproject/BOUT-dev / fuzzyFind

Method fuzzyFind

src/sys/expressionparser.cxx:290–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288// Private functions
289
290std::multiset<ExpressionParser::FuzzyMatch>
291ExpressionParser::fuzzyFind(const std::string& name,
292 std::string::size_type max_distance) const {
293 std::multiset<ExpressionParser::FuzzyMatch> matches;
294 for (const auto& key : gen) {
295 if ((key.first != name) and (lowercase(key.first) == lowercase(name))) {
296 // Differs only in case: pretty good match
297 matches.insert({key.first, 1});
298 continue;
299 }
300 const auto fuzzy_distance = editDistance(key.first, name);
301 if (fuzzy_distance <= max_distance) {
302 matches.insert({key.first, fuzzy_distance});
303 }
304 }
305 return matches;
306}
307
308FieldGeneratorPtr ExpressionParser::parseIdentifierExpr(LexInfo& lex) const {
309 // Make a nice error message if we couldn't find the identifier

Callers

nothing calls this directly

Calls 2

lowercaseFunction · 0.85
editDistanceFunction · 0.85

Tested by

no test coverage detected