Jump to content
Erik@Grijjy

A YAML Library for Delphi

Recommended Posts

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
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...

  • Like 2

Share this post


Link to post

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 by Rollo62

Share this post


Link to post
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
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 by edwinyzh
  • Like 1

Share this post


Link to post

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
1 hour ago, Stefan Glienke said:

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

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 by Stefan Glienke
  • Like 2
  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×