Skip to content

Reject ambiguous Unicode line separators in comments - #48

Merged
bradfitz merged 1 commit into
tailscale:masterfrom
sidsri14:agent/reject-line-separator-ambiguity-dco
Jul 27, 2026
Merged

Reject ambiguous Unicode line separators in comments#48
bradfitz merged 1 commit into
tailscale:masterfrom
sidsri14:agent/reject-line-separator-ambiguity-dco

Conversation

@sidsri14

Copy link
Copy Markdown
Contributor

Summary

  • reject U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR when they appear inside // comments
  • report the ambiguous character at its precise byte location, including line comments at EOF
  • preserve RFC 8259 behavior by accepting both characters inside JSON strings and block comments while rejecting them as whitespace

This avoids inputs whose meaning changes between HuJSON/JWCC and JavaScript-style comment parsers.

Replaces #47. The branch was recreated without rewriting history so the consolidated commit carries the required DCO sign-off.

Testing

  • go test -count=1 ./...
  • go test -count=1 ./cmd/hujsonfmt/...
  • go test -count=50 -run '^TestLineSeparators$' .
  • go test -race -count=3 -run '^TestLineSeparators$' .
  • go vet ./...
  • go vet ./cmd/hujsonfmt/...
  • gofmt -s -d parse.go json_test.go
  • git diff --check

Fixes #43

Signed-off-by: sid sri <sidsri1502@gmail.com>
@sidsri14
sidsri14 marked this pull request as ready for review July 27, 2026 12:18
@bradfitz
bradfitz merged commit b80ff77 into tailscale:master Jul 27, 2026
5 checks passed
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.

Allow U+2028 and U+2029 as line terminator for single-line comments?

2 participants