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