Skip to content

fix(parser): backslash escapes after a quoted segment - #2550

Merged
chaliy merged 1 commit into
mainfrom
claude/fidelity-quote-escape
Oct 7, 2026
Merged

chaliy merged 1 commit into
mainfrom
claude/fidelity-quote-escape

Conversation

@chaliy

@chaliy chaliy commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Requested by Михайло · project thread

What changed

The lexer now handles a backslash escape that directly follows a quoted segment inside the same word ('a'\''b', "x"\$y). The escaped char is kept literal and marked quoted; \<newline> is still a line continuation.

Why

'a'\''b' is the standard way to put a single quote inside a single-quoted string, and nested sh -c '...'\''...'\''...' scripts depend on it. Bashkit rejected it as an unterminated quote.

Before

$ echo 'a'\''b'
bashkit: parse error: unterminated single quote
$ sh -c 'sh -c '\''echo deep'\'''
(no output)

After

$ echo 'a'\''b'
a'b
$ sh -c 'sh -c '\''echo deep'\'''
deep

Matches bash 5.2 on the three new spec cases in quote.test.sh.

Risk

Low. Lexer-only change in one continuation path; full lib (2992) and integration (1502) suites pass. Known remaining gap logged in knowledge: ${x:-'d'} unquoted keeps the single quotes.

Checklist

  • Failing spec cases first
  • cargo fmt, cargo clippy -D warnings
  • knowledge/log.md updated

https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA


Generated by Claude Code

@chaliy chaliy self-assigned this Oct 7, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit d1d5499 Commit Preview URL

Branch Preview URL
Oct 07 2026, 07:44 AM

`'a'\''b'` failed with "unterminated single quote", and `"a"\$x`,
`'a'\ b`, `"g"\*` kept the backslash. The quote-continuation reader now
treats `\c` as a quoted `c` and backslash-newline as a continuation.

Claude-Session: https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
@chaliy
chaliy force-pushed the claude/fidelity-quote-escape branch from 6574b4b to d1d5499 Compare October 7, 2026 07:43
@chaliy
chaliy merged commit e6f5ea4 into main Oct 7, 2026
43 checks passed
@chaliy
chaliy deleted the claude/fidelity-quote-escape branch October 7, 2026 08:16
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