1
0
Fork 0
mirror of https://github.com/notwa/lips synced 2024-11-14 14:49:03 -08:00

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

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..'"'