1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-18 17:02:06 +03:00

Regex: small code tweak

This commit is contained in:
Maxime Coste 2017-10-04 11:28:58 +08:00
parent e0fac20f6c
commit cf5055f68b

View File

@ -282,16 +282,14 @@ struct ThreadedRegexVM
switch (step(thread, current_threads)) switch (step(thread, current_threads))
{ {
case StepResult::Matched: case StepResult::Matched:
if (not (flags & RegexExecFlags::Search) or // We are not at end, this is not a full match if (not search or // We are not at end, this is not a full match
(flags & RegexExecFlags::NotInitialNull and m_pos == m_begin)) (flags & RegexExecFlags::NotInitialNull and m_pos == m_begin))
{ {
release_saves(thread.saves); release_saves(thread.saves);
continue; continue;
} }
if (thread.saves)
m_captures = thread.saves; m_captures = thread.saves;
if (flags & RegexExecFlags::AnyMatch) if (flags & RegexExecFlags::AnyMatch)
return true; return true;
@ -325,7 +323,6 @@ struct ThreadedRegexVM
current_threads.pop_back(); current_threads.pop_back();
if (step(thread, current_threads) == StepResult::Matched) if (step(thread, current_threads) == StepResult::Matched)
{ {
if (thread.saves)
m_captures = thread.saves; m_captures = thread.saves;
return true; return true;
} }