20#ifndef GCC_SPELLCHECK_H
21#define GCC_SPELLCHECK_H
29 const char *t,
int len_t);
48template <
typename TYPE>
70 size_t candidate_len);
82template <
typename GOAL_TYPE,
typename CANDIDATE_TYPE>
107 size_t candidate_len = candidate_traits::get_length (
candidate);
113 = abs ((ssize_t)candidate_len - (ssize_t)
m_goal_len);
127 if (min_candidate_distance > cutoff)
132 const char *candidate_str = candidate_traits::get_string (
candidate);
136 bool is_better =
false;
149 if (candidate_str[candidate_len - 1] ==
'='
168 size_t best_candidate_len)
181 return ::get_edit_distance_cutoff (
m_goal_len, candidate_len);
Definition spellcheck.h:84
size_t get_best_candidate_length() const
Definition spellcheck.h:219
edit_distance_t m_best_distance
Definition spellcheck.h:225
const char * m_goal
Definition spellcheck.h:222
candidate_t get_best_meaningful_candidate() const
Definition spellcheck.h:188
best_match(GOAL_TYPE goal, edit_distance_t best_distance_so_far=MAX_EDIT_DISTANCE)
Definition spellcheck.h:93
edit_distance_t get_cutoff(size_t candidate_len) const
Definition spellcheck.h:179
edit_distance_t get_best_distance() const
Definition spellcheck.h:218
GOAL_TYPE goal_t
Definition spellcheck.h:86
size_t m_goal_len
Definition spellcheck.h:223
edit_distance_traits< goal_t > goal_traits
Definition spellcheck.h:88
size_t m_best_candidate_len
Definition spellcheck.h:226
void consider(candidate_t candidate)
Definition spellcheck.h:105
CANDIDATE_TYPE candidate_t
Definition spellcheck.h:87
candidate_t m_best_candidate
Definition spellcheck.h:224
edit_distance_traits< candidate_t > candidate_traits
Definition spellcheck.h:89
void set_best_so_far(CANDIDATE_TYPE best_candidate, edit_distance_t best_distance, size_t best_candidate_len)
Definition spellcheck.h:166
candidate_t blithely_get_best_candidate() const
Definition spellcheck.h:213
#define UINT_MAX
Definition glimits.h:89
edit_distance_t get_edit_distance(const char *s, int len_s, const char *t, int len_t)
Definition spellcheck.cc:46
edit_distance_t get_edit_distance_cutoff(size_t goal_len, size_t candidate_len)
Definition spellcheck.cc:188
unsigned int edit_distance_t
Definition spellcheck.h:23
const edit_distance_t MAX_EDIT_DISTANCE
Definition spellcheck.h:24
const char * find_closest_string(const char *target, const auto_vec< const char * > *candidates)
Definition spellcheck.cc:162
static size_t get_length(const char *str)
Definition spellcheck.h:56
static const char * get_string(const char *str)
Definition spellcheck.h:62
Definition spellcheck.h:49
#define NULL
Definition system.h:50
#define gcc_assert(EXPR)
Definition system.h:814
static tree candidate(unsigned uid)
Definition tree-sra.cc:325
static hash_table< uid_decl_hasher > * candidates
Definition tree-sra.cc:320