From 1c4ea8f147bc458cf34d864655a9a8969bbcdac5 Mon Sep 17 00:00:00 2001 From: Alexis Roda Date: Fri, 26 Jul 2019 20:58:15 +0200 Subject: 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. --- z80count.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'z80count.py') 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"]) -- cgit v1.2.3