Commit Graph

2 Commits

Author SHA1 Message Date
70c3da85a3 feat(parsing): parse block mappings with empty keys
A ':' value indicator with no preceding key on its line denotes a
mapping entry whose key is empty (null), which YAML 1.2 permits but
libyaml rejects with 'did not find expected key'. The block-mapping-key
parser now emits the empty scalar key and leaves the VALUE token for the
value state to consume, rather than throwing.

Fixes the canonical event streams for plain empty-key mappings, explicit
empty keys with anchors and aliases, empty keys nested in sequences, and
mixed empty-key/value entries. Port score 275 -> 282; surpasses libyaml
on 2JQS, 6M2F, M2N8/00, NHX8, S3PD, SM9W/01, UKK6/00.
2026-06-24 18:27:45 +02:00
521062d974 feat(parsing): port libyaml parser state machine to Swift
Ports parser.c: the one-event-at-a-time state machine that turns the
scanner's token stream into the YAML event stream. Covers stream and
document framing, directive processing with %TAG handle resolution and
default handles, the node property/tag/anchor production, block and
indentless sequences, block mappings, and flow sequences and mappings
including the single-pair `?` mapping forms.

Output verified against the libyaml reference event dumper: the empty
mapping value, %TAG resolution, and shorthand tags all match byte for
byte. 331 tests, no regression.
2026-06-24 17:05:59 +02:00