1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 16:51:15 +02:00

regex-combinators: fix linter error when adding string_view and string

This commit is contained in:
Jörg Thalheim 2024-12-16 12:47:20 +00:00
parent 3392a96901
commit 6848154b2e

View file

@ -3,6 +3,7 @@
#include <string_view>
#include <string>
#include <sstream>
namespace nix::regex {
@ -11,22 +12,23 @@ namespace nix::regex {
static inline std::string either(std::string_view a, std::string_view b)
{
return std::string { a } + "|" + b;
std::stringstream ss;
ss << a << "|" << b;
return ss.str();
}
static inline std::string group(std::string_view a)
{
return std::string { "(" } + a + ")";
}
static inline std::string many(std::string_view a)
{
return std::string { "(?:" } + a + ")*";
std::stringstream ss;
ss << "(" << a << ")";
return ss.str();
}
static inline std::string list(std::string_view a)
{
return std::string { a } + many(group("," + a));
std::stringstream ss;
ss << a << "(," << a << ")*";
return ss.str();
}
}