Regex: Fix handling of non capturing groups (?:...)

We were wrongly keeping the `:` as a literal content of the group
This commit is contained in:
Maxime Coste 2017-10-04 22:30:22 +08:00
parent 5f6e71c4dc
commit f1b4931824

View File

@ -189,7 +189,10 @@ private:
{
auto c = advance();
if (c == ':')
{
++m_pos;
content = disjunction(-1);
}
else if (contains("=!<", c))
{
bool behind = false;
@ -1005,6 +1008,12 @@ auto test_regex = UnitTest{[]{
kak_assert(not vm.exec("a]c"));
kak_assert(vm.exec("abc"));
}
{
TestVM vm{R"((?:foo)+)"};
kak_assert(vm.exec("foofoofoo"));
kak_assert(not vm.exec("barbarbar"));
}
}};
}