Open Tricertops opened 7 years ago
Hi @Tricertops. I agree with you in principal. libyaml should also have a mode where it parses and emits whitespace, for use in things like editors that can't throw away any characters.
With comments the devil is in the details. Full line comments might be easier to start with.
I think to move this idea forward, you should add a number of tests to the test suite. That will allow us to think through the details.
The test suite is: git@github.com:yaml/yaml-test-suite Send us a PR or two.
bump
Is that topic still worth researching or is it a WONTFIX?
Would it make sense to establish a more exhaustive list of what's needed to get full line comments
support?
I leave my upvote for this feature.
Currently, there is no way to write or read comments using this library.
I understand that comments are intended only for humans, so parsing them into runtime model makes little sense. However, there might be a valid case when some runtime model is written to a file that will be read by humans. Imagine an auto-generated configuration file annotated with comments for further human editing.
This would also allow editing files using this lib without losing human-created coments (even if the exact formatting would be lost).
Supporting comments would probably require these new public APIs:
YAML_COMMENT_TOKEN
in enumyaml_token_type_t
YAML_COMMENT_EVENT
in enumyaml_event_type_t
yaml_comment_event_initialize(yaml_event_t *event, yaml_char_t *content)