Skip to content

Commit

Permalink
At some point ren'py started being able to split code properly around…
Browse files Browse the repository at this point in the history
… docstrings containing single quotes inside of them, so now we too do it properly
  • Loading branch information
CensoredUsername committed Feb 3, 2020
1 parent f54097c commit 5ba8066
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions decompiler/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,12 @@ def match(self, regexp):

def python_string(self, clear_whitespace=True):
# parse strings the ren'py way (don't parse docstrings, no b/r in front allowed)
# edit: now parses docstrings correctly. There was a degenerate case where '''string'string''' would
# result in issues
if clear_whitespace:
return self.match(r"""(u?(?P<a>"|').*?(?<=[^\\])(?:\\\\)*(?P=a))""")
return self.match(r"""(u?(?P<a>"(?:"")?|'(?:'')?).*?(?<=[^\\])(?:\\\\)*(?P=a))""")
else:
return self.re(r"""(u?(?P<a>"|').*?(?<=[^\\])(?:\\\\)*(?P=a))""")
return self.re(r"""(u?(?P<a>"(?:"")?|'(?:'')?).*?(?<=[^\\])(?:\\\\)*(?P=a))""")


def container(self):
Expand Down

0 comments on commit 5ba8066

Please sign in to comment.