mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-09-09 09:51:34 -07:00
refactor preprocessor macros into a function
Remove the "macros" global and instead use a function to construct a list of macros.
This commit is contained in:
parent
63c2dc2f1f
commit
5815edf382
@ -16,6 +16,12 @@ from extras.pokemontools.crystal import (
|
|||||||
effect_classes,
|
effect_classes,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def load_pokecrystal_macros():
|
||||||
|
"""
|
||||||
|
Construct a list of macros that are needed for pokecrystal preprocessing.
|
||||||
|
"""
|
||||||
|
ourmacros = []
|
||||||
|
|
||||||
even_more_macros = [
|
even_more_macros = [
|
||||||
Warp,
|
Warp,
|
||||||
XYTrigger,
|
XYTrigger,
|
||||||
@ -24,12 +30,14 @@ even_more_macros = [
|
|||||||
DataByteWordMacro,
|
DataByteWordMacro,
|
||||||
]
|
]
|
||||||
|
|
||||||
macros = command_classes
|
ourmacros += command_classes
|
||||||
macros += even_more_macros
|
ourmacros += even_more_macros
|
||||||
macros += [each[1] for each in text_command_classes]
|
ourmacros += [each[1] for each in text_command_classes]
|
||||||
macros += movement_command_classes
|
ourmacros += movement_command_classes
|
||||||
macros += music_classes
|
ourmacros += music_classes
|
||||||
macros += effect_classes
|
ourmacros += effect_classes
|
||||||
|
|
||||||
|
return ourmacros
|
||||||
|
|
||||||
# show lines before preprocessing in stdout
|
# show lines before preprocessing in stdout
|
||||||
show_original_lines = False
|
show_original_lines = False
|
||||||
@ -628,4 +636,4 @@ def preprocess(macros, lines=None):
|
|||||||
|
|
||||||
# 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__":
|
||||||
preprocess(macros)
|
preprocess(load_pokecrystal_macros())
|
||||||
|
@ -14,4 +14,4 @@ if __name__ == '__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(preprocessor.macros)
|
preprocessor.preprocess(preprocessor.load_pokecrystal_macros())
|
||||||
|
Loading…
Reference in New Issue
Block a user