home/src/regex.cc
Maxime Coste 413f880e9e Regex: Support forward and backward matching code in the same CompiledRegex
No need to have two separate regexes to handle forward and backward
matching, just passing RegexCompileFlags::Backward will add support
for backward matching to the regex. For backward only regex, pass
RegexCompileFlags::NoForward as well to disable generation of
forward matching code.
2017-12-01 19:57:02 +08:00

22 lines
326 B
C++

#include "regex.hh"
namespace Kakoune
{
Regex::Regex(StringView re, RegexCompileFlags flags)
: m_impl{new CompiledRegex{compile_regex(re, flags)}},
m_str{re.str()}
{}
String option_to_string(const Regex& re)
{
return re.str();
}
void option_from_string(StringView str, Regex& re)
{
re = Regex{str};
}
}