Commit 6e63506
fix(parser): expand variables in [[ =~ $var ]] regex patterns (#482)
## Summary
- Fixed `[[ $line =~ $var ]]` regex matching where `$var` was not
expanded
- Root cause: `collect_conditional_regex_pattern()` creates
`Word::literal` bypassing variable expansion
- Fix: when regex pattern contains `$`, use `parse_word()` for
expansion; otherwise use literal collector to preserve
parens/backslashes
Closes #400
## Test plan
- [x] test_regex_match_from_variable
- [x] test_regex_match_literal
- [x] Spec test regex_match_in_conditional still passes
- [x] All 1509 tests pass
Co-authored-by: Claude <noreply@anthropic.com>1 parent 183eaa2 commit 6e63506
2 files changed
+35
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9727 | 9727 | | |
9728 | 9728 | | |
9729 | 9729 | | |
| 9730 | + | |
| 9731 | + | |
| 9732 | + | |
| 9733 | + | |
| 9734 | + | |
| 9735 | + | |
| 9736 | + | |
| 9737 | + | |
| 9738 | + | |
| 9739 | + | |
| 9740 | + | |
| 9741 | + | |
| 9742 | + | |
| 9743 | + | |
| 9744 | + | |
| 9745 | + | |
| 9746 | + | |
| 9747 | + | |
| 9748 | + | |
| 9749 | + | |
| 9750 | + | |
| 9751 | + | |
9730 | 9752 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1263 | 1263 | | |
1264 | 1264 | | |
1265 | 1265 | | |
1266 | | - | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
1267 | 1270 | | |
1268 | | - | |
1269 | | - | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
1270 | 1280 | | |
1271 | 1281 | | |
1272 | 1282 | | |
| |||
0 commit comments