diff --git a/lips/Dumper.lua b/lips/Dumper.lua index d6eaabb..5a84302 100644 --- a/lips/Dumper.lua +++ b/lips/Dumper.lua @@ -124,7 +124,7 @@ function Dumper:add_directive(line, name, a, b) end function Dumper:desym(tok) - -- FIXME: errors can give wrong filename, also off by one + -- FIXME: errors can give wrong filename if type(tok[2]) == 'number' then return tok[2] elseif tok[1] == 'LABELSYM' then diff --git a/lips/Lexer.lua b/lips/Lexer.lua index cddb130..7f29441 100644 --- a/lips/Lexer.lua +++ b/lips/Lexer.lua @@ -154,8 +154,8 @@ function Lexer:lex_hex(yield) local entered = false while true do if self.chr == '\n' then - self:nextc() yield('EOL', '\n') + self:nextc() elseif self.ord == self.EOF then self:error('unexpected EOF; incomplete hex directive') elseif self.chr == ';' then @@ -206,8 +206,8 @@ end function Lexer:lex_block_comment(yield) while true do if self.chr == '\n' then - self:nextc() yield('EOL', '\n') + self:nextc() elseif self.ord == self.EOF then self:error('unexpected EOF; incomplete block comment') elseif self.chrchr == '*/' then @@ -230,8 +230,8 @@ function Lexer:lex_string(yield) while true do if self.chr == '\n' then self:error('unimplemented') - self:nextc() yield('EOL', '\n') + self:nextc() elseif self.ord == self.EOF then self:nextc() self:error('unexpected EOF; incomplete string') @@ -288,8 +288,8 @@ function Lexer:lex(_yield) end while true do if self.chr == '\n' then - self:nextc() yield('EOL', '\n') + self:nextc() elseif self.ord == self.EOF then yield('EOF', self.EOF) break diff --git a/lips/Parser.lua b/lips/Parser.lua index 2bb4cba..64eaea6 100644 --- a/lips/Parser.lua +++ b/lips/Parser.lua @@ -258,10 +258,8 @@ function Parser:instruction() local h = data.instructions[name] self:advance() - -- FIXME: errors thrown here probably have the wrong line number (+1) - if h == nil then - self:error('undefined instruction') + error('Internal Error: undefined instruction') elseif overrides[name] then overrides[name](self, name) elseif h[2] == 'tob' then -- TODO: or h[2] == 'Tob' then