Skip to content

fix(expansion): handle mixed literal+quoted var in ${var#pattern}#1250

Merged
chaliy merged 1 commit intomainfrom
fix/issue-1161-mixed-pattern-strip
Apr 13, 2026
Merged

fix(expansion): handle mixed literal+quoted var in ${var#pattern}#1250
chaliy merged 1 commit intomainfrom
fix/issue-1161-mixed-pattern-strip

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Apr 13, 2026

Summary

  • ${var#./"$other_var"} now correctly strips the prefix when the pattern mixes literals and quoted variables
  • Added strip_operand_quotes() to remove unescaped double quotes from operand strings before expansion
  • Modified lexer to use NUL sentinel for escaped quotes (\") inside ${...} to distinguish literal " from quoting "

Test plan

  • ${i#./"$prefix_tags"} correctly strips ./tag_ prefix
  • All 15 spec test suites pass (no regressions)
  • cargo clippy clean

Closes #1161

${var#./"$other"} failed because double quotes in operands were kept
as literal characters. Add strip_operand_quotes() to remove unescaped
double quotes from operand strings before expansion. Use NUL sentinel
in lexer for escaped quotes (\") inside ${...} to distinguish literal
quotes from quoting markers.

Closes #1161
@chaliy chaliy merged commit deb0d42 into main Apr 13, 2026
27 checks passed
@chaliy chaliy deleted the fix/issue-1161-mixed-pattern-strip branch April 13, 2026 11:34
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.

fix(expansion): ${var#./"$other_var"} fails to strip when pattern mixes literals and quoted vars

1 participant