mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-29 11:01:57 +00:00
18 lines
507 B
C++
18 lines
507 B
C++
#pragma once
|
|
|
|
#include <string_view.h>
|
|
|
|
#include <limits.h>
|
|
#include <vector>
|
|
|
|
// Negative but far from INT_MIN so that intermediate results are hard to
|
|
// overflow
|
|
constexpr int kMinScore = INT_MIN / 2;
|
|
|
|
// Evaluate the score matching |pattern| against |str|, the larger the better.
|
|
// |score| and |dp| must be at least as long as |str|.
|
|
int FuzzyEvaluate(std::string_view pattern,
|
|
std::string_view str,
|
|
std::vector<int>& score,
|
|
std::vector<int>& dp);
|