Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M7A3: Either in-json or out-yaml is wrong #39

Closed
eemeli opened this issue Jul 1, 2018 · 3 comments
Closed

M7A3: Either in-json or out-yaml is wrong #39

eemeli opened this issue Jul 1, 2018 · 3 comments

Comments

@eemeli
Copy link
Member

eemeli commented Jul 1, 2018

This test corresponds to Example 9.3 of the spec, where a stream has either two or three documents, depending on whether the second one is skipped or not:

Bare
document
...
# No document
...
|
%!PS-Adobe-2.0 # Not the first line

The current in-json and the test-event stream skip the second one, but the out-yaml includes it as an explicit document. I'm not sure what's really right here, but I'd at least prefer to include the second empty/null document in the stream.

eemeli added a commit to eemeli/yaml-test-suite that referenced this issue Jul 1, 2018
@hvr
Copy link
Collaborator

hvr commented Jul 1, 2018

IMHO, out-yaml is wrong, as the intent of that example in the spec is clearly to show an example with only 2 docs. (also note that ... on their own don't introduce a new document)

I'm a bit suprised btw that the canonical right-hand-side of example 9.3 doesn't read

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

(notice the ...) like the similar one from example 9.5 had.


PS: To expand a bit more:

The YAML 1.2 spec says (emphasis added)

YAML uses three dashes (“---”) to separate directives from document content. This also serves to signal the start of a document if no directives are present. Three dots ( “...”) indicate the end of a document without starting a new one, for use in communication channels.

moreover,

[205] l-document-suffix ::= c-document-end s-l-comments

So the # No document comment would be part of the l-document-suffix production.

Moreover,

[211] 	l-yaml-stream 	::= 	l-document-prefix* l-any-document?
                              ( l-document-suffix+ l-document-prefix* l-any-document?
                              | l-document-prefix* l-explicit-document? )* 

encodes that multiple consecutive occurences of l-document-suffix count as one.

Hence we got only two documents, and thus test-event stating

+STR
+DOC
=VAL :Bare document
-DOC ...
+DOC
=VAL |%!PS-Adobe-2.0 # Not the first line\n
-DOC
-STR

is in fact correct.

perlpunk added a commit that referenced this issue Sep 16, 2018
@perlpunk
Copy link
Member

Thanks, my suggested fix is in #42

perlpunk added a commit that referenced this issue Nov 1, 2018
@perlpunk
Copy link
Member

perlpunk commented Nov 1, 2018

Merged #42

@perlpunk perlpunk closed this as completed Nov 1, 2018
eemeli added a commit to eemeli/yaml-test-suite that referenced this issue May 9, 2020
eemeli added a commit to eemeli/yaml-test-suite that referenced this issue Nov 28, 2021
eemeli added a commit to eemeli/yaml-test-suite that referenced this issue Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants