by Ygg2 · 3y ago · 0 comments
I asked it to write a YAML parser in pure Rust. The first thing it did was write this:
pub enum YamlNode {
Scalar(String),
Sequence(Vec<YamlNode>),
Map(HashMap<String, YamlNode>),
}
This is what I expect a freshman in college to write as their first Yaml parser.Literally unusable as a starting point.
I did try to correct it but it tripped up and somehow managed to fuck that up to.
YAML allows YamlNodes as keys in a map (aka complex keys). E.g.
? [ a, b]
: "complex key, scalar value"
You asked it for YAML parser and it gave you a shitty JSON parser.Also this is the most banal thing about YAML, something that should be obvious just browsing the examples. And I gave it test suite and link to YAML spec.
Most work in YAML is around super obscure corner cases.