Commit d951a45
authored
fix(awk): treat # inside regex literals as literal, not comment (#840)
## Summary
- The awk normalizer now recognizes regex literals (`/pattern/`) in both
pattern and action contexts
- Previously, regex was only recognized inside `{ }` braces, so `/#/` in
a pattern position caused `#` to be treated as a comment start,
resulting in "unterminated regex" errors
## Test plan
- [x] `awk_regex_hash_pattern` — `/#/` matches lines containing `#`
- [x] `awk_regex_hash_caret` — `/^#/` matches comment lines
- [x] `awk_regex_hash_no_match` — non-hash regex still works
- [x] All 119 awk spec tests pass
- [x] All 1748 bash spec tests pass
- [x] `cargo fmt --check` and `cargo clippy` clean
Closes #8351 parent e0370ba commit d951a45
File tree
2 files changed
+23
-2
lines changed- crates/bashkit
- src/builtins
- tests/spec_cases/awk
2 files changed
+23
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
402 | 402 | | |
403 | 403 | | |
404 | 404 | | |
405 | | - | |
406 | | - | |
| 405 | + | |
| 406 | + | |
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
703 | 703 | | |
704 | 704 | | |
705 | 705 | | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
0 commit comments