diff options
author | Bryan Bishop <kanzure@gmail.com> | 2013-08-31 12:47:23 -0500 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2013-08-31 12:47:23 -0500 |
commit | 12c1d874b94cf51523b072477a59b0cc398fc8d3 (patch) | |
tree | a3940230cf443d809780f8f7b19748f782b17fdd /preprocessor.py | |
parent | 724215ea7519c28b602f72440e1ec73e2e6cf388 (diff) | |
parent | c0a01c998240bacae77addbb08a5d2133cf58a21 (diff) |
Merge branch 'master' into refactor-preprocessor
Conflicts:
preprocessor.py
Also bump the extras submodule to a version of pokemontools with a
suitable version of the preprocessor. The changes from 'master' for
preprocessor.py have been inserted into pokemontools prior to the
submodule bump.
Diffstat (limited to 'preprocessor.py')
-rw-r--r-- | preprocessor.py | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/preprocessor.py b/preprocessor.py index acf296e91..188db81a6 100644 --- a/preprocessor.py +++ b/preprocessor.py @@ -12,35 +12,46 @@ from extras.pokemontools.crystal import ( Signpost, PeopleEvent, DataByteWordMacro, - ItemFragment, text_command_classes, movement_command_classes, music_classes, effect_classes, ) -even_more_macros = [ - Warp, - XYTrigger, - Signpost, - PeopleEvent, - DataByteWordMacro, - ItemFragment, -] +def load_pokecrystal_macros(): + """ + Construct a list of macros that are needed for pokecrystal preprocessing. + """ + ourmacros = [] + + even_more_macros = [ + Warp, + XYTrigger, + Signpost, + PeopleEvent, + DataByteWordMacro, + ] -macros = command_classes -macros += even_more_macros -macros += [each[1] for each in text_command_classes] -macros += movement_command_classes -macros += music_classes -macros += effect_classes + ourmacros += command_classes + ourmacros += even_more_macros + ourmacros += [each[1] for each in text_command_classes] + ourmacros += movement_command_classes + ourmacros += music_classes + ourmacros += effect_classes -def preprocess(macros): + return ourmacros + +def preprocess(macro_table, lines=None): """ Entry point for the preprocessor. """ - return preprocessor.preprocess(macros) + return preprocessor.preprocess(macro_table, lines=lines) + +def main(): + macros = load_pokecrystal_macros() + macro_table = preprocessor.make_macro_table(macros) + preprocess(macro_table) # only run against stdin when not included as a module if __name__ == "__main__": - preprocess(macros) + main() |