You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-09-08 08:13:02 -07:00
update preprocessor to use a class
This commit is contained in:
2
extras
2
extras
Submodule extras updated: 276111f04d...6735813a17
@@ -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
|
||||||
|
Reference in New Issue
Block a user