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

Python: F-strings and string prefixes #1642

Merged
merged 3 commits into from
Dec 2, 2018

Conversation

RunDevelopment
Copy link
Member

This PR adds support for string interpolation (aka. f-strings) and makes the string prefixes part of the string.

Screenshot

image

Known issues

I assumes that strings inside the interpolation expression are 'nice'. So strings with unfortunate numbers of curley braces will cause incorrect highlighting: E.g.: f"{'}'}".


This PR resolves #1636.

@mAAdhaTTah
Copy link
Member

Can we include the "known failure" in our list of list of known failures for Python?

@RunDevelopment
Copy link
Member Author

I also removed the old known issue which works now.

image

@mAAdhaTTah
Copy link
Member

Does that mean #1464 is no longer necessary?

@RunDevelopment
Copy link
Member Author

It is still necessary because it has 3 feature (empty triple-quoted strings, the example, and a fix for comments) of which this only covers the example part.

@mAAdhaTTah mAAdhaTTah merged commit a69c2b6 into PrismJS:master Dec 2, 2018
@RunDevelopment RunDevelopment deleted the python-f-string branch December 2, 2018 18:00
ggrossetie pushed a commit to ggrossetie/prism that referenced this pull request Mar 11, 2019
This PR adds support for [string interpolation](https://www.python.org/dev/peps/pep-0498/) (aka. f-strings) and makes the [string prefixes](https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals) part of the string.

Resolves PrismJS#1636.

### Known issues

Assumes that strings inside the interpolation expression are 'nice'. So strings
with unfortunate numbers of curley braces will cause incorrect highlighting: E.g.: `f"{'}'}"`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python: F-string support
2 participants