mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
only strip comments when a semicolon appears on the line
This commit is contained in:
parent
d358b39024
commit
6e083c9b3a
44
textpre.py
44
textpre.py
@ -271,28 +271,32 @@ for l in sys.stdin:
|
||||
sys.stdout.write(l)
|
||||
continue
|
||||
|
||||
# strip comments
|
||||
asm = ""
|
||||
comment = None
|
||||
in_quotes = False
|
||||
in_comment = False
|
||||
for letter in l:
|
||||
if in_comment:
|
||||
comment += letter
|
||||
elif in_quotes and letter != "\"":
|
||||
asm += letter
|
||||
elif in_quotes and letter == "\"":
|
||||
in_quotes = False
|
||||
asm += letter
|
||||
elif not in_quotes and letter == "\"":
|
||||
in_quotes = True
|
||||
asm += letter
|
||||
elif not in_quotes and letter != "\"":
|
||||
if letter == ";":
|
||||
in_comment = True
|
||||
comment = ";"
|
||||
else:
|
||||
|
||||
# strip comments
|
||||
comment = None
|
||||
if ";" in l:
|
||||
in_quotes = False
|
||||
in_comment = False
|
||||
for letter in l:
|
||||
if in_comment:
|
||||
comment += letter
|
||||
elif in_quotes and letter != "\"":
|
||||
asm += letter
|
||||
elif in_quotes and letter == "\"":
|
||||
in_quotes = False
|
||||
asm += letter
|
||||
elif not in_quotes and letter == "\"":
|
||||
in_quotes = True
|
||||
asm += letter
|
||||
elif not in_quotes and letter != "\"":
|
||||
if letter == ";":
|
||||
in_comment = True
|
||||
comment = ";"
|
||||
else:
|
||||
asm += letter
|
||||
else:
|
||||
asm = l
|
||||
|
||||
# skip asm with no quotes
|
||||
if "\"" not in asm:
|
||||
|
Loading…
Reference in New Issue
Block a user