From fef1cdd4f2d5760ce6742e40cb256296f597b836 Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 2 Dec 2013 23:48:24 -0500 Subject: preprocessor: str.split() already removes preceding/trailing whitespace --- pokemontools/preprocessor.py | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'pokemontools') diff --git a/pokemontools/preprocessor.py b/pokemontools/preprocessor.py index e032125..5ac7724 100644 --- a/pokemontools/preprocessor.py +++ b/pokemontools/preprocessor.py @@ -553,29 +553,17 @@ class Preprocessor(object): original_line = line - # remove trailing newline - if line[-1] == "\n": - line = line[:-1] + has_tab = line[0] == "\t" - # remove first tab - has_tab = False - if line[0] == "\t": - has_tab = True - line = line[1:] - - # remove duplicate whitespace (also trailing) + # remove whitespace line = " ".join(line.split()) - params = [] - # check if the line has params if " " in line: # split the line into separate parameters params = line.replace(token, "").split(",") - - # check if there are no params (redundant) - if len(params) == 1 and params[0] == "": - raise exceptions.MacroException("macro has no params?") + else: + params = [] # write out a comment showing the original line if show_original_lines: -- cgit v1.2.3