1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-24 07:53:41 +03:00

Code style tweak for Regex implementation TestVM

This commit is contained in:
Maxime Coste 2021-07-31 08:55:52 +10:00
parent 52087a506d
commit b57dc7c512

View File

@ -1241,17 +1241,14 @@ namespace
template<RegexMode mode = RegexMode::Forward> template<RegexMode mode = RegexMode::Forward>
struct TestVM : CompiledRegex, ThreadedRegexVM<const char*, mode> struct TestVM : CompiledRegex, ThreadedRegexVM<const char*, mode>
{ {
using VMType = ThreadedRegexVM<const char*, mode>; TestVM(StringView re)
: CompiledRegex{compile_regex(re, mode & RegexMode::Forward ? RegexCompileFlags::None : RegexCompileFlags::Backward)},
TestVM(StringView re, bool dump = false) TestVM::ThreadedRegexVM{static_cast<const CompiledRegex&>(*this)}
: CompiledRegex{compile_regex(re, mode & RegexMode::Forward ? {}
RegexCompileFlags::None : RegexCompileFlags::Backward)},
VMType{(const CompiledRegex&)*this}
{ if (dump) puts(dump_regex(*this).c_str()); }
bool exec(StringView re, RegexExecFlags flags = RegexExecFlags::None) bool exec(StringView re, RegexExecFlags flags = RegexExecFlags::None)
{ {
return VMType::exec(re.begin(), re.end(), re.begin(), re.end(), flags); return TestVM::ThreadedRegexVM::exec(re.begin(), re.end(), re.begin(), re.end(), flags);
} }
}; };
} }