allow hex numbers

This commit is contained in:
Kelvin Sherlock 2019-08-10 20:32:47 -04:00
parent 1fe3f297e8
commit ecd9d0b6ae
1 changed files with 7 additions and 2 deletions

View File

@ -162,7 +162,7 @@ def read_data(f, name):
if line == "" : continue
if line[0] == "#" : continue
m = re.match(r'^"([^"]*)"\s+(\d+)$', line)
m = re.match(r'^"([^"]*)"\s+(\d+|0x[A-Fa-f0-9]+)$', line)
if not m:
err = "{}:{}: Bad data: {}".format(name,ln,line)
raise Exception(err)
@ -170,7 +170,12 @@ def read_data(f, name):
if flag_i:
k = k.lower()
k = decode_string(k)
v = int(m[2])
tmp = m[2]
base = 10
if tmp.startswith("0x"): base = 16
v = int(tmp, base)
if flag_l:
if v > 255 or len(orig_k) > 255:
err = "{}:{} Value too large: {}".format(name, ln, v)