1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 10:31:15 +02:00

Move hiliteMatches into a separate header

This is mostly so that we don't #include <regex> everywhere (which
adds quite a bit of compilation time).
This commit is contained in:
Eelco Dolstra 2022-04-21 11:58:40 +02:00
parent 684e679e07
commit f05e1f6fbb
4 changed files with 22 additions and 16 deletions

20
src/libutil/hilite.hh Normal file
View file

@ -0,0 +1,20 @@
#pragma once
#include <regex>
#include <vector>
#include <string>
namespace nix {
/* Highlight all the given matches in the given string `s` by wrapping
them between `prefix` and `postfix`.
If some matches overlap, then their union will be wrapped rather
than the individual matches. */
std::string hiliteMatches(
std::string_view s,
std::vector<std::smatch> matches,
std::string_view prefix,
std::string_view postfix);
}