Erik@Grijjy 123 Posted June 3, 2019 Just finished a personal project for consuming and creating YAML in Delphi: https://blog.grijjy.com/2019/06/03/a-yaml-library-for-delphi/ 6 3 Share this post Link to post
David Heffernan 2345 Posted June 3, 2019 This looks mighty cool. Kudos to you once again. In my codebase at work we use an in-house bespoke wrapper of libyaml. The big difference from yours, I suspect, is that we needed to support very large files, and opted for a SAX type interface. Share this post Link to post
Erik@Grijjy 123 Posted June 3, 2019 1 minute ago, David Heffernan said: In my codebase at work we use an in-house bespoke wrapper of libyaml. The big difference from yours, I suspect, is that we needed to support very large files, and opted for a SAX type interface. Yes, my library isn't really suitable for very large files, since it loads the entire file into memory. Since YAML is used a lot for small(ish) files, I wanted to keep it simple. I may add a SAX type interface at some point. Libyaml already provides a such an interface (it is what I used to build the DOM) and it could be adopted to something more Delphi-friendly... 2 Share this post Link to post
Rollo62 536 Posted June 3, 2019 (edited) Thanks for the nice library. Maybe this is also an useful info to get a better understanding how it is related to the JSON format. Edited June 3, 2019 by Rollo62 Share this post Link to post
Erik@Grijjy 123 Posted June 3, 2019 3 minutes ago, Rollo62 said: Thanks for the nice library. Maybe this is also an useful info to get a better understanding how it is related to the JSON format. That definitely makes it easier to work with YAML if you are familiar with JSON. YAML 1.2 is even a superset of JSON, so it can parse JSON as well. Unfortunately (or maybe for the better), libyaml only supports YAML 1.1. Share this post Link to post
Edwin Yip 154 Posted June 4, 2019 (edited) 21 hours ago, Erik@Grijjy said: That definitely makes it easier to work with YAML if you are familiar with JSON. YAML 1.2 is even a superset of JSON, so it can parse JSON as well. Unfortunately (or maybe for the better), libyaml only supports YAML 1.1. When I'm reading the YAML introduction part of your article, I map its syntax to JSON, and mostly notice the differences, it's so easy to understand this way! And what another GREAT and useful library you (and the grijjy team) have created! As far as I know, this is the first open source Pasal/Delphi library for manipulating YAML. Edited June 4, 2019 by edwinyzh 1 Share this post Link to post
Stefan Glienke 2005 Posted June 4, 2019 Does it pass https://github.com/yaml/yaml-test-suite ? Share this post Link to post
Sherlock 663 Posted June 4, 2019 I love and use YAML for the cleanness and built in support for "complex" types such as date time....other than JSON for example. Wrote my own YAML thingy which only covers what I need, but might consider switching to this now.... Thanks for the effort! Share this post Link to post
Erik@Grijjy 123 Posted June 4, 2019 1 hour ago, Stefan Glienke said: Does it pass https://github.com/yaml/yaml-test-suite ? No, like almost all YAML parsers, it does not pass all the tests in this test suite. Since this library is build on top of LibYAML, it fails and passes the same tests as LibYAML does. I have included this test suit into the Neslib.Yaml unit tests though, but excluded the tests that are known to fail with LibYAML. Share this post Link to post
Stefan Glienke 2005 Posted June 4, 2019 (edited) Ah, I see now, they are all hidden in that innocently looking TestParse and TestEmit methods - was expecting to see them more fine grained :) I have some suggestions for some possible low level optimizations (for example eliminating some unnecessary code from function prologues and epilogues caused by usually not raised exceptions but the fact the exception creation code is directly coded into the methods (and in fact is repeated multiple times) - will file a PR. Edited June 4, 2019 by Stefan Glienke 2 1 Share this post Link to post