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

fix data collection, expect EOLs for all directives

This commit is contained in:
Connor Olding 2016-04-23 02:10:38 -07:00
parent 87c210d617
commit 33ea629309

View file

@ -102,16 +102,13 @@ function Collector:directive()
self:optional_comma()
add(name, size, self:number())
end
self:expect_EOL()
end
elseif name == 'BYTE' or name == 'HALFWORD' or name == 'WORD' then
self:push_data(self:const().tok, name)
while not self:is_EOL() do
self:advance()
self:optional_comma()
self:push_data(self:const().tok, name)
end
self:expect_EOL()
elseif name == 'INC' or name == 'INCBIN' then
-- noop, handled by lexer
elseif name == 'ASCII' or name == 'ASCIIZ' then
@ -122,12 +119,12 @@ function Collector:directive()
if name == 'ASCIIZ' then
self:push_data(0, 'BYTE')
end
self:expect_EOL()
elseif name == 'FLOAT' then
self:error('unimplemented directive', name)
else
self:error('unknown directive', name)
end
self:expect_EOL()
end
function Collector:basic_special()