yaml / yaml-test-suite

Comprehensive, language independent Test Suite for YAML
MIT License
172 stars 58 forks source link

Test NTY5 (Missing space in YAML directive) should not be an error #38

Closed eemeli closed 4 years ago

eemeli commented 6 years ago

The test was introduced a few weeks ago in 30f372c. The relevant directives are defined with:

[82]           l-directive ::= "%"
                               ( ns-yaml-directive | ns-tag-directive | ns-reserved-directive )
                               s-l-comments
[83] ns-reserved-directive ::= ns-directive-name
                               ( s-separate-in-line ns-directive-parameter )*
[84]     ns-directive-name ::= ns-char+
[86]     ns-yaml-directive ::= "Y" "A" "M" "L" s-separate-in-line ns-yaml-version
[66]    s-separate-in-line ::= s-white+ | /* Start of line */

Therefore, a directive line %YAML1.2 should get parsed as ns-reserved-directive, regarding which the following instruction applies: "A YAML processor should ignore unknown directives with an appropriate warning."

Effectively, as "appropriate warning" is rather implementation-specific, it might be best to just remove this test completely. Or to just leave out the error, as parsers are expected to deal with this situation without an error.

hvr commented 6 years ago

For the record the NTY5 test was added as consequence of #34

But I think I agree that a non-greedy application of rule 82 means that a mistyped YAML (or TAG) directive ought to fallback to the ns-reserved-directive production.

perlpunk commented 6 years ago

Yeah, I was thinking about that too. I think we should remove that test...

perlpunk commented 4 years ago

Removed the test, created new release 2020-02-11