diff options
| author | s-ol <s+removethis@s-ol.nu> | 2021-11-06 17:39:08 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2021-11-06 17:39:08 +0000 |
| commit | 4853cb44e09303dd42b917fcdb56d00ccb3b2ef0 (patch) | |
| tree | a1cd54c7d4375968876632ea2e01063219e1af2e /subv.py | |
| parent | new elf generator w/ symbol output (diff) | |
| download | subv-hardware.tar.gz subv-hardware.zip | |
wiphardware
Diffstat (limited to '')
| -rw-r--r-- | subv.py | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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: |
