diff options
author | Alexis Roda <alexis.roda.villalonga@gmail.com> | 2019-07-26 20:58:15 +0200 |
---|---|---|
committer | Alexis Roda <alexis.roda.villalonga@gmail.com> | 2019-07-26 20:58:15 +0200 |
commit | 1c4ea8f147bc458cf34d864655a9a8969bbcdac5 (patch) | |
tree | e6d9aa49dd7d47b215802d4724172da21676b08e /z80count.py | |
parent | b5fa3354d0d24440bc13e22fe9170c5a31d348df (diff) | |
download | z80count-1c4ea8f147bc458cf34d864655a9a8969bbcdac5.tar.gz z80count-1c4ea8f147bc458cf34d864655a9a8969bbcdac5.zip |
Simplify regexes.
Regexes hare a common prefix and suffix. Remove them from the json
file in order to make it more readable and add them in python code
when parsing the file.
Diffstat (limited to 'z80count.py')
-rwxr-xr-x | z80count.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/z80count.py b/z80count.py index c44a90a..8b7fdb6 100755 --- a/z80count.py +++ b/z80count.py @@ -80,7 +80,7 @@ def init_table(table_file="z80table.json"): table = json.load(fd) for i in table: - i["cregex"] = re.compile(i["regex"] + r"\s?(;.*)?", re.I) + i["cregex"] = re.compile(r"^\s*" + i["regex"] + r"\s*(;.*)?$", re.I) return sorted(table, key=lambda o: o["w"]) |