Skip to content

Reject ambiguous Unicode line separators in comments#47

Draft
sidsri14 wants to merge 1 commit into
tailscale:masterfrom
sidsri14:fix/reject-line-separator-ambiguity
Draft

Reject ambiguous Unicode line separators in comments#47
sidsri14 wants to merge 1 commit into
tailscale:masterfrom
sidsri14:fix/reject-line-separator-ambiguity

Conversation

@sidsri14

Copy link
Copy Markdown

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 using the parser's existing invalid-character errors
  • 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.

Testing

  • go test -count=1 ./...
  • go test -count=1 ./cmd/hujsonfmt/...
  • go vet ./...
  • go vet ./cmd/hujsonfmt/...
  • gofmt -s -d parse.go json_test.go

Fixes #43

Signed-off-by: sid sri <sidsri1502@gmail.com>
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?

1 participant