mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 14:36:16 +02:00
f4ab297b31
`///@file` makes them show up in the internal API dos. A tiny few were missing `#pragma once`.
31 lines
638 B
C++
31 lines
638 B
C++
#pragma once
|
|
///@file
|
|
|
|
#include <string_view>
|
|
|
|
namespace nix::regex {
|
|
|
|
// TODO use constexpr string building like
|
|
// https://github.com/akrzemi1/static_string/blob/master/include/ak_toolkit/static_string.hpp
|
|
|
|
static inline std::string either(std::string_view a, std::string_view b)
|
|
{
|
|
return std::string { a } + "|" + b;
|
|
}
|
|
|
|
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 + ")*";
|
|
}
|
|
|
|
static inline std::string list(std::string_view a)
|
|
{
|
|
return std::string { a } + many(group("," + a));
|
|
}
|
|
|
|
}
|