pantoniou / libfyaml

Fully feature complete YAML parser and emitter, supporting the latest YAML spec and passing the full YAML testsuite.
MIT License
243 stars 74 forks source link

Small changes regarding fy-tool's new --tsv-format #71

Open ingydotnet opened 1 year ago

ingydotnet commented 1 year ago

Currently to use fy-tool --tsv-event you also need --testsuite.

When I asked for the tsv output, it had nothing to do with the test suite, even though that output is also one event per line.

The purpose of tsv was for writing a loader/composer using fyaml by just reading stdin rather than needing to do a formal C binding. This could be useful for all sorts of things, and honestly we might do well to make this into a separate binary called bin/yaml-parse-events at some point.

Also it's a bit wrong to have --testsuite as the option for events formatted for testing with the suite. In the future we will likely have other tests in the suite besides parse events.

My suggestions at this point would be:

You can keep --testsuite as an alias for --mode=events-testsuite.


I'd also like the events-tsv output to add a =ERR output line when a parse error occurs. It should contain the line position numbers and the error message.

That way a loader built over it could handle/format the error as it sees fit. This would be cleaner than the loader having to capture an actual parse error from fy-tool.

Note: This =ERR should not be added to the events-testsuite output.