summaryrefslogtreecommitdiff
path: root/preprocessor.py
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2013-01-23 12:35:38 -0800
committerBryan Bishop <kanzure@gmail.com>2013-01-23 12:35:38 -0800
commitd3c87e37f9f7d1d7a3f79bb0960256c3a21f588d (patch)
tree7d52e6788e2060a7d20751bbb946ff3300c84bcf /preprocessor.py
parentb05db023a87e157e7e7442d55b62271ab9906cb3 (diff)
parent54f3eb847e239dba0386f95d9346889ad312144b (diff)
Merge pull request #92 from yenatch/master
parse and dump pic animations
Diffstat (limited to 'preprocessor.py')
-rw-r--r--preprocessor.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/preprocessor.py b/preprocessor.py
index 9b748dbd6..5fe331b64 100644
--- a/preprocessor.py
+++ b/preprocessor.py
@@ -569,13 +569,19 @@ def macro_translator(macro, token, line):
def include_file(asm):
"""This is more reliable than rgbasm/rgbds including files on its own."""
+ prefix = asm.split("INCLUDE \"")[0] + '\n'
filename = asm.split("\"")[1]
+ suffix = asm.split("\"")[2]
+
+ read_line(prefix)
lines = open(filename, "r").readlines()
for line in lines:
read_line(line)
+ read_line(suffix)
+
def read_line(l):
"""Preprocesses a given line of asm."""
@@ -586,9 +592,8 @@ def read_line(l):
asm = l
comment = None
- # handle INCLUDE as a special case either at the start of the line or
- # after the first character in the line (like a tab)
- if "INCLUDE \"" in [asm[0:9], asm[1:9]]:
+ # handle INCLUDE as a special case
+ if "INCLUDE \"" in l:
include_file(asm)
# convert text to bytes when a quote appears (not in a comment)