mirror of
https://github.com/notwa/mm
synced 2025-02-05 13:23:23 -08:00
update lips
This commit is contained in:
parent
7edf81077a
commit
19518cbb8a
1 changed files with 4 additions and 3 deletions
|
@ -1284,11 +1284,11 @@ function Parser:tokenize(asm)
|
||||||
-- which is too much for our simple assembler.
|
-- which is too much for our simple assembler.
|
||||||
while true do
|
while true do
|
||||||
local tt, tok, fn, line = lex()
|
local tt, tok, fn, line = lex()
|
||||||
|
self.fn = fn
|
||||||
|
self.line = line
|
||||||
if tt == 'DEF' then
|
if tt == 'DEF' then
|
||||||
local tt2, tok2 = lex()
|
local tt2, tok2 = lex()
|
||||||
if tt2 ~= 'NUM' then
|
if tt2 ~= 'NUM' then
|
||||||
self.fn = fn
|
|
||||||
self.line = line
|
|
||||||
self:error('expected number for define')
|
self:error('expected number for define')
|
||||||
end
|
end
|
||||||
self.defines[tok] = tok2
|
self.defines[tok] = tok2
|
||||||
|
@ -1305,11 +1305,12 @@ function Parser:tokenize(asm)
|
||||||
|
|
||||||
-- resolve defines
|
-- resolve defines
|
||||||
for i, t in ipairs(self.tokens) do
|
for i, t in ipairs(self.tokens) do
|
||||||
|
self.fn = t.fn
|
||||||
|
self.line = t.line
|
||||||
if t.tt == 'DEFSYM' then
|
if t.tt == 'DEFSYM' then
|
||||||
t.tt = 'NUM'
|
t.tt = 'NUM'
|
||||||
t.tok = self.defines[t.tok]
|
t.tok = self.defines[t.tok]
|
||||||
if t.tok == nil then
|
if t.tok == nil then
|
||||||
self.line = t.line
|
|
||||||
self:error('undefined define') -- uhhh nice wording
|
self:error('undefined define') -- uhhh nice wording
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue