# YAML Test Matrix

--- &test-EB22
  Title: Missing document-end marker before directive
  Tags: [ directive, error, footer ]

YAML

---
scalar1 # comment
%YAML 1.2
---
scalar2

Expected Events

+STR
+DOC ---
=VAL :scalar1
-DOC

Expected JSON



c-libyaml-event

 invalid_incorrect
+STR
+DOC ---
=VAL :scalar1
-DOC
+DOC ---
=VAL :scalar2
-DOC
-STR

cpp-rapidyaml-event

 invalid_incorrect
+STR
+DOC ---
=VAL :scalar1
-DOC
+DOC ---
=VAL :scalar2
-DOC
-STR

cpp-yamlcpp-event

 invalid_incorrect
+STR
+DOC
=VAL :scalar1
-DOC
+DOC
=VAL :scalar2
-DOC
-STR

hs-reference-yeast

 invalid_incorrect
Line  Col Char Byte Token|Content
   1    0    0    0 +DOC |
   1    0    0    0 =HEAD|---
   1    3    3    3 =EOL |\x0a
   2    0    4    4 +NODE|
   2    0    4    4 +VAL |
   2    0    4    4 =TEXT|scalar1
   2    7   11   11 -VAL |
   2    7   11   11 -NODE|
   2    7   11   11 =WSPC|.
   2    8   12   12 +COMM|
   2    8   12   12 =SYNX|#
   2    9   13   13 =META|.comment
   2   17   21   21 -COMM|
   2   17   21   21 =EOL |\x0a
   3    0   22   22 -DOC |
   3    0   22   22 =ERR |Unexpected.'%'

java-snakeengine-event

 invalid_incorrect
+STR
+DOC ---
=VAL :scalar1
-DOC
+DOC ---
=VAL :scalar2
-DOC
-STR

java-snakeengine-json

 invalid_incorrect
"scalar1"
"scalar2"

java-snakeyaml-event

 invalid_incorrect
+STR
+DOC ---
=VAL :scalar1
-DOC
+DOC ---
=VAL :scalar2
-DOC
-STR

java-snakeyaml-json

 invalid_incorrect
"scalar1"
"scalar2"

perl-pplibyaml-json

 invalid_incorrect
"scalar1"
"scalar2"

perl-pplibyaml-perl

 invalid_incorrect
'scalar1'
'scalar2'

perl-xs-json

 invalid_incorrect
"scalar1"
"scalar2"

perl-xs-perl

 invalid_incorrect
'scalar1'
'scalar2'

py-pyyaml-event

 invalid_incorrect
+STR
+DOC ---
=VAL :scalar1
-DOC
+DOC ---
=VAL :scalar2
-DOC
-STR

py-pyyaml-json

 invalid_incorrect
"scalar1"
"scalar2"

py-pyyaml-py

 invalid_incorrect
'scalar1'
'scalar2'

py-ruamel-event

 invalid_incorrect
+STR
+DOC ---
=VAL :scalar1
-DOC
+DOC ---
=VAL :scalar2
-DOC
-STR

py-ruamel-json

 invalid_incorrect
"scalar1"
"scalar2"

py-ruamel-py

 invalid_incorrect
'scalar1'
'scalar2'

rust-yamlrust-event

 invalid_incorrect
+STR
+DOC
=VAL :scalar1
-DOC
+DOC
=VAL :scalar2
-DOC
-STR

c-libfyaml-event

 invalid_correct
stdin:3:7: error: missing explicit document end marker before directive(s)
%YAML 1.2
      ^~~
+STR
+DOC ---
=VAL :scalar1

c-libfyaml-json

 invalid_correct
stdin:3:7: error: missing explicit document end marker before directive(s)
%YAML 1.2
      ^~~

dotnet-yamldotnet-event

 invalid_correct
Unhandled exception. YamlDotNet.Core.SyntaxErrorException: (Line: 1, Col: 1, Idx: 0) - (Line: 1, Col: 1, Idx: 0): While parsing a document start node, could not find document end marker before version directive.
   at YamlDotNet.Core.Parser.ParseDocumentStart(Boolean isImplicit)
   at YamlDotNet.Core.Parser.StateMachine()
   at YamlDotNet.Core.Parser.MoveNext()
   at YamlDotNet.RepresentationModel.LibYamlEventStream.WriteTo(TextWriter textWriter)
   at Program.Main(String[] commandLineArguments)
Aborted (core dumped)
+STR
+DOC ---
=VAL :scalar1
-DOC

dotnet-yamldotnet-json

 invalid_correct
Unhandled exception. YamlDotNet.Core.SyntaxErrorException: (Line: 1, Col: 1, Idx: 0) - (Line: 1, Col: 1, Idx: 0): While parsing a document start node, could not find document end marker before version directive.
   at YamlDotNet.Core.Parser.ParseDocumentStart(Boolean isImplicit)
   at YamlDotNet.Core.Parser.StateMachine()
   at YamlDotNet.Core.Parser.MoveNext()
   at YamlDotNet.Core.ParserExtensions.Consume[T](IParser parser)
   at YamlDotNet.Serialization.Deserializer.Deserialize(IParser parser, Type type)
   at YamlDotNet.Serialization.Deserializer.Deserialize(TextReader input, Type type)
   at YamlDotNet.Serialization.Deserializer.Deserialize(TextReader input)
   at Program.Main(String[] commandLineArguments)
Aborted (core dumped)

go-yaml-json

 invalid_correct
yaml: line 2: found incompatible YAML document
"scalar1"

hs-hsyaml-event

 invalid_correct
Parsing error near byte offset Pos {posByteOffset = 22, posCharOffset = 22, posLine = 3, posColumn = 0} (Unexpected '%')
+STR
+DOC ---
=VAL :scalar1
-DOC

hs-hsyaml-json

 invalid_correct
hsyaml-parser: user error (Unexpected '%')

js-jsyaml-json

 invalid_correct
/node/node_modules/js-yaml/lib/loader.js:187
  throw generateError(state, message);
  ^
YAMLException: end of the stream or a document separator is expected (3:1)

 1 | ---
 2 | scalar1 # comment
 3 | %YAML 1.2
-----^
 4 | ---
 5 | scalar2
    at generateError (/node/node_modules/js-yaml/lib/loader.js:183:10)
    at throwError (/node/node_modules/js-yaml/lib/loader.js:187:9)
    at readDocument (/node/node_modules/js-yaml/lib/loader.js:1645:5)
    at loadDocuments (/node/node_modules/js-yaml/lib/loader.js:1688:5)
    at Object.loadAll (/node/node_modules/js-yaml/lib/loader.js:1701:19)
    at Object.<anonymous> (/yaml/bin/js-jsyaml-json:7:13)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)

js-yaml-event

 invalid_correct
Unexpected scalar at node end at line 3, column 1:

scalar1 # comment
%YAML 1.2
^^^^^^^^^
+STR
+DOC ---
=VAL :scalar1
-DOC
+DOC ---
=VAL :scalar2
-DOC
-STR

js-yaml-json

 invalid_correct
/yaml/bin/js-yaml-json:8
  if (doc.errors.length !== 0) throw doc.errors[0]
                               ^

YAMLParseError: Unexpected scalar at node end at line 3, column 1:

scalar1 # comment
%YAML 1.2
^^^^^^^^^

    at Composer.onError (/node/node_modules/yaml/dist/compose/composer.js:71:34)
    at Object.resolveEnd (/node/node_modules/yaml/dist/compose/resolve-end.js:31:21)
    at Object.composeDoc (/node/node_modules/yaml/dist/compose/compose-doc.js:35:27)
    at Composer.next (/node/node_modules/yaml/dist/compose/composer.js:152:40)
    at next (<anonymous>)
    at Composer.compose (/node/node_modules/yaml/dist/compose/composer.js:134:25)
    at compose.next (<anonymous>)
    at Function.from (<anonymous>)
    at Object.parseAllDocuments (/node/node_modules/yaml/dist/public-api.js:28:24)
    at Object.<anonymous> (/yaml/bin/js-yaml-json:7:19)

lua-lyaml-json

 invalid_correct
luajit: 3:1: found incompatible YAML document
stack traceback:
	[C]: in function 'error'
	/usr/local/share/lua/5.1/lyaml/init.lua:306: in function 'error'
	/usr/local/share/lua/5.1/lyaml/init.lua:325: in function 'parse'
	/usr/local/share/lua/5.1/lyaml/init.lua:496: in function 'load'
	/yaml/bin/lua-lyaml-json:6: in main chunk
	[C]: at 0x55d73947ff97

nim-nimyaml-event

 invalid_correct
/tmp/NimYAML-0.16.0/yaml/stream.nim(134) nimyaml_event
/tmp/NimYAML-0.16.0/yaml/stream.nim(106) next
Error: unhandled exception: Unexpected token (expected document end): Indentation [YamlStreamError]
+STR
+DOC ---
=VAL :scalar1

perl-pp-event

 invalid_correct
Line      : 3
Column    : 1
Expected  : DOC_END DOC_START EOL
Got       : YAML_DIRECTIVE
Where     : /perl5/lib/perl5/YAML/PP/Parser.pm line 392
YAML      : "%YAML 1.2"
  at /yaml/bin/perl-pp-event line 25.
+STR
+DOC ---
=VAL :scalar1

perl-pp-json

 invalid_correct
Line      : 3
Column    : 1
Expected  : DOC_END DOC_START EOL
Got       : YAML_DIRECTIVE
Where     : /perl5/lib/perl5/YAML/PP/Parser.pm line 392
YAML      : "%YAML 1.2"
  at /perl5/lib/perl5/YAML/PP/Loader.pm line 94.

perl-pp-perl

 invalid_correct
Line      : 3
Column    : 1
Expected  : DOC_END DOC_START EOL
Got       : YAML_DIRECTIVE
Where     : /perl5/lib/perl5/YAML/PP/Parser.pm line 392
YAML      : "%YAML 1.2"
  at /perl5/lib/perl5/YAML/PP/Loader.pm line 94.

perl-refparser-event

 invalid_correct
Parser finished before end of input at /perl5/lib/perl5/YAML/Parser.pm line 4056, <> line 1.

perl-syck-json

 invalid_correct
Syck parser (line 6, column -1): syntax error at /perl5/lib/perl5/x86_64-linux-thread-multi/YAML/Syck.pm line 60, <> line 1.

perl-syck-perl

 invalid_correct
Syck parser (line 6, column -1): syntax error at /perl5/lib/perl5/x86_64-linux-thread-multi/YAML/Syck.pm line 60, <> line 1.

perl-tiny-json

 invalid_correct
YAML::Tiny failed to classify line 'scalar1 # comment' at /yaml/bin/perl-tiny-json line 12.

perl-tiny-perl

 invalid_correct
YAML::Tiny failed to classify line 'scalar1 # comment' at /yaml/bin/perl-tiny-perl line 15.

perl-yaml-json

 invalid_correct
YAML Error: Expected separator '---'
   Code: YAML_PARSE_ERR_NO_SEPARATOR
   Line: 2
   Document: 2
 at /perl5/lib/perl5/YAML/Loader.pm line 88.

perl-yaml-perl

 invalid_correct
YAML Error: Expected separator '---'
   Code: YAML_PARSE_ERR_NO_SEPARATOR
   Line: 2
   Document: 2
 at /perl5/lib/perl5/YAML/Loader.pm line 88.

raku-yamlish-json

 invalid_correct
Couldn't parse YAML
  in sub load-yamls at /raku/sources/44795C7AB0F35700F4CA9C3E2CC5C924EE4C608F (YAMLish) line 959
  in block <unit> at /yaml/bin/raku-yamlish-json line 6

raku-yamlish-raku

 invalid_correct
Couldn't parse YAML
  in sub load-yamls at /raku/sources/44795C7AB0F35700F4CA9C3E2CC5C924EE4C608F (YAMLish) line 959
  in block <unit> at /yaml/bin/raku-yamlish-raku line 6

ruby-psych-json

 invalid_correct
/ruby/gems/psych/lib/psych.rb:459:in `parse': (<unknown>): found incompatible YAML document at line 1 column 1 (Psych::SyntaxError)
	from /ruby/gems/psych/lib/psych.rb:459:in `parse_stream'
	from /ruby/gems/psych/lib/psych.rb:565:in `load_stream'
	from /yaml/bin/ruby-psych-json:6:in `<main>'