PureYAML/Sources/Emitting
Mihaela Mihaljevic 2fcf54684e fix: correct emitter and tagged round-trip and validation bugs
Seven correctness fixes to the recently landed anchors/styles, canonical,
timestamp/binary, and full-node-key work, each reproduced and covered by a
regression test.

- Stream dump doubled the `---` marker under explicitDocumentStart or
  canonical: the single-document body now renders marker-free and the
  stream path owns marker emission, so a two-document stream reparses as
  two documents, not four.
- Tagged flow-mapping keys used block-context safety, so a key like `a,b`
  emitted bare and reparsed as several entries; flow keys now use the
  flow-aware plain-scalar check.
- Plain scalars ending in `:` reparse as an empty-valued mapping key, so
  both the model and tagged emit paths now fall back to quoting them.
- An alias mapping key pointing at a defined non-scalar anchor raised the
  misleading undefinedAlias; it now raises expectedScalarKey, and a truly
  undefined alias key still raises undefinedAlias.
- Tagged duplicate-key detection keyed on source spelling: it now keys on
  the resolved scalar value plus effective tag, so 0x1 and 1 collide while
  1 and "1" do not and custom-tagged keys stay distinct.
- Dumping a tree nested past the emitter limit overflowed the stack.

- Timestamp now accepts a leap-second value of 60, counted as 60 elapsed
  seconds in the epoch math.
- Tagged.Dumper honors sortKeys in its block and canonical paths for
  all-plain-string-key mappings, matching the model dumper.

Nesting-guard design: dump is public and non-throwing across 90+ call
sites, so making it throwing would be a breaking change. A tree nested
deeper than the parser's own maxNestingDepth cannot round-trip through
PureYAML (the parser rejects it), so no faithful emission exists. Each
dump entry point now measures depth iteratively (no recursion, so the
guard itself cannot overflow) and, past the limit, returns a documented,
reparseable marker document that resolves to null. Under the limit the
existing recursive renderers run byte-identically, so parsed trees and
every realistic hand-built tree are unaffected. This mirrors the parser's
enforceNestingLimit, which bounds depth before any recursive consumer.
2026-07-16 16:29:08 +02:00
..
Dumper.Canonical.swift fix: correct emitter and tagged round-trip and validation bugs 2026-07-16 16:29:08 +02:00
Dumper.Mapping.swift feat(emitting): add indentWidth and sortKeys emitter options 2026-07-10 17:49:44 +02:00
Dumper.NestingLimit.swift fix: correct emitter and tagged round-trip and validation bugs 2026-07-16 16:29:08 +02:00
Dumper.ScalarAnalysis.swift fix: correct emitter and tagged round-trip and validation bugs 2026-07-16 16:29:08 +02:00
Dumper.Stream.swift fix: correct emitter and tagged round-trip and validation bugs 2026-07-16 16:29:08 +02:00
Dumper.swift fix: correct emitter and tagged round-trip and validation bugs 2026-07-16 16:29:08 +02:00
Dumper.Wrap.swift feat(emitting): add canonical mode, document markers, and lineWidth 2026-07-12 14:13:19 +02:00
Emitting.CollectionStyle.swift feat(emitting): add flow collection output 2026-06-05 11:09:58 +02:00
Emitting.ScalarStyle.swift feat(emitting): add literal block scalar output 2026-06-05 11:06:19 +02:00
Options.swift feat(emitting): add canonical mode, document markers, and lineWidth 2026-07-12 14:13:19 +02:00