mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-27 08:16:14 +02:00
nix dev-shell: Improve bash output parsing
Fixes handling of '=' in unquoted strings and escaped characters in $'...' strings.
This commit is contained in:
parent
2c1e05ae93
commit
8d2eb1ff56
1 changed files with 4 additions and 2 deletions
|
@ -29,6 +29,8 @@ BuildEnvironment readEnvironment(const Path & path)
|
|||
|
||||
std::set<std::string> exported;
|
||||
|
||||
debug("reading environment file '%s'", path);
|
||||
|
||||
auto file = readFile(path);
|
||||
|
||||
auto pos = file.cbegin();
|
||||
|
@ -41,10 +43,10 @@ BuildEnvironment readEnvironment(const Path & path)
|
|||
R"re((?:="((?:[^"\\]|\\.)*)")?\n)re");
|
||||
|
||||
static std::string simpleStringRegex =
|
||||
R"re((?:[a-zA-Z0-9_/:\.\-1\+]*))re";
|
||||
R"re((?:[a-zA-Z0-9_/:\.\-\+=]*))re";
|
||||
|
||||
static std::string quotedStringRegex =
|
||||
R"re((?:\$?'[^']*'))re";
|
||||
R"re((?:\$?'(?:[^'\\]|\\[abeEfnrtv\\'"?])*'))re";
|
||||
|
||||
static std::string arrayRegex =
|
||||
R"re((?:\(( *\[[^\]]+\]="(?:[^"\\]|\\.)*")*\)))re";
|
||||
|
|
Loading…
Reference in a new issue