Clark C. Evans wrote:
> This is a summary of Brian's 'prologue' proposal, taking into
> account feedback and going through with a fine comb.
> With the introduction of YAML 1.1 we allow a set of instructions
> to the YAML Processor, called directives, to apply to more than
> one document. These directives are clumped together into what
> is called a 'prologue'.
> - A YAML 'prologue' is defined as an optional byte order mark
> (BOM), followed by zero or more directives, followed by an
> optional document start token ('---'). Comments can be
> interspersed throught a prologue.
> - Documents within a YAML stream always begin with a prologue.
> If there are more than one document in a YAML stream, the
> document start token is mandatory for all prologues.
> - Directives always begin with '%' in column zero and span exactly
> one line. Old-style directives in the document header are a
> parse error. A comment may appear on the same line as a directive,
> indicated by '# '.
> - The YAML stream has a single character encoding determined by
> an optional BOM character in the first prologue of the stream.
> If this BOM character is missing, the UTF-8 encoding is
Always UTF-8, even though UTF-16 can be auto-detected despite the
First two bytes Encoding
FE FF UTF-16BE
00 xx UTF-16BE (xx != 00)
FF FE UTF-16LE
xx 00 UTF-16LE (xx != 00)
(Strictly speaking, this doesn't work for a document without any
directives or "---" token, where the first character is non-ISO-Latin-1
and the encoding is UTF-16LE or UTF-16BE. If the "---" were required
then it would always work.)
> Further, the BOM of subsequent prologues must match
> the BOM of the first prologue (if any).
I assume that subsequent prologues can include or not include a BOM
independently of whether the first prologue did, as long as the entire
stream is in the same encoding?
> - Within a prologue, if any directive is given, the document
> start token ('---') and the %YAML version directive are
> - The 'active' set of directives for a given document comes from
> the most recent prologue that has directives. This is not
> additive, if a prologue has a directive, then subsequent
> documents use only the directives from that prologue, and
> not directives from previous prologues.
Sounds good to me.
David Hopwood <david.nospam.hopwood@...>