Streams, directives, and explicit document end markers

Burt Harris <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <63391FD9067F734E829A283F1BB68930047436FE@TK5EX14MBXC102.redmond.corp.microsoft.com>
In Yaml 1.2, l-yaml-stream [211] requires that one of the following two conditions between documents in a stream:

  - Either an explicit end-of-document indicator "...", optional directives, and an end-of-directives indicator "---"

  - Or, an explicit end-of-directives indicator "---", _with_no_directives_preceding_it_!

Unfortunately, many existing example YAML streams do not conform to the last part of this definition.  Attempting to deal with these examples had complicated my previous YAML 1.1 implementations.   I've pretty well convinced myself that these are all bad examples, I hope you can confirm.   

Example 9.3 from the 1.2 specification:

    %YAML 1.2
    ---
    !!str "Bare document"
    %YAML 1.2
    ---
    !!str "%!PS-Adobe-2.0\n"

Example 7.9 the 1.1 specification:

    %YAML 1.1
    ---
    !!str "foo"
    %YAML 1.1
    ---
    !!str "bar"
    %YAML 1.1
    ---
    !!str "baz"

Example 7.13 from the 1.1 specification:

    ! "First document"
    ---
    !foo "No directives"
    %TAG ! !foo
    ---
    !bar "With directives"
    %YAML 1.1
    ---
    !baz "Reset settings"


------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.