Skip to content

Fix Python multi-line f-strings. - #5272

Open
Yilei (yilei) wants to merge 1 commit into
microsoft:mainfrom
yilei:python-f-string
Open

Fix Python multi-line f-strings.#5272
Yilei (yilei) wants to merge 1 commit into
microsoft:mainfrom
yilei:python-f-string

Conversation

@yilei

Copy link
Copy Markdown

This routes f''' and f""" to dedicates states, which will be closed on matching ''' and """ quotes. It also adds the supported raw-string variant prefixes like rf / rF / ...

This should fix #4601.

@nicolasakf

Copy link
Copy Markdown

Hi can we please merge this PR. I patched it locally and it solved the problem for me.

@rdejongeviktor

Copy link
Copy Markdown

Any updates on this?

@jonathanKingston

Copy link
Copy Markdown

I also hit this and independently reached the same fix as — routing f'''/f""" into dedicated multi-line states — which I now ship as a local grammar override, verified against real tokenization output. One gap worth fixing while you're in there: {{/}} literal braces match the interpolation rule and, in a multi-line state, swallow every following line until a }. Adding [/{{|}}/, 'string'] before the interpolation rule fixes it.

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

Successfully merging this pull request may close these issues.

[Bug] new support for Python f-strings breaks with multi-line f-strings

4 participants