3 Commits

Author SHA1 Message Date
John Bartholomew
4e0952795e improve handling of YAML document streams in std.parseYaml
This doesn't make them fully correct, in particular directives sections
(e.g., "%YAML 1.2" directive before a document start marker) are not
handled correctly, but they weren't handled correctly before, either.

It also doesn't recognise or try to do anything about document end
markers (`...`).

This fix does allow scalar documents to be on the same line as the
document start tag which is valid per examples in the YAML spec,
see for example https://yaml.org/spec/1.2.1/#id2760844
(YAML 1.2.1 spec, section 2.3 Scalars)

It also matches the C++ jsonnet output for std.parseYaml("42\n---"),
which is a stream of two documents, a scalar and then an empty document
(where the empty document is interpreted as JSON null)
2026-03-08 13:43:04 +00:00
Yuki Yugui Sonoda
868d9c6f11
Resolves a false-positive detection of multi-doc YAML streams (#693)
Fixes #673.
2023-05-03 19:37:04 +01:00
Greg Roodt
e6a9581713
Adds std.parseYaml (#339)
Add support for std.parseYaml.

Co-authored-by: Stanisław Barzowski <stanislaw.barzowski@gmail.com>
2021-05-20 14:16:23 +02:00