diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2013-03-29 19:31:06 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2013-03-29 19:35:48 +0100 |
| commit | a80cee0d2c1b18e2de5c90442812a325f151532a (patch) | |
| tree | 183a47cca303ea6eea59d4afe9ee4c6a8164fbd1 /src/string.cc | |
| parent | 4b3067f8d018563e94e007af42b9b036a186d57a (diff) | |
Add support for tuple Options, implement LineAndFlag using that
Diffstat (limited to 'src/string.cc')
| -rw-r--r-- | src/string.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/string.cc b/src/string.cc index 8664ce16..a5981f94 100644 --- a/src/string.cc +++ b/src/string.cc @@ -1,4 +1,5 @@ #include "string.hh" +#include "exception.hh" namespace Kakoune { @@ -55,4 +56,21 @@ String String::replace(const String& expression, return String(boost::regex_replace(*this, re, replacement)); } +String option_to_string(const Regex& re) +{ + return String{re.str()}; +} + +void option_from_string(const String& str, Regex& re) +{ + try + { + re = Regex{str.begin(), str.end()}; + } + catch (boost::regex_error& err) + { + throw runtime_error("unable to create regex: "_str + err.what()); + } +} + } |
