diff options
author | yenatch <yenatch@gmail.com> | 2013-12-02 23:48:24 -0500 |
---|---|---|
committer | yenatch <yenatch@gmail.com> | 2013-12-02 23:48:24 -0500 |
commit | fef1cdd4f2d5760ce6742e40cb256296f597b836 (patch) | |
tree | b6a0628028e8505bb89dc6ff20f7b5afbd2c2145 /pokemontools/preprocessor.py | |
parent | 3a586ef165b8022b0f5159dfdd586789f3166e70 (diff) |
preprocessor: str.split() already removes preceding/trailing whitespace
Diffstat (limited to 'pokemontools/preprocessor.py')
-rw-r--r-- | pokemontools/preprocessor.py | 20 |
1 files changed, 4 insertions, 16 deletions
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: |