Skip to content

Commit

Permalink
Support %YAML 1.2
Browse files Browse the repository at this point in the history
This will allow `%YAML 1.2` directives.

See also #20

No changes are needed regarding tag directives.

In YAML 1.2 tag directives are for the following document only.
This is already implemented like that in libyaml.

We would rather have to fix the code if we want to have the correct behaviour
(global directives) in YAML 1.1. This would be a bit more complicated, as we
would have to save the default version and the current version in the parser
object.

New passing parser tests:

* 27NA: Spec Example 5.9. Directive Indicator
* 6ZKB: Spec Example 9.6. Stream
* 9DXL: Spec Example 9.6. Stream [1.3]
* RTP8: Spec Example 9.2. Document Markers

New failing error parser tests (before they were errors for the wrong reason):

* EB22: Missing document-end marker before directive
* RHX7: YAML directive without document end marker
  • Loading branch information
perlpunk committed Mar 30, 2020
1 parent 7e3cea3 commit 90d7b19
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,10 @@ yaml_parser_process_directives(yaml_parser_t *parser,
goto error;
}
if (token->data.version_directive.major != 1
|| token->data.version_directive.minor != 1) {
|| (
token->data.version_directive.minor != 1
&& token->data.version_directive.minor != 2
)) {
yaml_parser_set_parser_error(parser,
"found incompatible YAML document", token->start_mark);
goto error;
Expand Down

0 comments on commit 90d7b19

Please sign in to comment.