Regex: Fix computation of potential starts for lookaheads
This commit is contained in:
parent
34b1f1ccb6
commit
db06acdfab
|
@ -745,12 +745,12 @@ private:
|
||||||
case ParsedRegex::ResetStart:
|
case ParsedRegex::ResetStart:
|
||||||
return true;
|
return true;
|
||||||
case ParsedRegex::LookAhead:
|
case ParsedRegex::LookAhead:
|
||||||
if (node->children.empty())
|
if (not node->children.empty())
|
||||||
compute_start_chars(m_forward ? node->children.front() : node->children.back(),
|
compute_start_chars(m_forward ? node->children.front() : node->children.back(),
|
||||||
accepted, rejected);
|
accepted, rejected);
|
||||||
return true;
|
return true;
|
||||||
case ParsedRegex::NegativeLookAhead:
|
case ParsedRegex::NegativeLookAhead:
|
||||||
if (node->children.empty())
|
if (not node->children.empty())
|
||||||
compute_start_chars(m_forward ? node->children.front() : node->children.back(),
|
compute_start_chars(m_forward ? node->children.front() : node->children.back(),
|
||||||
rejected, accepted);
|
rejected, accepted);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1124,6 +1124,11 @@ auto test_regex = UnitTest{[]{
|
||||||
kak_assert(vm.exec("# foo bar", RegexExecFlags::Search));
|
kak_assert(vm.exec("# foo bar", RegexExecFlags::Search));
|
||||||
kak_assert(*vm.captures()[0] == '#');
|
kak_assert(*vm.captures()[0] == '#');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
TestVM<> vm{R"((?=))"};
|
||||||
|
kak_assert(vm.exec(""));
|
||||||
|
}
|
||||||
}};
|
}};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user