support smart triple quote escaping
vapier opened this issue · 1 comments
vapier commented
we normally use """
for our triple quoted strings. but we have a string that ends with a "
, so we switched it to '''
. we can't end with """"
because python stops scanning at the first triple quotes it sees.
since there's smart quoting logic for single/double, there should support for this as well.
# Reduced test case.
f = '''blah "some string"'''
# This is a parse error.
f = """blah "some string""""
# This requires escaping (undesirable).
f = """blah "some string\""""
NB: i'm aware the example doesn't need triple quotes ... our code base actually was multiline strings where triple quotes made sense. this is just a reduced testcase to make it easy to reason about.
vapier commented
looks like nested triple quotes should also be handled (but currently are not)
f = '''some string
with """ in the middle
'''
f = """some string
with ''' in the middle
"""