Skip to content

fix(lexers): handle line continuations in Python f-strings - #1474

Merged
github-actions[bot] merged 1 commit into
alecthomas:masterfrom
yxshee:codex/chroma-python-fstring-continuation
Nov 10, 2026
Merged

github-actions[bot] merged 1 commit into
alecthomas:masterfrom
yxshee:codex/chroma-python-fstring-continuation

Conversation

@yxshee

@yxshee yxshee commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Here's an example of an f-string python 3.13 will run but we mark the continuation backslash as Error:

result = f"{1 + \
2}"
assert result == "3"

We can handle line continuations in the shared expr state. This will allow us to treat them as Text for both regular and nested fstring exprs. Will match on LF, CRLF and CR line endings.

New fixture errors out on master with Found Error token. Fix allows the new fixture to pass as well as 576 Python-executed cases. Controls (20) and python corpus token comparisons (1135) remain unchanged. bit -f test, bit -f lint, bit -f check-generated and go test -count=1 ./... all pass.

@github-actions
github-actions Bot enabled auto-merge (squash) November 10, 2026 13:18
@github-actions
github-actions Bot merged commit 2c145ee into alecthomas:master Nov 10, 2026
4 checks passed
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.

1 participant