tags:

views:

127

answers:

1

In the YAML specification it says ... is the EOF If I do:

YAML.load_documents("--- abc\n--- 42\n...\nerror") { |d| puts d }

I should get

abc
42

But I get

abc
42
error

Unfortenely there is not much documentation about the YAML parses. Do I have to tell the parses to honor the EOF, or does the parser not comply to the specs?

+2  A: 

It would seem that according to the YAML spec (http://yaml.org/spec/current.html) that the ... only indicates the end of the current document, not the end of the file.

While the specification suggests that the only valid content beyond an end of document marker is either comments or another document, the Ruby YAML parser appears to take a rather relaxed approach and allow ... to simply split documents.

tadman
I must confess, I didn't read the specs. I read only wikipedia. I correkted the wikipedia article, so noone else misunderstands this.
johannes