Skip to content

release: streaming JSON emitter + unified escapers#350

Merged
octalide merged 5 commits into
mainfrom
dev
Jul 2, 2026
Merged

release: streaming JSON emitter + unified escapers#350
octalide merged 5 commits into
mainfrom
dev

Conversation

@octalide

@octalide octalide commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Release dev -> main. Two merges since the auxv-page-size release:

The #337/#340 parse/emit asymmetry warnings are preserved; #340 remains open.

octalide and others added 5 commits July 2, 2026 14:15
chore: update stale octalide URLs to briar-systems
Move the streaming ASCII escaper from the mach compiler's mach.cli.json
into std.data.json as the one JSON emission home, and unify it with the
tree emitter's structural escaper into a single escape core.

escape_unit takes an explicit policy: ESCAPE_VERBATIM (structural, UTF-8
bytes verbatim) drives the tree emitter emit(); ESCAPE_ENSURE_ASCII
(RFC 3629 decode to \uXXXX, astral surrogate pairs, U+FFFD on invalid
input) drives the streaming surface. The tree emitter now renders through
a counting io.Writer (BufWriter) so both surfaces share one sink and one
escaper; emit() keeps its measure-when-short semantics.

Add the streaming NDJSON surface (Object, object_begin/object_end,
field_str/field_str_or_null/field_i64/field_bool, write_json_string)
ported verbatim from mach.cli.json, with its exact-byte tests plus a
full-object call-sequence test. Tree and streaming output are
byte-identical to their pre-unification form. The #337/#340 parse/emit
representation asymmetry warnings are preserved.

Closes #338
…ters

Re-port the streaming NDJSON surface from the current mach dev, which
mach#1838 extended past the flat-object surface the first port captured.

Add the Array record and the nesting primitives object_end_value,
field_object_begin, field_array_begin, array_end, array_object_begin,
and field_null, ported verbatim with their Object.first / Array.first
comma-state machine intact. object_end now closes via object_end_value
and writes the sole NDJSON line terminator, so a whole nested object
still lands on one line.

Port mach#1838's exact-byte compose tests (nested object + array-of-
objects, empty array) and exercise field_null in the flat sequence test.
The full public surface and byte output match the compiler's current
mach.cli.json, so the mach-side rewire is a use swap.
…itter

feat(data/json): unify JSON escapers and add streaming NDJSON emitter
@octalide octalide merged commit 40a8ab5 into main Jul 2, 2026
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.

1 participant