From 071b897e008004031a0cff887f3642abe81fcfa3 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 7 Oct 2017 10:57:24 +0800 Subject: [PATCH] Regex: Remove static RegexCompiler::compile --- src/regex_impl.cc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/regex_impl.cc b/src/regex_impl.cc index 0c40b21e..c0a9371a 100644 --- a/src/regex_impl.cc +++ b/src/regex_impl.cc @@ -513,14 +513,9 @@ struct RegexCompiler CompiledRegex get_compiled_regex() { return std::move(m_program); } +private: using Offset = CompiledRegex::Offset; - static CompiledRegex compile(StringView re) - { - return RegexCompiler{RegexParser::parse(re)}.get_compiled_regex(); - } - -private: Offset compile_node_inner(const ParsedRegex::AstNodePtr& node) { const auto start_pos = m_program.bytecode.size(); @@ -871,14 +866,14 @@ void dump_regex(const CompiledRegex& program) CompiledRegex compile_regex(StringView re) { - return RegexCompiler::compile(re); + return RegexCompiler{RegexParser::parse(re)}.get_compiled_regex(); } auto test_regex = UnitTest{[]{ struct TestVM : CompiledRegex, ThreadedRegexVM { TestVM(StringView re, bool dump = false) - : CompiledRegex{RegexCompiler::compile(re)}, + : CompiledRegex{compile_regex(re)}, ThreadedRegexVM{(const CompiledRegex&)*this} { if (dump) dump_regex(*this); }