-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't include <regex> in header files
This reduces compilation time by ~15 seconds (CPU time). Issue #4045.
- Loading branch information
Showing
16 changed files
with
96 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#include "lockfile.hh" | ||
#include "store-api.hh" | ||
#include "url-parts.hh" | ||
|
||
#include <nlohmann/json.hpp> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#include "fetchers.hh" | ||
#include "url-parts.hh" | ||
|
||
namespace nix::fetchers { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
#include <regex> | ||
|
||
namespace nix { | ||
|
||
// URI stuff. | ||
const static std::string pctEncoded = "(?:%[0-9a-fA-F][0-9a-fA-F])"; | ||
const static std::string schemeRegex = "(?:[a-z+.-]+)"; | ||
const static std::string ipv6AddressRegex = "(?:\\[[0-9a-fA-F:]+\\])"; | ||
const static std::string unreservedRegex = "(?:[a-zA-Z0-9-._~])"; | ||
const static std::string subdelimsRegex = "(?:[!$&'\"()*+,;=])"; | ||
const static std::string hostnameRegex = "(?:(?:" + unreservedRegex + "|" + pctEncoded + "|" + subdelimsRegex + ")*)"; | ||
const static std::string hostRegex = "(?:" + ipv6AddressRegex + "|" + hostnameRegex + ")"; | ||
const static std::string userRegex = "(?:(?:" + unreservedRegex + "|" + pctEncoded + "|" + subdelimsRegex + "|:)*)"; | ||
const static std::string authorityRegex = "(?:" + userRegex + "@)?" + hostRegex + "(?::[0-9]+)?"; | ||
const static std::string pcharRegex = "(?:" + unreservedRegex + "|" + pctEncoded + "|" + subdelimsRegex + "|[:@])"; | ||
const static std::string queryRegex = "(?:" + pcharRegex + "|[/? \"])*"; | ||
const static std::string segmentRegex = "(?:" + pcharRegex + "+)"; | ||
const static std::string absPathRegex = "(?:(?:/" + segmentRegex + ")*/?)"; | ||
const static std::string pathRegex = "(?:" + segmentRegex + "(?:/" + segmentRegex + ")*/?)"; | ||
|
||
// A Git ref (i.e. branch or tag name). | ||
const static std::string refRegexS = "[a-zA-Z0-9][a-zA-Z0-9_.-]*"; // FIXME: check | ||
extern std::regex refRegex; | ||
|
||
// Instead of defining what a good Git Ref is, we define what a bad Git Ref is | ||
// This is because of the definition of a ref in refs.c in https://github.com/git/git | ||
// See tests/fetchGitRefs.sh for the full definition | ||
const static std::string badGitRefRegexS = "//|^[./]|/\\.|\\.\\.|[[:cntrl:][:space:]:?^~\[]|\\\\|\\*|\\.lock$|\\.lock/|@\\{|[/.]$|^@$|^$"; | ||
extern std::regex badGitRefRegex; | ||
|
||
// A Git revision (a SHA-1 commit hash). | ||
const static std::string revRegexS = "[0-9a-fA-F]{40}"; | ||
extern std::regex revRegex; | ||
|
||
// A ref or revision, or a ref followed by a revision. | ||
const static std::string refAndOrRevRegex = "(?:(" + revRegexS + ")|(?:(" + refRegexS + ")(?:/(" + revRegexS + "))?))"; | ||
|
||
const static std::string flakeIdRegexS = "[a-zA-Z][a-zA-Z0-9_-]*"; | ||
extern std::regex flakeIdRegex; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#include "url.hh" | ||
#include "url-parts.hh" | ||
#include "util.hh" | ||
|
||
namespace nix { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters