15 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_FUZZYMATCH_H
16 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_FUZZYMATCH_H
18 #include "llvm/ADT/ArrayRef.h"
19 #include "llvm/ADT/Optional.h"
20 #include "llvm/ADT/SmallString.h"
21 #include "llvm/ADT/StringRef.h"
22 #include "llvm/Support/raw_ostream.h"
67 llvm::MutableArrayRef<CharRole> Roles);
80 llvm::Optional<float>
match(llvm::StringRef Word);
82 llvm::StringRef
pattern()
const {
return llvm::StringRef(Pat, PatN); }
83 bool empty()
const {
return PatN == 0; }
88 llvm::SmallString<256>
dumpLast(llvm::raw_ostream &)
const;
92 constexpr
static int MaxPat = 63, MaxWord = 127;
98 constexpr
static Action Miss =
false;
99 constexpr
static Action Match =
true;
101 bool init(llvm::StringRef Word);
103 bool allowMatch(
int P,
int W, Action Last)
const;
104 int skipPenalty(
int W, Action Last)
const;
105 int matchBonus(
int P,
int W, Action Last)
const;
118 char LowWord[MaxWord];
121 bool WordContainsPattern;
127 signed int Score : 15;
130 ScoreInfo Scores[MaxPat + 1][MaxWord + 1][ 2];