Skip to content

fix(parser): treat escaped dollar \\$ in double quotes as literal#972

Merged
chaliy merged 1 commit intomainfrom
fix/issue-948-escaped-dollar
Apr 2, 2026
Merged

fix(parser): treat escaped dollar \\$ in double quotes as literal#972
chaliy merged 1 commit intomainfrom
fix/issue-948-escaped-dollar

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Apr 2, 2026

Summary

  • Fix \$ inside double quotes expanding as variable instead of literal $
  • Root cause: lexer correctly converts \$ to $ but parse_word() re-interprets it as variable expansion
  • Used sentinel character to distinguish escaped dollars from genuine expansion markers

Test plan

  • New spec tests: backslash_dollar_in_double_quotes, backslash_dollar_with_text, backslash_dollar_set_u, backslash_dollar_in_assignment
  • No regressions in existing spec tests
  • clippy + fmt clean

Closes #948

The lexer correctly handles \$ → $ but parse_word() re-interprets the
resulting $ as a variable expansion. Use a NUL sentinel to distinguish
escaped dollars from genuine expansion markers.

Closes #948
@chaliy chaliy merged commit 8610b5d into main Apr 2, 2026
27 checks passed
@chaliy chaliy deleted the fix/issue-948-escaped-dollar branch April 2, 2026 06:21
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.

\$ inside double quotes expands as variable instead of literal $

1 participant