Skip to content

Commit

Permalink
Merge pull request #16 from tsion/dashed-assign
Browse files Browse the repository at this point in the history
Improve variable name parsing for assignments.
  • Loading branch information
edolstra committed Feb 15, 2016
2 parents 8a2f5f0 + f30fd9c commit dc8b517
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nix-repl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit dc8b517

Please sign in to comment.