diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-12-08 22:40:54 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2020-12-11 18:58:13 +0300 |
commit | cb558e4bd2b817bc72275c2bbd90dfe9fe380af9 (patch) | |
tree | 83bb92e3dc8a7744b30a9c9cfd12106780f24691 /libbuild2/script/parser.cxx | |
parent | ff0bf71889b041be794e8bd47d5be57f6eb07ad1 (diff) |
Add export script pseudo-builtin
Diffstat (limited to 'libbuild2/script/parser.cxx')
-rw-r--r-- | libbuild2/script/parser.cxx | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/libbuild2/script/parser.cxx b/libbuild2/script/parser.cxx index b4184ea..41d3092 100644 --- a/libbuild2/script/parser.cxx +++ b/libbuild2/script/parser.cxx @@ -1437,36 +1437,22 @@ namespace build2 } else if (optional<string> v = str ("--unset", "-u")) { - if (v->find ('=') != string::npos) - fail (i->second) << "env: invalid value '" << *v << "' for " - << "option '" << o << "': contains '='"; + verify_environment_var_name (*v, o.c_str (), "env: ", i->second); - r.variables.push_back (move (*v)); + r.variables.add (move (*v)); } else break; } - // Parse the variable sets (from arguments). + // Parse arguments (variable sets). // for (; i != e; ++i) { string& a (i->first); + verify_environment_var_assignment (a, "env: ", i->second); - // Validate the variable assignment. - // - size_t p (a.find ('=')); - - if (p == string::npos) - fail (i->second) - << "env: expected variable assignment instead of '" << a << "'"; - - if (p == 0) - fail (i->second) << "env: empty variable name"; - - // Add the variable set to the resulting list. - // - r.variables.push_back (move (a)); + r.variables.add (move (a)); } return r; |