Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support smart triple quote escaping #20

Open
vapier opened this issue Aug 1, 2019 · 1 comment
Open

support smart triple quote escaping #20

vapier opened this issue Aug 1, 2019 · 1 comment

Comments

@vapier
Copy link

vapier commented Aug 1, 2019

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
Copy link
Author

vapier commented Aug 1, 2019

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
"""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant