Skip to content

fix(awk): treat newlines as statement separators in action blocks#831

Merged
chaliy merged 1 commit intomainfrom
fix/issue-809-awk-newline-sep
Mar 26, 2026
Merged

fix(awk): treat newlines as statement separators in action blocks#831
chaliy merged 1 commit intomainfrom
fix/issue-809-awk-newline-sep

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Mar 26, 2026

Summary

  • Preprocess awk programs to normalize newlines to semicolons inside {...} blocks
  • Skip empty statements (consecutive semicolons) in parse_action_block
  • Respects string literals, regex literals, and comments during normalization

Test plan

  • awk_newline_separates_assignments{ x=1\n y=2\n print x, y } works
  • awk_semicolons_still_work — explicit semicolons unchanged
  • awk_newline_after_if — assignment after if on separate line
  • Full test suite passes (all 2100+ awk tests)

Closes #809

Closes #809 — awk programs with newline-separated statements like
`{ x=1\n y=2 }` now work without requiring explicit semicolons.

Approach: preprocess awk program to normalize newlines to semicolons
inside `{...}` blocks (respecting strings and regex literals). Also
added skip of empty statements in parse_action_block to handle
consecutive semicolons.
@chaliy chaliy merged commit b94c526 into main Mar 26, 2026
18 of 23 checks passed
@chaliy chaliy deleted the fix/issue-809-awk-newline-sep branch March 26, 2026 14:37
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 doesn't treat newlines as statement separators between assignments

1 participant