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

Parse multiline expressions in f-strings #1027

Merged
merged 2 commits into from
Oct 2, 2023
Merged

Conversation

zsol
Copy link
Member

@zsol zsol commented Oct 1, 2023

Summary

PEP 701 relaxed the rules around f-strings. This PR updates the tokenizer to support multiline expressions in f-strings always (regardless of triple quotes). Fixes #989.

Test Plan

Added test cases

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 1, 2023
@codecov-commenter
Copy link

codecov-commenter commented Oct 1, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (74e8a0e) 91.09% compared to head (c7b3830) 91.09%.
Report is 1 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1027   +/-   ##
=======================================
  Coverage   91.09%   91.09%           
=======================================
  Files         255      255           
  Lines       26564    26564           
=======================================
  Hits        24198    24198           
  Misses       2366     2366           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zsol zsol changed the title Allow multiline expressions in f-strings Parse multiline expressions in f-strings Oct 1, 2023
@zsol zsol merged commit 5df1569 into main Oct 2, 2023
24 of 25 checks passed
manmartgarc pushed a commit to manmartgarc/LibCST that referenced this pull request Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tokenizer error when triple-quoted f-string inside single-quoted f-string
3 participants