Minor cleanup of regular expressions.

This commit is contained in:
Michael Munday 2016-11-30 17:07:17 -05:00
parent a34bcf9ef4
commit 575c907544

View File

@ -242,7 +242,7 @@ local map_cond = {
local parse_reg_type local parse_reg_type
local function parse_gpr(expr) local function parse_gpr(expr)
local r = match(expr, "^r([1-3]?[0-9])$") local r = match(expr, "^r(1?[0-9])$")
if r then if r then
r = tonumber(r) r = tonumber(r)
if r <= 15 then return r, tp end if r <= 15 then return r, tp end
@ -251,7 +251,7 @@ local function parse_gpr(expr)
end end
local function parse_fpr(expr) local function parse_fpr(expr)
local r = match(expr, "^f([1-3]?[0-9])$") local r = match(expr, "^f(1?[0-9])$")
if r then if r then
r = tonumber(r) r = tonumber(r)
if r <= 15 then return r end if r <= 15 then return r end
@ -292,7 +292,7 @@ end
-- Split a memory operand of the form d(b) or d(x,b) into d, x and b. -- Split a memory operand of the form d(b) or d(x,b) into d, x and b.
-- If x is not specified then it is 0. -- If x is not specified then it is 0.
local function split_memop(arg) local function split_memop(arg)
local reg = "r[0-1]?[0-9]" local reg = "r1?[0-9]"
local d, x, b = match(arg, "^(.*)%(("..reg.."), ("..reg..")%)$") local d, x, b = match(arg, "^(.*)%(("..reg.."), ("..reg..")%)$")
if d then if d then
return d, parse_gpr(x), parse_gpr(b) return d, parse_gpr(x), parse_gpr(b)