yaml / yaml-spec

YAML Specification
http://yaml.org/spec/
348 stars 54 forks source link

Eliminate “Excluding c-forbidden content” in grammar #315

Open Thom1729 opened 1 year ago

Thom1729 commented 1 year ago

In the 1.2.2 spec, the l-bare-document production includes special language:

[207] l-bare-document ::=
  s-l+block-node(-1,BLOCK-IN)
  /* Excluding c-forbidden content */

The intent is to assert that the body of a document cannot contain a directive end indicator or a document end indicator. This is not entirely clear in the spec, it's not a proper part of the PEG model we use for the grammar, and overall it's just kind of a kludge.

In a future revision of the 1.2 spec, we may be able to eliminate the kludge with a few well-placed negative lookaheads.

ingydotnet commented 1 year ago

Yes, it's the biggest "punt" in the spec, imho...

It's probably better expressed as a negative lookahead assertion in a few productions involving separating whitespace and multi-line strings.

Shouldn't be hard to make it simple.