Commit 8610b5d
authored
fix(parser): treat escaped dollar \\$ in double quotes as literal (#972)
## 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
- [x] New spec tests: `backslash_dollar_in_double_quotes`,
`backslash_dollar_with_text`, `backslash_dollar_set_u`,
`backslash_dollar_in_assignment`
- [x] No regressions in existing spec tests
- [x] clippy + fmt clean
Closes #9481 parent 9a2caf2 commit 8610b5d
3 files changed
Lines changed: 50 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
419 | | - | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
420 | 427 | | |
421 | 428 | | |
422 | 429 | | |
| |||
512 | 519 | | |
513 | 520 | | |
514 | 521 | | |
515 | | - | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
516 | 530 | | |
517 | 531 | | |
518 | 532 | | |
| |||
568 | 582 | | |
569 | 583 | | |
570 | 584 | | |
571 | | - | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
572 | 591 | | |
573 | 592 | | |
574 | 593 | | |
| |||
937 | 956 | | |
938 | 957 | | |
939 | 958 | | |
940 | | - | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
941 | 965 | | |
942 | 966 | | |
943 | 967 | | |
| |||
1108 | 1132 | | |
1109 | 1133 | | |
1110 | 1134 | | |
1111 | | - | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
1112 | 1143 | | |
1113 | 1144 | | |
1114 | 1145 | | |
| |||
1332 | 1363 | | |
1333 | 1364 | | |
1334 | 1365 | | |
1335 | | - | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
1336 | 1372 | | |
1337 | 1373 | | |
1338 | 1374 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2539 | 2539 | | |
2540 | 2540 | | |
2541 | 2541 | | |
2542 | | - | |
| 2542 | + | |
| 2543 | + | |
| 2544 | + | |
| 2545 | + | |
| 2546 | + | |
| 2547 | + | |
2543 | 2548 | | |
2544 | 2549 | | |
2545 | 2550 | | |
| |||
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1370 | 1370 | | |
1371 | 1371 | | |
1372 | 1372 | | |
1373 | | - | |
1374 | | - | |
| 1373 | + | |
1375 | 1374 | | |
1376 | 1375 | | |
1377 | | - | |
| 1376 | + | |
1378 | 1377 | | |
1379 | 1378 | | |
1380 | 1379 | | |
| |||
0 commit comments