Regex: when in full match mode, do not accept trailing data
This commit is contained in:
parent
490c130e41
commit
75608ea223
|
@ -695,6 +695,9 @@ struct ThreadedRegexVM
|
||||||
const auto res = step(i);
|
const auto res = step(i);
|
||||||
if (res == StepResult::Matched)
|
if (res == StepResult::Matched)
|
||||||
{
|
{
|
||||||
|
if (match)
|
||||||
|
continue; // We are not at end, this is not a full match
|
||||||
|
|
||||||
m_captures = std::move(m_threads[i].saves);
|
m_captures = std::move(m_threads[i].saves);
|
||||||
found_match = true;
|
found_match = true;
|
||||||
m_threads.resize(i); // remove this and lower priority threads
|
m_threads.resize(i); // remove this and lower priority threads
|
||||||
|
@ -768,6 +771,7 @@ auto test_regex = UnitTest{[]{
|
||||||
kak_assert(vm.exec("ab"));
|
kak_assert(vm.exec("ab"));
|
||||||
kak_assert(vm.exec("aaab"));
|
kak_assert(vm.exec("aaab"));
|
||||||
kak_assert(not vm.exec("acb"));
|
kak_assert(not vm.exec("acb"));
|
||||||
|
kak_assert(not vm.exec("abc"));
|
||||||
kak_assert(not vm.exec(""));
|
kak_assert(not vm.exec(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user