Repository navigation
Conversation
`Parser::parse_atom` in `src/eb_parse.rs` dispatched formatted strings only on a leading `f` or `F`, so `rf` prefixes fell through to identifier lookup even though `starts_fstring` intended to allow them. Plain raw strings such as `r'...'` also failed as unknown identifiers, and raw formatted strings passed through `parse_string` where backslash escapes were interpreted instead of preserved verbatim. Inside `parse_fstring`, scanning for the first closing brace with `find` truncated any field containing an inline dict literal or a quoted closing brace. Replace `starts_fstring` with `string_prefix` to classify raw and formatted prefixes consistently across expression and f-string parsing, and add `parse_raw_string` so raw literals keep backslashes intact. Add `find_fstring_field_end` to balance nested braces and skip quoted strings when locating the closing brace of an f-string field.
Collaborator
Author
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.
Parser::parse_atominsrc/eb_parse.rsdispatched formatted stringsonly on a leading
forF, sorfprefixes fell through toidentifier lookup even though
starts_fstringintended to allow them.Plain raw strings such as
r'...'also failed as unknown identifiers,and raw formatted strings passed through
parse_stringwhere backslashescapes were interpreted instead of preserved verbatim. Inside
parse_fstring, scanning for the first closing brace withfindtruncated any field containing an inline dict literal or a quoted
closing brace.
Replace
starts_fstringwithstring_prefixto classify raw andformatted prefixes consistently across expression and f-string parsing,
and add
parse_raw_stringso raw literals keep backslashes intact. Addfind_fstring_field_endto balance nested braces and skip quotedstrings when locating the closing brace of an f-string field.