eldritch horrors
b0d7a81613
clangd broke because it can't look through symlinks. compile_commands
manipulation does not fix it, clangd configuration does not fix it, a
vfs overlay does not fix it, and while a combination of those can fix
it with a bind mount in place that's just too cursed to even consider
clangd bug: https://github.com/llvm/llvm-project/issues/116877
Change-Id: I8e3e8489548eb3a7aa65ac9d12a5ec8abf814aec
20 lines
487 B
C++
20 lines
487 B
C++
#include <string>
|
|
#include <regex>
|
|
|
|
// Declared as extern in precompiled-headers.hh
|
|
template class std::basic_regex<char>;
|
|
|
|
namespace nix::regex {
|
|
std::string quoteRegexChars(const std::string & raw)
|
|
{
|
|
static auto specialRegex = std::regex(R"([.^$\\*+?()\[\]{}|])");
|
|
return std::regex_replace(raw, specialRegex, R"(\$&)");
|
|
}
|
|
|
|
std::regex storePathRegex(const std::string & storeDir)
|
|
{
|
|
return std::regex(quoteRegexChars(storeDir) + R"(/[0-9a-z]+[0-9a-zA-Z\+\-\._\?=]*)");
|
|
}
|
|
|
|
}
|