return r;
}
-/* set skip map for Boyer-Moore search */
+/* set skip map for Boyer-Moore-Horspool search */
static int
set_bm_skip(UChar* s, UChar* end, OnigEncoding enc ARG_UNUSED, UChar skip[])
{
if (r != 0) return r;
reg->optimize = (allow_reverse != 0
- ? OPTIMIZE_EXACT_BM : OPTIMIZE_EXACT_BM_NO_REV);
+ ? OPTIMIZE_EXACT_BMH : OPTIMIZE_EXACT_BMH_FORWARD);
}
else {
reg->optimize = OPTIMIZE_EXACT;
static void
print_optimize_info(FILE* f, regex_t* reg)
{
- static const char* on[] = { "NONE", "EXACT", "EXACT_BM", "EXACT_BM_NOT_REV",
+ static const char* on[] = { "NONE", "EXACT",
+ "EXACT_BMH", "EXACT_BMH_FORWARD",
"EXACT_IC", "MAP" };
fprintf(f, "optimize: %s\n", on[reg->optimize]);
}
static UChar*
-bm_search_notrev(regex_t* reg, const UChar* target, const UChar* target_end,
- const UChar* text, const UChar* text_end,
- const UChar* text_range)
+bm_search_forward(regex_t* reg, const UChar* target, const UChar* target_end,
+ const UChar* text, const UChar* text_end,
+ const UChar* text_range)
{
const UChar *s, *se, *t, *p, *end;
const UChar *tail;
int skip, tlen1;
#ifdef ONIG_DEBUG_SEARCH
- fprintf(stderr, "bm_search_notrev: text: %p, text_end: %p, text_range: %p\n",
+ fprintf(stderr, "bm_search_forward: text: %p, text_end: %p, text_range: %p\n",
text, text_end, text_range);
#endif
reg->exact, reg->exact_end, p, end, range);
break;
- case OPTIMIZE_EXACT_BM:
+ case OPTIMIZE_EXACT_BMH:
p = bm_search(reg, reg->exact, reg->exact_end, p, end, range);
break;
- case OPTIMIZE_EXACT_BM_NO_REV:
- p = bm_search_notrev(reg, reg->exact, reg->exact_end, p, end, range);
+ case OPTIMIZE_EXACT_BMH_FORWARD:
+ p = bm_search_forward(reg, reg->exact, reg->exact_end, p, end, range);
break;
case OPTIMIZE_MAP:
range, adjrange, end, p);
break;
- case OPTIMIZE_EXACT_BM:
- case OPTIMIZE_EXACT_BM_NO_REV:
+ case OPTIMIZE_EXACT_BMH:
+ case OPTIMIZE_EXACT_BMH_FORWARD:
goto exact_method;
break;
/* optimize flags */
enum OptimizeType {
- OPTIMIZE_NONE = 0,
- OPTIMIZE_EXACT = 1, /* Slow Search */
- OPTIMIZE_EXACT_BM = 2, /* Boyer Moore Search */
- OPTIMIZE_EXACT_BM_NO_REV = 3, /* BM (but not simple match) */
- OPTIMIZE_EXACT_IC = 4, /* Slow Search (ignore case) */
- OPTIMIZE_MAP = 5 /* char map */
+ OPTIMIZE_NONE = 0,
+ OPTIMIZE_EXACT = 1, /* Slow Search */
+ OPTIMIZE_EXACT_BMH = 2, /* Boyer-Moore-Horspool */
+ OPTIMIZE_EXACT_BMH_FORWARD = 3, /* Boyer-Moore-Horspool (forward) */
+ OPTIMIZE_EXACT_IC = 4, /* Slow Search (ignore case) */
+ OPTIMIZE_MAP = 5 /* char map */
};
/* bit status */