mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Merge pull request #200 from kanzure/update-refactored-preprocessor
Update preprocessor to use a class. Bump the submodule.
This commit is contained in:
commit
3ac5d20c75
2
extras
2
extras
@ -1 +1 @@
|
|||||||
Subproject commit 276111f04dcc3e937f1a16f4b7066934409f8ad4
|
Subproject commit 6735813a177cecde2a9aa5e961241d8c2419fc2e
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import extras.pokemontools.config as conf
|
||||||
import extras.pokemontools.preprocessor as preprocessor
|
import extras.pokemontools.preprocessor as preprocessor
|
||||||
|
|
||||||
from extras.pokemontools.crystal import (
|
from extras.pokemontools.crystal import (
|
||||||
@ -41,16 +42,17 @@ def load_pokecrystal_macros():
|
|||||||
|
|
||||||
return ourmacros
|
return ourmacros
|
||||||
|
|
||||||
def preprocess(macro_table, lines=None):
|
def preprocess(config, macros, lines=None):
|
||||||
"""
|
"""
|
||||||
Entry point for the preprocessor.
|
Entry point for the preprocessor.
|
||||||
"""
|
"""
|
||||||
return preprocessor.preprocess(macro_table, lines=lines)
|
processor = preprocessor.Preprocessor(config, macros)
|
||||||
|
return processor.preprocess(lines=lines)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
config = conf.Config()
|
||||||
macros = load_pokecrystal_macros()
|
macros = load_pokecrystal_macros()
|
||||||
macro_table = preprocessor.make_macro_table(macros)
|
return preprocess(config, macros)
|
||||||
preprocess(macro_table)
|
|
||||||
|
|
||||||
# only run against stdin when not included as a module
|
# only run against stdin when not included as a module
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -7,11 +7,14 @@ a single process.
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import extras.pokemontools.config as conf
|
||||||
|
|
||||||
import preprocessor
|
import preprocessor
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
config = conf.Config()
|
||||||
macros = preprocessor.load_pokecrystal_macros()
|
macros = preprocessor.load_pokecrystal_macros()
|
||||||
macro_table = preprocessor.preprocessor.make_macro_table(macros)
|
|
||||||
|
|
||||||
stdout = sys.stdout
|
stdout = sys.stdout
|
||||||
|
|
||||||
@ -19,7 +22,7 @@ def main():
|
|||||||
dest = os.path.splitext(source)[0] + '.tx'
|
dest = os.path.splitext(source)[0] + '.tx'
|
||||||
sys.stdin = open(source, 'r')
|
sys.stdin = open(source, 'r')
|
||||||
sys.stdout = open(dest, 'w')
|
sys.stdout = open(dest, 'w')
|
||||||
preprocessor.preprocess(macro_table)
|
preprocessor.preprocess(config, macros)
|
||||||
|
|
||||||
# reset stdout
|
# reset stdout
|
||||||
sys.stdout = stdout
|
sys.stdout = stdout
|
||||||
|
Loading…
Reference in New Issue
Block a user