aboutsummaryrefslogtreecommitdiffstats
path: root/subv.py
diff options
context:
space:
mode:
Diffstat (limited to 'subv.py')
-rw-r--r--subv.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/subv.py b/subv.py
index 8cee596..9eccbea 100644
--- a/subv.py
+++ b/subv.py
@@ -1,7 +1,7 @@
import re
import bits
-white = re.compile(r"[ \t\.\n]+")
+white = re.compile(r"[ \t\n]+")
hex = re.compile(r"^\-?[0-9a-f]+$")
num = re.compile(r"^\d+$")
ref_re = re.compile(r"^([^\[+-]+)(?:([+-]\d+))?$")
@@ -67,6 +67,8 @@ def parse_segment(line):
('code', 32768)
>>> parse_segment('== text')
('text',)
+ >>> parse_segment('== .text 0x1234')
+ ('.text', 4660)
"""
parts = white.split(line)
if len(parts) == 3:
@@ -146,7 +148,7 @@ def classify(line):
'empty'
>>> classify('== code')
'segment'
- >>> classify('== text 0x1000')
+ >>> classify('== .text 0x1000')
'segment'
>>> classify('some_label:')
'label'
@@ -168,7 +170,9 @@ def classify(line):
def parse(line):
- """clean, classify and parse lines."""
+ """clean, classify and parse lines.
+ """
+
raw = line.strip()
split = raw.split("#", 1)
if len(split) == 1: