Merge pull request #1058 from andralex/5726

Issue 5726 - boyerMooreFinder hangs when finding
This commit is contained in:
Alex Rønne Petersen 2013-01-08 01:00:30 -08:00
commit 10d28218d8

View file

@ -3979,7 +3979,7 @@ public:
if (npos == 0) return haystack[hpos .. $];
--npos;
}
hpos += max(skip[npos], npos - occurrence(haystack[npos+hpos]));
hpos += max(skip[npos], cast(sizediff_t) npos - occurrence(haystack[npos+hpos]));
}
return haystack[$ .. $];
}
@ -4027,6 +4027,13 @@ unittest
assert(find(b, boyerMooreFinder(a)).empty);
}
unittest
{
auto bm = boyerMooreFinder("for");
auto match = find("Moor", bm);
assert(match.empty);
}
/**
Advances the input range $(D haystack) by calling $(D haystack.popFront)
until either $(D pred(haystack.front)), or $(D