summaryrefslogtreecommitdiff
path: root/preprocessor.py
diff options
context:
space:
mode:
Diffstat (limited to 'preprocessor.py')
-rw-r--r--preprocessor.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/preprocessor.py b/preprocessor.py
index bf9220a83..242732094 100644
--- a/preprocessor.py
+++ b/preprocessor.py
@@ -317,7 +317,7 @@ def separate_comment(l):
break
if l[i] == "\"":
in_quotes = not in_quotes
- return i
+ return l[:i], l[i:] or None
def quote_translator(asm):
"""
@@ -574,12 +574,12 @@ def macro_translator(macro, token, line):
def read_line(l):
"""Preprocesses a given line of asm."""
- # strip comments
- asm, comment = l[:separate_comment(l)], l[separate_comment(l):]
+ # strip comments from asm
+ asm, comment = separate_comment(l)
# export all labels
if ':' in asm[:asm.find('"')]:
- sys.stdout.write('GLOBAL ' + asm.split(':')[0] + '\n')
+ sys.stdout.write('GLOBAL ' + asm.split(':')[0] + '\n')
# expect preprocessed .asm files
if "INCLUDE" in asm:
@@ -602,7 +602,8 @@ def read_line(l):
macro_translator(macro, token, asm)
else:
sys.stdout.write(asm)
- sys.stdout.write(comment)
+
+ if comment: sys.stdout.write(comment)
def preprocess(lines=None):
"""Main entry point for the preprocessor."""