summaryrefslogtreecommitdiff
path: root/preprocessor.py
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2013-05-15 12:09:31 -0700
committerBryan Bishop <kanzure@gmail.com>2013-05-15 12:09:31 -0700
commit5feb5fd208d68a3d8f4d0ce4d925512a8fbe3b97 (patch)
tree831df9be5469d1390f9b279a013ed0251c24fca7 /preprocessor.py
parent14567c2beeeb9272bcd98dfc68e0729ac3b3929e (diff)
parent5521aa5ce0ad5249ff0d369dd33b4f63cd804b73 (diff)
Merge pull request #137 from yenatch/master
gbz80disasm reads wram/gbhw/hram and spaces blocks of asm
Diffstat (limited to 'preprocessor.py')
-rw-r--r--preprocessor.py23
1 files changed, 8 insertions, 15 deletions
diff --git a/preprocessor.py b/preprocessor.py
index 67e4cdb9f..18e96dff0 100644
--- a/preprocessor.py
+++ b/preprocessor.py
@@ -314,26 +314,19 @@ def separate_comment(l):
asm = ""
comment = None
in_quotes = False
- in_comment = False
# token either belongs to the line or to the comment
for token in l:
- if in_comment:
+ if comment:
comment += token
- elif in_quotes and token != "\"":
- asm += token
- elif in_quotes and token == "\"":
- in_quotes = False
- asm += token
- elif not in_quotes and token == "\"":
- in_quotes = True
+ else:
+ if not in_quotes:
+ if token == ";":
+ comment = ";"
+ continue
+ if token == "\"":
+ in_quotes = not in_quotes
asm += token
- elif not in_quotes and token != "\"":
- if token == ";":
- in_comment = True
- comment = ";"
- else:
- asm += token
return asm, comment
def quote_translator(asm):