mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-18 17:02:06 +03:00
Regex: use StartDesc to early out when not searching
Early out as well if we do not find any potential start position.
This commit is contained in:
parent
65b057f261
commit
8d892eeb62
@ -183,8 +183,18 @@ public:
|
||||
|
||||
const bool search = (flags & RegexExecFlags::Search);
|
||||
Utf8It start{m_begin};
|
||||
if (search and m_program.start_desc)
|
||||
to_next_start(start, m_end, *m_program.start_desc);
|
||||
if (m_program.start_desc)
|
||||
{
|
||||
if (search)
|
||||
{
|
||||
to_next_start(start, m_end, *m_program.start_desc);
|
||||
if (start == m_end) // If start_desc is not null, it means we consume at least one char
|
||||
return false;
|
||||
}
|
||||
else if (start != m_end and
|
||||
not m_program.start_desc->map[std::min(*start, CompiledRegex::StartDesc::other)])
|
||||
return false;
|
||||
}
|
||||
|
||||
return exec_program(start, Thread{&m_program.instructions[search ? 0 : CompiledRegex::search_prefix_size], nullptr});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user