On Wednesday 20 October 2004 07:06, trans. (T. Onoma) wrote:
> Is there an "end of document" indicator?
> Seem to recall one. Is it '...' ?
Yes (at the start of a line, optionally followed by a comment).
Note, however, that it is optional. The next document starts with '---'
anyway. The only need for '...' is to be able to signal the end of a
document without being forced to start the next one, when YAML
documents are sent through a communication stream.
On Wednesday 20 October 2004 12:34, Anton Aylward wrote:
> > Note, however, that it is optional. The next document starts with
> > '---' anyway. The only need for '...' is to be able to signal the
> > end of a document without being forced to start the next one, when
> > YAML documents are sent through a communication stream.
> So I should be able to embed YAML in another document and still parse
> it, for example in a HTML file.
Not really... The '...' indicates the end of a document, not the end of
a stream. So, what follows (until an EOF) should be either throwaway
comments or more documents.
I suppose a parser should give you an option to stop at the '...' and
decide whether you want to go on parsing the rest of the stream, or you
want to stop here and do something else with the rest of the file.
We don't have an explicit "end of stream" marker, and I don't think we
really need one. If you embed YAML in some other format, it makes sense
for the way you denote the YAML ends to depend on the format. For
example, if you put YAML in a comment, the end of the comment would
signify the end of the YAML.
> Fine. Just tried that with perl/ysh.
> It doesn't seem to work.
> Is the fault with ysh or the parser?
I'm not certain ysh/YAML.pm allows for this (though I vaguely remember
it does); at any rate, it isn't required to.
Get latest updates about Open Source Projects, Conferences and News.