mirror of
https://github.com/notwa/lips
synced 2024-05-18 16:33:22 -07:00
implement SPACE,HALF directive aliases
This commit is contained in:
parent
a47c924e75
commit
f8805e6deb
|
@ -335,8 +335,11 @@ function Lexer:lex(_yield)
|
||||||
self:nextc()
|
self:nextc()
|
||||||
local buff = self:read_chars('[%w]')
|
local buff = self:read_chars('[%w]')
|
||||||
local up = buff:upper()
|
local up = buff:upper()
|
||||||
|
if data.directive_aliases[up] then
|
||||||
|
up = data.directive_aliases[up]
|
||||||
|
end
|
||||||
if not data.all_directives[up] then
|
if not data.all_directives[up] then
|
||||||
self:error('not a directive')
|
self:error('unknown directive')
|
||||||
end
|
end
|
||||||
if up == 'INC' or up == 'INCASM' or up == 'INCLUDE' then
|
if up == 'INC' or up == 'INCASM' or up == 'INCLUDE' then
|
||||||
yield('DIR', 'INC')
|
yield('DIR', 'INC')
|
||||||
|
|
|
@ -29,13 +29,19 @@ data.fpu_registers = {
|
||||||
}
|
}
|
||||||
|
|
||||||
data.all_directives = {
|
data.all_directives = {
|
||||||
'ALIGN', 'SKIP',
|
'ORG', 'ALIGN', 'SKIP',
|
||||||
'ASCII', 'ASCIIZ',
|
'ASCII', 'ASCIIZ',
|
||||||
'BYTE', 'HALFWORD', 'WORD', 'FLOAT',
|
'BYTE', 'HALFWORD', 'WORD',
|
||||||
--'HEX', -- excluded here due to different syntax
|
--'HEX', -- excluded here due to different syntax
|
||||||
'INC', 'INCASM', 'INCLUDE',
|
'INC', 'INCASM', 'INCLUDE',
|
||||||
'INCBIN',
|
'INCBIN',
|
||||||
'ORG',
|
-- these are unlikely to be implemented
|
||||||
|
'FLOAT', 'DOUBLE',
|
||||||
|
}
|
||||||
|
|
||||||
|
data.directive_aliases = {
|
||||||
|
SPACE = 'SKIP',
|
||||||
|
HALF = 'HALFWORD',
|
||||||
}
|
}
|
||||||
|
|
||||||
data.all_registers = {}
|
data.all_registers = {}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user