diff options
author | Juan J. Martinez <jjm@usebox.net> | 2019-08-15 20:55:24 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2019-08-15 20:55:24 +0100 |
commit | dfdce006edcfc6bda105eb81a1fd3c2d8749d1ee (patch) | |
tree | 38b7da5900e20e77149715f7e5c6e73d3a748870 | |
parent | 7494da84a119ae4195361d3ff9c43038cf2058f5 (diff) | |
download | z80count-dfdce006edcfc6bda105eb81a1fd3c2d8749d1ee.tar.gz z80count-dfdce006edcfc6bda105eb81a1fd3c2d8749d1ee.zip |
Formatting
-rw-r--r-- | z80count/z80count.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/z80count/z80count.py b/z80count/z80count.py index 810985e..f1b28bf 100644 --- a/z80count/z80count.py +++ b/z80count/z80count.py @@ -45,9 +45,9 @@ def perror(message, *args, **kwargs): print(message % args, file=sys.stderr) -########################################################################## -# Program arguments # -########################################################################## +# +# Program arguments +# # NOTE: types as used in the schema are just the callables # responsibles for converting strings to python values (when the value @@ -202,9 +202,9 @@ def parse_command_line(defaults): return parser.parse_args() -########################################################################## -# z80count # -########################################################################## +# +# z80count +# def z80count(line, parser, @@ -254,7 +254,8 @@ def format_line(line, entry, total, total_cond, subt, update, column, comment += " case{%s}" % entry["case"] if len(line) == 1: - comment = comment_alignment(line[0], column, use_tabs, tab_width) + comment + comment = comment_alignment( + line[0], column, use_tabs, tab_width) + comment out = line[0] + comment if len(line) > 1: if update: @@ -323,6 +324,7 @@ def line_length(line, tab_width): class Parser(object): + """Simple parser based on a table of regexes.""" # [label:] OPERATOR [OPERANDS] [; comment] @@ -377,7 +379,8 @@ class Parser(object): @staticmethod def _init_entry(entry): - entry["cregex"] = re.compile(r"^\s*" + entry["regex"] + r"\s*(;.*)?$", re.I) + entry["cregex"] = re.compile( + r"^\s*" + entry["regex"] + r"\s*(;.*)?$", re.I) cycles = entry["cycles"] if "/" in cycles: c = cycles.split("/") |