allow _ in expr vars; tweak number matching

This commit is contained in:
Connor Olding 2016-12-01 10:31:55 -08:00
parent 63644df1bc
commit b80fb49a22
1 changed files with 3 additions and 3 deletions

View File

@ -174,9 +174,9 @@ function Expression:lex1(str, tokens)
return "bad octal number: "..considered..here
end
num = tonumber(considered:sub(2), 8)
elseif consider('#[0-9]*') then
elseif consider('#[0-9]+') then
num = tonumber(considered:sub(2))
elseif consider('[0-9]*') then
elseif consider('[0-9]+') then
num = tonumber(considered)
end
if num == nil then
@ -193,7 +193,7 @@ function Expression:lex1(str, tokens)
elseif consider_operator() then
insert(tokens, {type='operator', value=considered})
consume(#considered)
elseif consider('%w+') then
elseif consider('[%w_]+') then
local num = self.variables[considered]
if num == nil then
return 'undefined variable "'..considered..'"'