You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Oh boy. My earlier attempt at this got me sniped pretty hard!
I actually did get started with https://lib.rs/crates/yaml_parser which creates rowan concrete syntax trees, but editing those was incomprehensible to me due both to confusing rowan docs and the bizarre structure that it parses. Maybe there's more juice down that path, but the squeeze was no fun.
Inevitably, I thought "surely it's not that hard to write a yaml parser," and my fate was sealed. That said, I think I got it up to recognizing a decent chunk of the test suite with code gen from the grammar repo, but ran into similar lack of docs and it's annoyingly not in sync with the actual spec text, so then i saw it was generated from the spec markdown...
As noted on readme and lib.rs,
catalog add
usesprettier
for formatting of the yaml, and isnt comment preserving.xbcsmith/ymlfxr#2 was my last foray into comment preserving yaml in Rust.
yaml-rust2
writes pretty yaml, but isnt comment preserving.https://crates.io/crates/tree-sitter-yaml might be comment preserving.
c.f. https://github.com/tree-sitter-grammars/tree-sitter-yaml/blob/master/src/node-types.json#L483
But that adds a dependency on a C compiler, and is a lot more effort to read and write.
https://github.com/pantoniou/libfyaml is likely the best route, and rust wrappers are improving https://crates.io/search?q=libfyaml
The text was updated successfully, but these errors were encountered: