mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 22:46:16 +02:00
Merge pull request #16 from tsion/dashed-assign
Improve variable name parsing for assignments.
This commit is contained in:
commit
dc8b51754b
1 changed files with 4 additions and 2 deletions
|
@ -250,12 +250,14 @@ static int runProgram(const string & program, const Strings & args)
|
|||
|
||||
bool isVarName(const string & s)
|
||||
{
|
||||
// FIXME: not quite correct.
|
||||
if (s.size() == 0) return false;
|
||||
char c = s[0];
|
||||
if ((c >= '0' && c <= '9') || c == '-' || c == '\'') return false;
|
||||
for (auto & i : s)
|
||||
if (!((i >= 'a' && i <= 'z') ||
|
||||
(i >= 'A' && i <= 'Z') ||
|
||||
(i >= '0' && i <= '9') ||
|
||||
i == '_' || i == '\''))
|
||||
i == '_' || i == '-' || i == '\''))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue