summaryrefslogtreecommitdiff
path: root/src/regex.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-10-09 14:37:43 +0800
committerMaxime Coste <mawww@kakoune.org>2017-11-01 14:05:14 +0800
commit785cd34b4bf911ad98af3c27c21f281319e1825b (patch)
treee9e5c161d145f88807e6ae7babea7fca7316d0a3 /src/regex.cc
parent065bbc8f5903c39a7ed4cca60d721dc92741154a (diff)
Regex: Make boost checking disableable at compile time
Diffstat (limited to 'src/regex.cc')
-rw-r--r--src/regex.cc23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/regex.cc b/src/regex.cc
index f7ba0e48..8809757a 100644
--- a/src/regex.cc
+++ b/src/regex.cc
@@ -1,10 +1,13 @@
#include "regex.hh"
+#ifdef REGEX_CHECK_WITH_BOOST
#include "buffer_utils.hh"
+#endif
namespace Kakoune
{
+#ifdef REGEX_CHECK_WITH_BOOST
using Utf8It = RegexUtf8It<const char*>;
boost::regbase::flag_type convert_flags(RegexCompileFlags flags)
@@ -41,12 +44,19 @@ boost::regex_constants::match_flag_type convert_flags(RegexExecFlags flags)
return res;
}
+void regex_mismatch(const Regex& re)
+{
+ write_to_debug_buffer(format("regex mismatch for '{}'", re.str()));
+}
+#endif
+
Regex::Regex(StringView re, RegexCompileFlags flags) try
: m_impl{new CompiledRegex{compile_regex(re, flags)}},
- m_str{re.str()},
- m_boost_impl{Utf8It{re.begin(), re}, Utf8It{re.end(), re}, convert_flags(flags)}
-{
-} catch (std::runtime_error& err) { throw regex_error(err.what()); }
+ m_str{re.str()}
+#ifdef REGEX_CHECK_WITH_BOOST
+ , m_boost_impl{Utf8It{re.begin(), re}, Utf8It{re.end(), re}, convert_flags(flags)}
+#endif
+{} catch (std::runtime_error& err) { throw regex_error(err.what()); }
String option_to_string(const Regex& re)
{
@@ -58,9 +68,4 @@ void option_from_string(StringView str, Regex& re)
re = Regex{str};
}
-void regex_mismatch(const Regex& re)
-{
- write_to_debug_buffer(format("regex mismatch for '{}'", re.str()));
-}
-
}