Escaped line breaks and line folding

flyx <[email protected]> Fri, 06 Jan 2017 15:02:11 +0100
Newsgroups gmane.text.yaml.general
Message-ID <[email protected]>
Hi folks,

given the following YAML double-quoted scalar:

     "line1\

     line2"

What should this be parsed to? I think the specification is not very 
clear on this. Line folding [1] defines that

> If a line break is followed by an empty line, it is trimmed; the first 
> line break is discarded and the rest are retained as content.
> ...
> Otherwise (the following line is not empty), the line break is 
> converted to a single space (#x20).

We have an empty line here, but the preceding line break is escaped. How 
does line folding apply here? The spec [2] says about escaped newlines:

> In this case, the line break is excluded from the content, and the 
> trailing white space characters are preserved.

No reference to line folding here. PyYaml parses it like this:

     !!str "line1\nline2"

NimYAML parses it like that:

     !!str "line1 line2"

Which is right?


Cheers,
Felix


  [1]: http://www.yaml.org/spec/1.2/spec.html#id2779048
  [2]: http://www.yaml.org/spec/1.2/spec.html#id2787109

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot