colorize_regex_factory: transform boost::regex_error in Kakoune::runtime_error
This commit is contained in:
parent
c166bc92e3
commit
661c9db925
|
@ -96,9 +96,8 @@ HighlighterAndId colorize_regex_factory(Window& window,
|
|||
if (params.size() < 2)
|
||||
throw runtime_error("wrong parameter count");
|
||||
|
||||
Regex ex(params[0].begin(), params[0].end(),
|
||||
boost::regex::perl | boost::regex::optimize);
|
||||
|
||||
try
|
||||
{
|
||||
static Regex color_spec_ex(LR"((\d+):(\w+)(,(\w+))?)");
|
||||
ColorSpec colors;
|
||||
for (auto it = params.begin() + 1; it != params.end(); ++it)
|
||||
|
@ -118,8 +117,16 @@ HighlighterAndId colorize_regex_factory(Window& window,
|
|||
|
||||
String id = "colre'" + params[0] + "'";
|
||||
|
||||
Regex ex(params[0].begin(), params[0].end(),
|
||||
boost::regex::perl | boost::regex::optimize);
|
||||
|
||||
return HighlighterAndId(id, std::bind(colorize_regex, _1, ex,
|
||||
std::move(colors)));
|
||||
}
|
||||
catch (boost::regex_error& err)
|
||||
{
|
||||
throw runtime_error(String("regex error: ") + err.what());
|
||||
}
|
||||
}
|
||||
|
||||
void expand_tabulations(Window& window, DisplayBuffer& display_buffer)
|
||||
|
|
Loading…
Reference in New Issue
Block a user