2014-10-13 14:12:33 +02:00
|
|
|
#include "regex.hh"
|
|
|
|
|
|
|
|
#include "exception.hh"
|
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
|
|
|
String option_to_string(const Regex& re)
|
|
|
|
{
|
2015-03-10 20:33:46 +01:00
|
|
|
const auto& str = re.str();
|
2015-04-27 17:39:51 +02:00
|
|
|
return {str.begin(), str.end()};
|
2014-10-13 14:12:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void option_from_string(StringView str, Regex& re)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
re = Regex{str.begin(), str.end()};
|
|
|
|
}
|
|
|
|
catch (RegexError& err)
|
|
|
|
{
|
|
|
|
throw runtime_error("unable to create regex: "_str + err.what());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|