You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-09-08 08:13:02 -07:00
only strip comments when a semicolon appears on the line
This commit is contained in:
44
textpre.py
44
textpre.py
@@ -271,28 +271,32 @@ for l in sys.stdin:
|
|||||||
sys.stdout.write(l)
|
sys.stdout.write(l)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# strip comments
|
|
||||||
asm = ""
|
asm = ""
|
||||||
comment = None
|
|
||||||
in_quotes = False
|
# strip comments
|
||||||
in_comment = False
|
comment = None
|
||||||
for letter in l:
|
if ";" in l:
|
||||||
if in_comment:
|
in_quotes = False
|
||||||
comment += letter
|
in_comment = False
|
||||||
elif in_quotes and letter != "\"":
|
for letter in l:
|
||||||
asm += letter
|
if in_comment:
|
||||||
elif in_quotes and letter == "\"":
|
comment += letter
|
||||||
in_quotes = False
|
elif in_quotes and letter != "\"":
|
||||||
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
|
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
|
# skip asm with no quotes
|
||||||
if "\"" not in asm:
|
if "\"" not in asm:
|
||||||
|
Reference in New Issue
Block a user