forked from lix-project/lix
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)
|
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)
|
for (auto & i : s)
|
||||||
if (!((i >= 'a' && i <= 'z') ||
|
if (!((i >= 'a' && i <= 'z') ||
|
||||||
(i >= 'A' && i <= 'Z') ||
|
(i >= 'A' && i <= 'Z') ||
|
||||||
(i >= '0' && i <= '9') ||
|
(i >= '0' && i <= '9') ||
|
||||||
i == '_' || i == '\''))
|
i == '_' || i == '-' || i == '\''))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue