add fuzzy search
This commit is contained in:
parent
9da56a412a
commit
aae1ba31ac
|
@ -63,6 +63,10 @@ typedef struct {
|
|||
|
||||
FstRegex *regexCreate(const char *str);
|
||||
|
||||
uint32_t regexAutomStart(FstRegex *regex);
|
||||
bool regexAutomIsMatch(FstRegex *regex, uint32_t state);
|
||||
bool regexAutomCanMatch(FstRegex *regex, uint32_t state, bool null);
|
||||
bool regexAutomAccept(FstRegex *regex, uint32_t state, uint8_t byte, uint32_t *result);
|
||||
// void regexSetup(FstRegex *regex, uint32_t size, const char *str);
|
||||
|
||||
// uint32_t regexStart()
|
||||
|
|
|
@ -35,3 +35,27 @@ FstRegex *regexCreate(const char *str) {
|
|||
regex->dfa = dfaBuilderBuild(builder);
|
||||
return regex;
|
||||
}
|
||||
|
||||
uint32_t regexAutomStart(FstRegex *regex) {
|
||||
///// no nothing
|
||||
return 0;
|
||||
}
|
||||
bool regexAutomIsMatch(FstRegex *regex, uint32_t state) {
|
||||
if (regex->dfa != NULL && dfaIsMatch(regex->dfa, state)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool regexAutomCanMatch(FstRegex *regex, uint32_t state, bool null) {
|
||||
// make frame happy
|
||||
return null;
|
||||
}
|
||||
|
||||
bool regexAutomAccept(FstRegex *regex, uint32_t state, uint8_t byte, uint32_t *result) {
|
||||
if (regex->dfa == NULL) {
|
||||
return false;
|
||||
}
|
||||
return dfaAccept(regex->dfa, state, byte, result);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue