The command parser only recognized ';' and end-of-string as valid
terminators after commands within a group. A closing brace '}'
immediately following a command (e.g., '/foo/{s/foo/bar/;p}') was
rejected as "extra characters at the end of p command".
Handle '}' the same way as ';' — by jumping back to the command loop —
but without consuming it, so it is properly parsed as an ENDGROUP
command. We also need to do it for substitute as well, since that's
a separate path.
This is an extention to POSIX for more compatibility with the relaxed
criteria that gnu sed also accepts. POSIX.2024 requires the } to be
after a newline or semicolon. Earlier versions just a newline (which
dates back to V7 requiring that it stand on a line by itself).
Assisted-by: Claude (Opus 4.6 1M context)
Sponsored by: Netflix