Skip to content

fix(parser): handle $'...' ANSI-C quoting in parameter expansion patterns#856

Merged
chaliy merged 3 commits intomainfrom
fix/issue-847-suffix-pattern-ansi-c
Mar 27, 2026
Merged

fix(parser): handle $'...' ANSI-C quoting in parameter expansion patterns#856
chaliy merged 3 commits intomainfrom
fix/issue-847-suffix-pattern-ansi-c

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Mar 27, 2026

Summary

  • ${var%$'\n'} and other ANSI-C quoted patterns now work correctly in parameter expansion
  • Added $'...' handling to parse_word so escape sequences are resolved before pattern matching
  • Also fixes ${var#$'\t'}, ${var%%$'\n'}, etc.
  • Updated chained_string_operations test — removed bash_diff annotation since operand expansion now works correctly

Test plan

  • vop_suffix_removal_ansi_c_newline${str%$'\n'} strips trailing newline
  • vop_suffix_removal_var_newline${str%${nl}} strips trailing newline via variable
  • chained_string_operations — now matches real bash behavior
  • Full spec test suite green
  • Clippy clean

Closes #847

chaliy added 3 commits March 27, 2026 00:05
…erns

Add $'\n', $'\t', etc. support to parse_word so patterns in ${var%$'\n'}
are correctly expanded before matching. Also update chained_string_operations
test expectation since operand expansion now works correctly.

Closes #847
@chaliy chaliy merged commit 4f75c0c into main Mar 27, 2026
23 checks passed
@chaliy chaliy deleted the fix/issue-847-suffix-pattern-ansi-c branch March 27, 2026 00:39
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.

bug: ${var%$'\\n'} doesn't match newline in suffix removal pattern

1 participant