summaryrefslogtreecommitdiff
path: root/preprocessor.py
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2013-08-31 11:04:27 -0500
committerBryan Bishop <kanzure@gmail.com>2013-08-31 11:04:27 -0500
commit70be18427b069cae7ffcfb84811ae268fa18afce (patch)
treee76233549123599ff935c44045377267e6546d44 /preprocessor.py
parentca0981eb36a86c1cd868e6f8ca13b42162afdc3f (diff)
don't call load_pokecrystal_macros 2000 times
Also, don't call make_macro_table 2000 times by only calling it once and passing the result.
Diffstat (limited to 'preprocessor.py')
-rw-r--r--preprocessor.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/preprocessor.py b/preprocessor.py
index f5dd205b2..aef1ff220 100644
--- a/preprocessor.py
+++ b/preprocessor.py
@@ -642,9 +642,8 @@ def read_line(l, macro_table):
if comment: sys.stdout.write(comment)
-def preprocess(macros, lines=None):
+def preprocess(macro_table, lines=None):
"""Main entry point for the preprocessor."""
- macro_table = make_macro_table(macros)
if not lines:
# read each line from stdin
@@ -658,4 +657,6 @@ def preprocess(macros, lines=None):
# only run against stdin when not included as a module
if __name__ == "__main__":
- preprocess(load_pokecrystal_macros())
+ macros = load_pokecrystal_macros()
+ macro_table = make_macro_table(macros)
+ preprocess(macro_table)