Repository navigation
fix(eb_parse): balance nested braces in f-string fields - #75
Merged
Merged
Conversation
Scanning for the first closing brace with `find` truncated any
f-string field holding an inline dict literal or a quoted closing
brace, so `f"{ {'a': 1}[k] }"` and `f"{v.replace('.', '}')}"` failed
to parse.
Add `find_fstring_field_end` to balance nested braces while skipping
quoted strings when locating the end of a field.
Replace `starts_prefixed_string` with `string_prefix`, one classifier
for raw and formatted prefixes shared by expression and f-string
parsing. Raw and rf literals already parse on the parent; the added
test pins that behaviour and passes there.
HaoZeke
force-pushed
the
stack/parity-ready
branch
from
November 21, 2026 08:36
5b43d7b to
e7bc9dd
Compare
HaoZeke
force-pushed
the
fix/eb-parse-nested-fstrings-r2
branch
from
November 24, 2026 09:42
d76fd40 to
2b38138
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes f-string fields that hold an inline dict lookup or a quoted closing brace, such as
f"{ {'x86_64': 'amd64'}[ARCH] }"andf"{v.replace('.', '}')}". The scan for the end of a field stopped at the first}.find_fstring_field_endbalances nested braces and skips quoted strings.string_prefixreplacesstarts_prefixed_stringas the single classifier for raw and formatted prefixes.Raw and rf literals already parse on the parent, because #70 merged that handling. The raw-string test pins that behaviour and passes on the parent. Only
fstring_fields_support_nested_dicts_and_quoted_bracesfails there.Stacks on the parity-ready line.