Regex: Fix computation of potential starts for lookaheads

This commit is contained in:
Maxime Coste 2017-10-08 19:03:38 +08:00
parent 34b1f1ccb6
commit db06acdfab

View File

@ -745,12 +745,12 @@ private:
case ParsedRegex::ResetStart:
return true;
case ParsedRegex::LookAhead:
if (node->children.empty())
if (not node->children.empty())
compute_start_chars(m_forward ? node->children.front() : node->children.back(),
accepted, rejected);
return true;
case ParsedRegex::NegativeLookAhead:
if (node->children.empty())
if (not node->children.empty())
compute_start_chars(m_forward ? node->children.front() : node->children.back(),
rejected, accepted);
return true;
@ -1124,6 +1124,11 @@ auto test_regex = UnitTest{[]{
kak_assert(vm.exec("# foo bar", RegexExecFlags::Search));
kak_assert(*vm.captures()[0] == '#');
}
{
TestVM<> vm{R"((?=))"};
kak_assert(vm.exec(""));
}
}};
}