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

add 0o and 0b prefixes for lexing octal and binary

This commit is contained in:
Connor Olding 2016-04-20 01:16:19 -07:00
parent 67ce15feee
commit 7af890c3b5

View file

@ -147,6 +147,14 @@ function Lexer:read_number()
self:nextc()
self:nextc()
return self:read_hex()
elseif self.chr2 == 'o' then
self:nextc()
self:nextc()
return self:read_octal()
elseif self.chr2 == 'b' then
self:nextc()
self:nextc()
return self:read_binary()
elseif self.chr == '0' and self.chr2:find('%d') then
self:nextc()
return self:read_octal()