Skip to content

fix(awk): treat # inside regex literals as literal, not comment#840

Merged
chaliy merged 1 commit intomainfrom
fix/issue-835-awk-regex-hash
Mar 26, 2026
Merged

fix(awk): treat # inside regex literals as literal, not comment#840
chaliy merged 1 commit intomainfrom
fix/issue-835-awk-regex-hash

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Mar 26, 2026

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

  • awk_regex_hash_pattern/#/ matches lines containing #
  • awk_regex_hash_caret/^#/ matches comment lines
  • awk_regex_hash_no_match — non-hash regex still works
  • All 119 awk spec tests pass
  • All 1748 bash spec tests pass
  • cargo fmt --check and cargo clippy clean

Closes #835

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.

Closes #835
@chaliy chaliy merged commit d951a45 into main Mar 26, 2026
18 of 23 checks passed
@chaliy chaliy deleted the fix/issue-835-awk-regex-hash branch March 26, 2026 17:23
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: awk parser treats # inside regex /pattern/ as comment

1 participant