summaryrefslogtreecommitdiff
path: root/pokemontools/preprocessor.py
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2013-12-02 15:15:19 -0500
committeryenatch <yenatch@gmail.com>2013-12-02 15:15:19 -0500
commit3a586ef165b8022b0f5159dfdd586789f3166e70 (patch)
tree9289ad9a68584a2c4ff5ca28c4795cc192dcf479 /pokemontools/preprocessor.py
parenta648e0a8cdc6c7d981a5641f4dc4d5b02e23e81e (diff)
preprocessor: simplify macro_translator
Diffstat (limited to 'pokemontools/preprocessor.py')
-rw-r--r--pokemontools/preprocessor.py14
1 files changed, 4 insertions, 10 deletions
diff --git a/pokemontools/preprocessor.py b/pokemontools/preprocessor.py
index 1fac44d..e032125 100644
--- a/pokemontools/preprocessor.py
+++ b/pokemontools/preprocessor.py
@@ -598,24 +598,18 @@ class Preprocessor(object):
if do_macro_sanity_check:
self.check_macro_sanity(params, macro, original_line)
-
output = ""
-
- index = 0
- while index < len(params):
+ for index in xrange(len(params)):
param_type = macro.param_types[index]
description = param_type["name"].strip()
param_klass = param_type["class"]
- byte_type = param_klass.byte_type # db or dw
+ byte_type = param_klass.byte_type
param = params[index].strip()
if "from_asm" in dir(param_klass):
- output += ("\t" + byte_type + " " + param_klass.from_asm(param) + " ; " + description + "\n")
-
- else:
- output += ("\t" + byte_type + " " + param + " ; " + description + "\n")
+ param = param_klass.from_asm(param)
- index += 1
+ output += ("\t" + byte_type + " " + param + " ; " + description + "\n")
sys.stdout.write(output)