The fix itself is easy by adding an empty check before the return, however care needs to be taken to correctly parse an empty yaml document according to spec. Based on https://stackoverflow.com/a/62467269, returning null for an empty yaml document is likely the only spec-compliant answer. On the other Hand, if we follow the documented restrictions of the std.parseYaml then we should instead throw an error stating that scalars at the root are not supported. On the other, other Hand, the parser currently actually supports parsing both documents consisting only of comments and integer scalars, partially invalidating the documented restriction.
If you can give me guidance as to what the expected behaviour should be (return null, return empty map, return error) I'd be happy to provide a pull request
The fix itself is easy by adding an empty check before the return, however care needs to be taken to correctly parse an empty yaml document according to spec. Based on https://stackoverflow.com/a/62467269, returning null for an empty yaml document is likely the only spec-compliant answer. On the other Hand, if we follow the documented restrictions of the std.parseYaml then we should instead throw an error stating that scalars at the root are not supported. On the other, other Hand, the parser currently actually supports parsing both documents consisting only of comments and integer scalars, partially invalidating the documented restriction.
If you can give me guidance as to what the expected behaviour should be (return null, return empty map, return error) I'd be happy to provide a pull request