Updated the memory parsing

The order matters here, so just moved displacement check to end
This commit is contained in:
niravthakkar 2017-01-05 14:48:09 +05:30 committed by GitHub
parent dcb1dd74ed
commit 206c650689

View File

@ -329,11 +329,6 @@ local function split_memop(arg)
if b then
return 0, parse_reg(x), parse_reg(b)
end
-- Assuming that only displacement is passed, as either digit or label "45 or label1"
-- local d = match(arg,"[%w_]+")
-- if d then
-- return d, 0, 0
-- end
local reg, tailr = match(arg, "^([%w_:]+)%s*(.*)$")
if reg then
local r, tp = parse_reg(reg)
@ -341,6 +336,11 @@ local function split_memop(arg)
return format(tp.ctypefmt, tailr), 0, r
end
end
-- Assuming that only displacement is passed, as either digit or label "45 or label1"
local d = match(arg,"[%w_]+")
if d then
return d, 0, 0
end
-- TODO: handle values without registers?
-- TODO: handle registers without a displacement? -- done, above ,needs to be tested
werror("bad memory operand: "..arg)