Merge pull request #16 from tsion/dashed-assign

Improve variable name parsing for assignments.
This commit is contained in:
Eelco Dolstra 2016-02-15 10:25:45 +01:00
commit dc8b51754b

View file

@ -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;
}