mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-19 01:11:36 +03:00
Regex: Remove static RegexCompiler::compile
This commit is contained in:
parent
52ee62172a
commit
071b897e00
@ -513,14 +513,9 @@ struct RegexCompiler
|
|||||||
|
|
||||||
CompiledRegex get_compiled_regex() { return std::move(m_program); }
|
CompiledRegex get_compiled_regex() { return std::move(m_program); }
|
||||||
|
|
||||||
|
private:
|
||||||
using Offset = CompiledRegex::Offset;
|
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)
|
Offset compile_node_inner(const ParsedRegex::AstNodePtr& node)
|
||||||
{
|
{
|
||||||
const auto start_pos = m_program.bytecode.size();
|
const auto start_pos = m_program.bytecode.size();
|
||||||
@ -871,14 +866,14 @@ void dump_regex(const CompiledRegex& program)
|
|||||||
|
|
||||||
CompiledRegex compile_regex(StringView re)
|
CompiledRegex compile_regex(StringView re)
|
||||||
{
|
{
|
||||||
return RegexCompiler::compile(re);
|
return RegexCompiler{RegexParser::parse(re)}.get_compiled_regex();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto test_regex = UnitTest{[]{
|
auto test_regex = UnitTest{[]{
|
||||||
struct TestVM : CompiledRegex, ThreadedRegexVM<const char*>
|
struct TestVM : CompiledRegex, ThreadedRegexVM<const char*>
|
||||||
{
|
{
|
||||||
TestVM(StringView re, bool dump = false)
|
TestVM(StringView re, bool dump = false)
|
||||||
: CompiledRegex{RegexCompiler::compile(re)},
|
: CompiledRegex{compile_regex(re)},
|
||||||
ThreadedRegexVM{(const CompiledRegex&)*this}
|
ThreadedRegexVM{(const CompiledRegex&)*this}
|
||||||
{ if (dump) dump_regex(*this); }
|
{ if (dump) dump_regex(*this); }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user