diff --git a/lips/Lexer.lua b/lips/Lexer.lua index c5843c2..2e5d1af 100644 --- a/lips/Lexer.lua +++ b/lips/Lexer.lua @@ -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') diff --git a/lips/data.lua b/lips/data.lua index 5129589..41656a0 100644 --- a/lips/data.lua +++ b/lips/data.lua @@ -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 = {}