aboutsummaryrefslogtreecommitdiffstats
path: root/subv.py
diff options
context:
space:
mode:
Diffstat (limited to 'subv.py')
-rw-r--r--subv.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/subv.py b/subv.py
index fd4df5a..8cee596 100644
--- a/subv.py
+++ b/subv.py
@@ -2,7 +2,7 @@ import re
import bits
white = re.compile(r"[ \t\.\n]+")
-hex = re.compile(r"^\-?(0x)?[0-9a-f]+$")
+hex = re.compile(r"^\-?[0-9a-f]+$")
num = re.compile(r"^\d+$")
ref_re = re.compile(r"^([^\[+-]+)(?:([+-]\d+))?$")
immediate_re = re.compile(r"^(imm|off|csr)(\d+)(hi|lo)?$")
@@ -16,23 +16,19 @@ def parse_part(part):
(0,)
>>> parse_part('00')
(0,)
- >>> parse_part('0x00')
- (0,)
>>> parse_part('12')
(18,)
- >>> parse_part('0x12')
- (18,)
>>> parse_part('-12')
(-18,)
- >>> parse_part('-0x12')
- (-18,)
>>> parse_part('00/with/tag')
(0, 'with', 'tag')
>>> parse_part('-12/and/tag')
(-18, 'and', 'tag')
+ >>> parse_part('cafe/and/tag')
+ (51966, 'and', 'tag')
>>> parse_part('label/tag*')
('label', 'tag*')