Changelog
Source:NEWS.md
zuyaml 0.1.1
A bug-fix release. Several of these fixes correct values that 0.1.0 returned silently wrong, so upgrading is recommended.
Bug fixes
Integers above 2^64 keep their digits. 0.1.0 wrapped some of them modulo 2^64 without a warning:
43526186596692760666came back as thezuyaml_bigint"6632698449273657434"(#37).Hex and octal integers beyond 64 bits, and negative ones below -2^63, are
zuyaml_bigintlike their decimal spellings and followbig_integers. 0.1.0 returned them as strings. A hex or octal literal longer than 4096 digits is refused with codelimit_size(#31).yaml_emit()quotes every string the parser would read back as another type."-0x10","+0o7","nULL","tRUE"and".iNf"used to be emitted plain and came back as-16L,7L,NULL,TRUEandInf(#30).yaml_emit()translates names to UTF-8 as it does values. A latin1 name produced output that was not valid UTF-8, and two names with the same text in different encodings were not caught as duplicates (#32).Deeply nested flow collections (
[[[...]]],{a: {a: ...}}) are refused as soon as they passmax_depth. Before, the whole document was scanned first, in time growing with the square of the depth: 80 KB of[took ten seconds, so a small hostile document could hold the parser for hours. The error is stilllimit_depth. A document that is both too deep and invalid in another way now reportslimit_depthrather than the other error (#28, #34).Nesting deeper than the C stack allows, possible with
max_depth = 0or with a deeply nested list given toyaml_emit(), raises R’sstackOverflowErrorinstead of crashing the session. The defaultmax_depthtrips first with a wide margin, measured at about 10x on a 256 KB stack (#8).yaml_emit()of more than an R string can hold (2^31 - 1 bytes) is an error with codelimit_size. It used to hang, uninterruptibly, once the strings being emitted passed 2 GB, or fail with “negative length vectors are not allowed” (#8, #33).Errors found while converting a parsed document (
duplicate_key,limit_depth,limit_nodes,precision,alias,unsupported_tag) carrylineandcolumn, andpathwhen reading a file; they wereNULL. An end position that is not known isNULLrather than0(#35).
Other changes
- Numbers are converted by the header-only zufast package (
LinkingTo:) instead of the C library’sstrtod(), so floats are correctly rounded on every platform. Under an explicit!!floattag, text that is C number syntax but not YAML float syntax is now a string, as under every other core tag:!!float 0x10,!!float 0x1p3and!!float infused to give 16, 8 andInf(#14).
zuyaml 0.1.0
CRAN release: 2026-10-07
First release. The API is complete and the package is well tested, but it is not frozen: names, defaults and return types may still change. Pin the version if you depend on it.
Features
yaml_parse()/yaml_parse_all()parse YAML 1.2 from a string or a raw vector,yaml_emit()/yaml_emit_all()convert R objects back to YAML, andyaml_read()/yaml_read_all()/yaml_write()/yaml_write_all()do the same for files. Throughout,_allmeans a YAML stream: several documents separated by---, which is a different thing from a sequence.Scalars follow the YAML 1.2 core schema, so
yesandnoare strings and dates are not coerced. Quoted scalars are always strings, and a quoted empty string never becomesNULL.Integers beyond 2^53 are preserved as
zuyaml_bigintrather than silently rounded.big_integersselects a different policy.Tags override schema resolution, so
!!str 12is the string"12", in every spelling a core tag has: the shorthand, the verbatim form, and a handle bound by a%TAGdirective. Application tags such as!durationare ignored by default;tags = "error"refuses them.Mappings whose keys are sequences or mappings become
zuyaml_maprather than having their structure flattened into names. This is parse-only.Errors are classed conditions carrying a stable
code,lineandcolumn, so callers never have to match on message text.max_size,max_depthandmax_nodesbound untrusted input. The last of these is what stops alias-expansion bombs, which are small and shallow by construction and so escape the first two.A value emitted with
yaml_emit()parses back to the same value. Strings containing a line break, and strings with leading or trailing whitespace, are quoted so that neither is lost; a double with an integral value emits as1.0, so it does not come back as an integer; and mapping keys are treated exactly like values. Asserted over the whole yaml-test-suite and over generated input. The exceptions are listed invignette("zuyaml").A literal NUL byte in the input is refused with an
embedded_nulcondition and a position. The underlying library treats one as end of input, so the rest of the document – including any later documents in the stream – would otherwise be discarded without a word.A UTF-8 byte order mark at the start of a stream is not part of the document.
A float outside the range of a double converts to the nearest one:
1e309isInf,1e-324is0, and1e-323is the subnormal it names. One extreme value never changes the R type of a field.