From 3a586ef165b8022b0f5159dfdd586789f3166e70 Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 2 Dec 2013 15:15:19 -0500 Subject: preprocessor: simplify macro_translator --- pokemontools/preprocessor.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'pokemontools/preprocessor.py') 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) -- cgit v1.2.3