diff options
author | Bryan Bishop <kanzure@gmail.com> | 2013-09-09 21:49:25 -0700 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2013-09-09 21:49:25 -0700 |
commit | 3ac5d20c753aab09a5aeabcd1677ff4812d4a10c (patch) | |
tree | 0b9438e9dd1e6c42cc78902969924e1950009df5 | |
parent | 0d6efda9bb3aa99cc9d28b9b9e7edaae121b7d75 (diff) | |
parent | 5c46972ebe6c62db1f70e8807851ed8721457681 (diff) |
Merge pull request #200 from kanzure/update-refactored-preprocessor
Update preprocessor to use a class.
Bump the submodule.
m--------- | extras | 0 | ||||
-rw-r--r-- | preprocessor.py | 10 | ||||
-rw-r--r-- | prequeue.py | 7 |
3 files changed, 11 insertions, 6 deletions
diff --git a/extras b/extras -Subproject 276111f04dcc3e937f1a16f4b7066934409f8ad +Subproject 6735813a177cecde2a9aa5e961241d8c2419fc2 diff --git a/preprocessor.py b/preprocessor.py index 188db81a6..54fc4cbff 100644 --- a/preprocessor.py +++ b/preprocessor.py @@ -3,6 +3,7 @@ import sys +import extras.pokemontools.config as conf import extras.pokemontools.preprocessor as preprocessor from extras.pokemontools.crystal import ( @@ -41,16 +42,17 @@ def load_pokecrystal_macros(): return ourmacros -def preprocess(macro_table, lines=None): +def preprocess(config, macros, lines=None): """ Entry point for the preprocessor. """ - return preprocessor.preprocess(macro_table, lines=lines) + processor = preprocessor.Preprocessor(config, macros) + return processor.preprocess(lines=lines) def main(): + config = conf.Config() macros = load_pokecrystal_macros() - macro_table = preprocessor.make_macro_table(macros) - preprocess(macro_table) + return preprocess(config, macros) # only run against stdin when not included as a module if __name__ == "__main__": diff --git a/prequeue.py b/prequeue.py index 5c1a9f161..c8b12fd70 100644 --- a/prequeue.py +++ b/prequeue.py @@ -7,11 +7,14 @@ a single process. import os import sys + +import extras.pokemontools.config as conf + import preprocessor def main(): + config = conf.Config() macros = preprocessor.load_pokecrystal_macros() - macro_table = preprocessor.preprocessor.make_macro_table(macros) stdout = sys.stdout @@ -19,7 +22,7 @@ def main(): dest = os.path.splitext(source)[0] + '.tx' sys.stdin = open(source, 'r') sys.stdout = open(dest, 'w') - preprocessor.preprocess(macro_table) + preprocessor.preprocess(config, macros) # reset stdout sys.stdout = stdout |