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

implement SPACE,HALF directive aliases

This commit is contained in:
Connor Olding 2016-01-13 11:41:00 -08:00
parent a47c924e75
commit f8805e6deb
2 changed files with 13 additions and 4 deletions

View file

@ -335,8 +335,11 @@ function Lexer:lex(_yield)
self:nextc()
local buff = self:read_chars('[%w]')
local up = buff:upper()
if data.directive_aliases[up] then
up = data.directive_aliases[up]
end
if not data.all_directives[up] then
self:error('not a directive')
self:error('unknown directive')
end
if up == 'INC' or up == 'INCASM' or up == 'INCLUDE' then
yield('DIR', 'INC')

View file

@ -29,13 +29,19 @@ data.fpu_registers = {
}
data.all_directives = {
'ALIGN', 'SKIP',
'ORG', 'ALIGN', 'SKIP',
'ASCII', 'ASCIIZ',
'BYTE', 'HALFWORD', 'WORD', 'FLOAT',
'BYTE', 'HALFWORD', 'WORD',
--'HEX', -- excluded here due to different syntax
'INC', 'INCASM', 'INCLUDE',
'INCBIN',
'ORG',
-- these are unlikely to be implemented
'FLOAT', 'DOUBLE',
}
data.directive_aliases = {
SPACE = 'SKIP',
HALF = 'HALFWORD',
}
data.all_registers = {}