| 288 | // Private functions |
| 289 | |
| 290 | std::multiset<ExpressionParser::FuzzyMatch> |
| 291 | ExpressionParser::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 | |
| 308 | FieldGeneratorPtr ExpressionParser::parseIdentifierExpr(LexInfo& lex) const { |
| 309 | // Make a nice error message if we couldn't find the identifier |
nothing calls this directly
no test coverage detected