home/src/regex.cc

28 lines
511 B
C++
Raw Normal View History

#include "regex.hh"
#include "exception.hh"
#include "regex_impl.hh"
namespace Kakoune
{
using Utf8It = RegexUtf8It<const char*>;
Regex::Regex(StringView re, flag_type flags) try
: RegexBase{Utf8It{re.begin(), re}, Utf8It{re.end(), re}, flags}, m_str{re.str()}
{
validate_regex(re);
} catch (std::runtime_error& err) { throw regex_error(err.what()); }
String option_to_string(const Regex& re)
{
2016-02-05 00:52:06 +01:00
return re.str();
}
void option_from_string(StringView str, Regex& re)
{
2015-07-25 12:15:03 +02:00
re = Regex{str};
}
}