pantoniou / libfyaml

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

How to create a FYSS_LITERAL scalar? #79

Open yrashk opened 1 year ago

yrashk commented 1 year ago

I am finding a situation in which I'd prefer to have a literal scalar so that when I emit a document, these strings are emitted using multi-line syntax instead of quoted string with \ns. I couldn't find a way to do this yet.

Is this supported, and if it is not, is there interest in getting it supported? I'd be happy to contribute if necessary.

pantoniou commented 1 year ago

You're right, there are no style hints when creating a scalar. What is missing is a method to alter the style of the created node an analogous of fy_event_get_node_style().

I'm making a note.

yrashk commented 1 year ago

Thank you! Please let me know if I can help in any way with this or other parts of the project.

I'm using the library in this project https://docs.omnigres.org/pg_yregress/usage/ and would love to make it even better.

I noticed cmake support is out of sync on master. Do you need any help with that?

On Sun, Apr 23, 2023, 6:10 p.m. Pantelis Antoniou @.***> wrote:

You're right, there are no style hints when creating a scalar. What is missing is a method to alter the style of the created node an analogous of fy_event_get_node_style().

I'm making a note.

— Reply to this email directly, view it on GitHub https://github.com/pantoniou/libfyaml/issues/79#issuecomment-1519101508, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAADREDY2SMOBUFDZJ3UMDXCVIAHANCNFSM6AAAAAAXGOBPGY . You are receiving this because you authored the thread.Message ID: @.***>

yrashk commented 1 year ago

As for the original issue, I am noticing that the inability to set this style leads to unquoted empty strings:

key:

which may sometimes be undesirable

yrashk commented 1 year ago

It looks like #78 may be the implementation necessary for this.

pantoniou commented 1 year ago

As for the original issue, I am noticing that the inability to set this style leads to unquoted empty strings:

key:

which may sometimes be undesirable

Well, this is a bug actually...