aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/hilite.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/hilite.hh')
-rw-r--r--src/libutil/hilite.hh20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libutil/hilite.hh b/src/libutil/hilite.hh
new file mode 100644
index 000000000..f8bdbfc55
--- /dev/null
+++ b/src/libutil/hilite.hh
@@ -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);
+
+}