jasom / nyaml

A lisp native YAML parser
MIT License
24 stars 8 forks source link

Add Stringify Method #1

Closed charJe closed 3 years ago

charJe commented 3 years ago

I also added the rest of the Boolean options.

jasom commented 3 years ago

The inclusion of the boolean options commit makes me realize I haven't pushed out my changes that include schema support. The lack of those options is intentional, as this is an implementation of YAML 1.3; the YAML 1.2 schema is on my hard drive; I'll get it cleaned up and pushed tonight. Can you remake the PR without 3479ba5?

charJe commented 3 years ago

There you go. I don't understand things like 1.2 s 1.3. I just realized that Common Lisp didn't have a yaml printer. I really like the way your library is designed by the way.

jasom commented 3 years ago

derp, I meant 1.1 vs 1.2

Anyways this is "good enough to merge" at this point; there's some stylistic changes I'd like to make and also we should be able to stringify vectors, but those can be done easily enough post-merge.

charJe commented 3 years ago

Shouldn't vector being a subclass of array make it work?

jasom commented 3 years ago

@charJe oh, I see that now. I searched for vector not array. That's all good then

charJe commented 3 years ago

Now that I'm thinking about vectors, I realize that I missed printing empty sequence as []. I can do that if you want.

jasom commented 3 years ago

I can handle the empty-sequence.

Quick question about stringify-documents why does it not stringify the first item in the list passed to it?

charJe commented 3 years ago

Wouldn't the first element always be the keyword :documents. If you want, you could move the call to rest into the stringify cons method.

jasom commented 3 years ago

oh, I see that now.

jasom commented 3 years ago

Another question. I notice that you manually expand newlines on windows. Are there real implementations that don't do that for you automatically? (i.e. where (write-char #\Newline) doesn't output a return/newline sequence)?

charJe commented 3 years ago

😅 I actually don't know about that. I was more or less just playing with read time conditionals; Feel free to remove. I do think it is still good idea to have a variable in case someone wants to customize it though.