diff options
author | Bryan Bishop <kanzure@gmail.com> | 2013-09-12 21:45:01 -0700 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2013-09-12 21:45:01 -0700 |
commit | 6809c951acb22ddecbeec492ae344e1a2165f942 (patch) | |
tree | 3317d767c7c75aaed83d104c4c0f0b9a66ccd98c /pokemontools/labels.py | |
parent | 0a9ccaebbbb7853034b3b0b22fc645e8b4af30b0 (diff) | |
parent | b9955a5e40a2c517d50a9f84ee47d3c12ce23e9a (diff) |
Merge pull request #30 from kanzure/cleanup-again
More cleanup of crystal.py
Diffstat (limited to 'pokemontools/labels.py')
-rw-r--r-- | pokemontools/labels.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/pokemontools/labels.py b/pokemontools/labels.py index 1509ae6..96e34b9 100644 --- a/pokemontools/labels.py +++ b/pokemontools/labels.py @@ -8,7 +8,6 @@ import json import logging import pointers -import crystal class Labels(object): """ @@ -32,6 +31,7 @@ class Labels(object): "Running crystal.scan_for_predefined_labels to create \"{0}\". Trying.." .format(Labels.filename) ) + import crystal crystal.scan_for_predefined_labels() self.labels = json.read(open(self.path, "r").read()) @@ -197,3 +197,13 @@ def get_label_from_line(line): #split up the line label = line.split(":")[0] return label + +def find_labels_without_addresses(asm): + """scans the asm source and finds labels that are unmarked""" + without_addresses = [] + for (line_number, line) in enumerate(asm): + if line_has_label(line): + label = get_label_from_line(line) + if not line_has_comment_address(line): + without_addresses.append({"line_number": line_number, "line": line, "label": label}) + return without_addresses |