Commit Graph

2 Commits

Author SHA1 Message Date
31da488055 fix(parsing): allow a flow mapping entry with no value
A flow mapping entry may omit its `:` value indicator, in which case its key
maps to null: `{ a }` and `{ a, b }` are flow sets. parseFlowMappingPair
required a `:` after every key, so it rejected these entries, and rejected a
valueless key that spanned lines (`{ multi\n  line, a: b}`) with them.

Parse a value only when a `:` follows the key; otherwise emit a null value for
the key. A unit test that asserted `{ a, }` was an error is corrected to expect
the set `{a: null}`, the behaviour the yaml-test-suite cases 8KB6 and 9BXH
require.

Raises yaml-test-suite parse-level conformance to 304/333 (91.3%) and
value-level to 195/197, with the should-error rejection rate unchanged.
480 tests pass.
2026-06-29 01:42:02 +02:00
956f42bbb7 fix(parsing): allow an empty key in a flow mapping
A flow mapping entry may begin with its `:` indicator for an empty key
(`{ : value }`) or carry only properties before the `:` (`{ !!str : value }`).
Both resolve to a null key, but parseFlowMappingPair required a node before
the `:` and raised "expected a YAML node".

Emit a null key in that position instead, mirroring the empty-value handling
already present after the `:`. The change consumes the key's properties first
so a property-only key keeps its tag or anchor, and is confined to flow
mapping key position, where a null key is unambiguously valid; an entry with
no `:` at all (`{ a, }`) still errors.

Raises yaml-test-suite parse-level to 297/333 (89.2%) and value-level to
174/192, with the should-error rejection rate unchanged (no invalid document
newly accepted). 422 tests pass.
2026-06-28 19:23:49 +02:00