diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-07-29 10:07:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-29 10:07:52 +0200 |
commit | 7c097275c486d6e2e9b4430092600da2427e2820 (patch) | |
tree | d72a409b13417acf3879832f3a02e2438b58dc0d | |
parent | 428e71619306f5bfd72e8e0c6bed824933e5bfc0 (diff) | |
parent | fa8515d7ec160938b0287f405a43aeeca971777e (diff) |
Merge pull request #3877 from matthewbauer/develop-continuous-regex
Set regex_constants::match_continuous for quicker search in nix develop
-rw-r--r-- | src/nix/develop.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nix/develop.cc b/src/nix/develop.cc index 2f590f53f..a0c119e43 100644 --- a/src/nix/develop.cc +++ b/src/nix/develop.cc @@ -68,22 +68,22 @@ BuildEnvironment readEnvironment(const Path & path) std::smatch match; - if (std::regex_search(pos, file.cend(), match, declareRegex)) { + if (std::regex_search(pos, file.cend(), match, declareRegex, std::regex_constants::match_continuous)) { pos = match[0].second; exported.insert(match[1]); } - else if (std::regex_search(pos, file.cend(), match, varRegex)) { + else if (std::regex_search(pos, file.cend(), match, varRegex, std::regex_constants::match_continuous)) { pos = match[0].second; res.env.insert({match[1], Var { .exported = exported.count(match[1]) > 0, .value = match[2] }}); } - else if (std::regex_search(pos, file.cend(), match, assocArrayRegex)) { + else if (std::regex_search(pos, file.cend(), match, assocArrayRegex, std::regex_constants::match_continuous)) { pos = match[0].second; res.env.insert({match[1], Var { .associative = true, .value = match[2] }}); } - else if (std::regex_search(pos, file.cend(), match, functionRegex)) { + else if (std::regex_search(pos, file.cend(), match, functionRegex, std::regex_constants::match_continuous)) { res.bashFunctions = std::string(pos, file.cend()); break; } |