Fix formatting

pull/1887/head
Gernot Salzer 3 weeks ago committed by GitHub
parent 2bbc3a2120
commit 31c3e6b49e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 14
      mythril/ethereum/util.py

@ -178,7 +178,7 @@ QUOTE_END = re.compile("(?<!\\\\)'")
DQUOTE_END = re.compile('(?<!\\\\)"') DQUOTE_END = re.compile('(?<!\\\\)"')
def remove_comments_strings(prg): def remove_comments_strings(prg):
todo = "\n".join(prg) # normalize line ends todo = "\n".join(prg) # normalize line ends
done = "" done = ""
while True: while True:
m = VOID_START.search(todo) m = VOID_START.search(todo)
@ -186,23 +186,23 @@ def remove_comments_strings(prg):
done += todo done += todo
break break
else: else:
done += todo[:m.start()] done += todo[: m.start()]
if m[0] == "//": if m[0] == "//":
end = todo.find('\n', m.end()) end = todo.find("\n", m.end())
todo = "" if end == -1 else todo[end:] todo = "" if end == -1 else todo[end:]
elif m[0] == "/*": elif m[0] == "/*":
end = todo.find("*/", m.end()) end = todo.find("*/", m.end())
done += " " done += " "
todo = "" if end == -1 else todo[end+2:] todo = "" if end == -1 else todo[end + 2 :]
else: else:
if m[0] == "'": if m[0] == "'":
m2 = QUOTE_END.search(todo[m.end():]) m2 = QUOTE_END.search(todo[m.end() :])
else: else:
m2 = DQUOTE_END.search(todo[m.end():]) m2 = DQUOTE_END.search(todo[m.end() :])
if not m2: if not m2:
# unclosed string # unclosed string
break break
todo = todo[m.end()+m2.end():] todo = todo[m.end() + m2.end() :]
return done return done

Loading…
Cancel
Save