Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
url-parts.hh
Go to the documentation of this file.
1#pragma once
3
4#include <string>
5#include <regex>
6
7namespace nix {
8
9// URI stuff.
10static const std::string pctEncoded = "(?:%[0-9a-fA-F][0-9a-fA-F])";
11static const std::string unreservedRegex = "(?:[a-zA-Z0-9-._~])";
12static const std::string subdelimsRegex = "(?:[!$&'\"()*+,;=])";
13static const std::string pcharRegex = "(?:" + unreservedRegex + "|" + pctEncoded + "|" + subdelimsRegex + "|[:@])";
14static const std::string fragmentRegex = "(?:" + pcharRegex + "|[/? \"^])*";
15
19static const std::string refRegexS = "[a-zA-Z0-9@][a-zA-Z0-9_.\\/@+-]*";
20extern std::regex refRegex;
21
23static const std::string revRegexS = "[0-9a-fA-F]{40}";
24extern std::regex revRegex;
25
27static const std::string refAndOrRevRegex = "(?:(" + revRegexS + ")|(?:(" + refRegexS + ")(?:/(" + revRegexS + "))?))";
28
29} // namespace nix