mirror of
https://github.com/NixOS/nix.git
synced 2025-11-10 12:36:01 +01:00
Move /src to /subprojects
This will facilitate breaking up Nix into multiple packages for each component with Meson.
This commit is contained in:
parent
4db9487823
commit
84e2963f8e
737 changed files with 504 additions and 505 deletions
31
subprojects/libutil/regex-combinators.hh
Normal file
31
subprojects/libutil/regex-combinators.hh
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#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));
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue