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

fix parsing of 0 in expressions

This commit is contained in:
Connor Olding 2016-11-27 21:25:57 -08:00
parent ab493693a9
commit 6bae5647c8

View file

@ -154,9 +154,12 @@ function Expression:lex1(str, tokens)
num = tonumber(considered, 2)
elseif consider('0x[0-9A-Fa-f]+') then
num = tonumber(considered, 16)
elseif consider('0[0-7]+') then
elseif consider('0[0-9]+') then
if considered:match('[89]') then
return "bad octal number: "..considered..here
end
num = tonumber(considered, 8)
elseif consider('[1-9][0-9]*') then
elseif consider('[0-9]*') then
num = tonumber(considered)
end
if num == nil then