pantoniou / libfyaml

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

Expose a minimal comment-getter API #44

Closed jlblancoc closed 2 years ago

jlblancoc commented 2 years ago

Minimal API for retrieving comments for each node.

PS: Supersedes #42

pantoniou commented 2 years ago

OK, so get the point. The main reason the comment API was not exposed due to the funkiness of multi-line comments. I will rework the patch so that comments are delivered 'pure' without the need to manually remove the "\n# " present.

jlblancoc commented 2 years ago

Awesome! Thanks a lot for your effort!

Anyway, I think that a partially-usable API with documented limitations is always better than no API, in case you don't find spare time for this ;-)

pantoniou commented 2 years ago

Pushed a reworked version of this patch as eb8e6956d8bf67b2cadb811d72f2a12ad4a2d941

The difference is that the comment markers are consumed and the comment text is 'clean' even for multiline comments.

Please test and if this works for your case, I'll close this...

jlblancoc commented 2 years ago

Just brilliant! I got rid of my custom code to handle multiline comments, and all unit tests pass OK :100:

If you don't plan to make any further changes in the short term, I will be willing to get a new official release (0.7.2? 0.8.0? if the latter, please remember to update the VERSION line in the CMakeLists.txt file) to be packaged for Debian/Ubuntu.

Thanks.

pantoniou commented 2 years ago

Glad to hear that it works. Yeah having to do custom processing on the comment text is bad, that's why it was internal.

I will try to get a 0.7.2 out by the end of the week.

Cheers

jlblancoc commented 2 years ago

Ok, better. More time for a more careful testing. :+1: