# YAML Test Matrix

--- &test-9MMW
  Title: Single Pair Implicit Entries
  Tags: [ flow, mapping, sequence ]

YAML

- [ YAML : separate ]
- [ "JSON like":adjacent ]
- [ {JSON: like}:adjacent ]

Expected Events

+STR
+DOC
+SEQ
+SEQ []
+MAP {}
=VAL :YAML
=VAL :separate
-MAP
-SEQ
+SEQ []
+MAP {}
=VAL "JSON like
=VAL :adjacent
-MAP
-SEQ
+SEQ []
+MAP {}
+MAP {}
=VAL :JSON
=VAL :like
-MAP
=VAL :adjacent
-MAP
-SEQ
-SEQ
-DOC
-STR

Expected JSON



c-libfyaml-event

 ok

c-libyaml-event

 ok

cpp-yamlcpp-event

 ok

dotnet-yamldotnet-event

 ok

hs-hsyaml-event

 ok

js-yaml-event

 ok

nim-nimyaml-event

 ok

perl-refparser-event

 ok

py-pyyaml-event

 ok

cpp-rapidyaml-event

 error
-:2:16: (37B): ERROR: was expecting a comma
-:2:16: - [ "JSON like":adjacent ]  (size=26)
                       ^~~~~~~~~~~  (cols 16-27)

perl-pp-event

 error
+STR
+DOC
+SEQ
+SEQ []
+MAP {}
=VAL :YAML
=VAL :separate
-MAP
-SEQ
+SEQ []
+MAP {}
=VAL "JSON like
=VAL :adjacent
-MAP
-SEQ
+SEQ []
+MAP {}
=VAL :JSON
=VAL :like
-MAP
Line      : 3
Column    : 17
Expected  : EOL FLOWSEQ_END FLOW_COMMA WS
Got       : PLAIN
Where     : /perl5/lib/perl5/YAML/PP/Parser.pm line 392
YAML      : ":adjacent ]"
  at /yaml/bin/perl-pp-event line 46.

perl-pp-perl

 error
Line      : 3
Column    : 17
Expected  : EOL FLOWSEQ_END FLOW_COMMA WS
Got       : PLAIN
Where     : /perl5/lib/perl5/YAML/PP/Parser.pm line 392
YAML      : ":adjacent ]"
  at /perl5/lib/perl5/YAML/PP/Loader.pm line 94.

perl-syck-perl

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

perl-yaml-perl

 error
YAML Error: Can't parse inline sequence
   Code: YAML_PARSE_ERR_INLINE_SEQUENCE
   Line: 2
   Document: 1
 at /perl5/lib/perl5/YAML/Loader.pm line 551.

py-pyyaml-py

 error
Traceback (most recent call last):
  File "/yaml/bin/py-pyyaml-py", line 36, in <module>
    for doc in yaml.load_all(sys.stdin.read(), Loader=yaml.FullLoader):
  File "/python/lib/python3.12/site-packages/yaml/__init__.py", line 130, in load_all
    yield loader.get_data()
          ^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 45, in get_data
    return self.construct_document(self.get_node())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 60, in construct_document
    for dummy in generator:
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 413, in construct_yaml_map
    value = self.construct_mapping(node)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 218, in construct_mapping
    return super().construct_mapping(node, deep=deep)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 141, in construct_mapping
    raise ConstructorError("while constructing a mapping", node.start_mark,
yaml.constructor.ConstructorError: while constructing a mapping
found unhashable key
  in "<unicode string>", line 3, column 5:
    - [ {JSON: like}:adjacent ]
        ^

py-ruamel-event

 error
+STR
+DOC
+SEQ
+SEQ []
+MAP {}
=VAL :YAML
=VAL :separate
-MAP
-SEQ
+SEQ []
=VAL "JSON like
Traceback (most recent call last):
  File "/yaml/bin/py-ruamel-event", line 9, in <module>
    for event in yaml.parse(sys.stdin.read()):
  File "/python/lib/python3.12/site-packages/ruamel/yaml/main.py", line 371, in parse
    while parser.check_event():
          ^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/parser.py", line 141, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/parser.py", line 678, in parse_flow_sequence_entry
    raise ParserError(
ruamel.yaml.parser.ParserError: while parsing a flow sequence
  in "<unicode string>", line 2, column 3:
    - [ "JSON like":adjacent ]
      ^ (line: 2)
expected ',' or ']', but got '<scalar>'
  in "<unicode string>", line 2, column 16:
    - [ "JSON like":adjacent ]
                   ^ (line: 2)

py-ruamel-py

 error
Traceback (most recent call last):
  File "/yaml/bin/py-ruamel-py", line 38, in <module>
    for doc in yaml.load_all(sys.stdin.read()):
  File "/python/lib/python3.12/site-packages/ruamel/yaml/main.py", line 476, in load_all
    yield constructor.get_data()
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 110, in get_data
    return self.construct_document(self.composer.get_node())
                                   ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 63, in get_node
    return self.compose_document()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 94, in compose_document
    node = self.compose_node(None, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 128, in compose_node
    node = self.compose_sequence_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 173, in compose_sequence_node
    node.value.append(self.compose_node(node, index))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 128, in compose_node
    node = self.compose_sequence_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 172, in compose_sequence_node
    while not self.parser.check_event(SequenceEndEvent):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/parser.py", line 141, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/parser.py", line 678, in parse_flow_sequence_entry
    raise ParserError(
ruamel.yaml.parser.ParserError: while parsing a flow sequence
  in "<unicode string>", line 2, column 3:
    - [ "JSON like":adjacent ]
      ^ (line: 2)
expected ',' or ']', but got '<scalar>'
  in "<unicode string>", line 2, column 16:
    - [ "JSON like":adjacent ]
                   ^ (line: 2)

rust-yamlrust-event

 error
+STR
+DOC
+SEQ
+SEQ
+MAP
=VAL :YAML
=VAL :separate
-MAP
-SEQ
+SEQ
+MAP
=VAL "JSON like
=VAL :adjacent
-MAP
-SEQ
+SEQ
+MAP
=VAL :JSON
=VAL :like
-MAP
Error: ScanError { mark: Marker { index: 65, line: 3, col: 16 }, info: "while parsing a flow sequence, expected ',' or ']'" }

c-libfyaml-json

 na
[
  [
    {
      "YAML": "separate"
    }
  ],
  [
    {
      "JSON like": "adjacent"
    }
  ],
  [
    {
  ]
]
stdin:3:5: error: Non scalar keys are not allowed in JSON emit mode
- [ {JSON: like}:adjacent ]
    ^~~~~~~~~~~~

dotnet-yamldotnet-json

 na
[[{"YAML": "separate"}], [{"JSON like": "adjacent"}], [{? {"JSON": "like"} : "adjacent"}]]

go-yaml-json

 na
yaml: invalid map key: map[interface {}]interface {}{"JSON":"like"}

hs-hsyaml-json

 na
[[{"YAML":"separate"}],[{"JSON like":"adjacent"}],[{"{\"JSON\":\"like\"}":"adjacent"}]]

hs-reference-yeast

 na
Line  Col Char Byte Token|Content
   1    0    0    0 +DOC |
   1    0    0    0 +NODE|
   1    0    0    0 +SEQ |
   1    0    0    0 =SYNX|-
   1    1    1    1 =WSPC|.
   1    2    2    2 +NODE|
   1    2    2    2 +SEQ |
   1    2    2    2 =SYNX|[
   1    3    3    3 =WSPC|.
   1    4    4    4 +MAP |
   1    4    4    4 +PAIR|
   1    4    4    4 +NODE|
   1    4    4    4 +VAL |
   1    4    4    4 =TEXT|YAML
   1    8    8    8 -VAL |
   1    8    8    8 -NODE|
   1    8    8    8 =WSPC|.
   1    9    9    9 =SYNX|:
   1   10   10   10 =WSPC|.
   1   11   11   11 +NODE|
   1   11   11   11 +VAL |
   1   11   11   11 =TEXT|separate
   1   19   19   19 -VAL |
   1   19   19   19 -NODE|
   1   19   19   19 -PAIR|
   1   19   19   19 -MAP |
   1   19   19   19 =WSPC|.
   1   20   20   20 =SYNX|]
   1   21   21   21 -SEQ |
   1   21   21   21 -NODE|
   1   21   21   21 =EOL |\x0a
   2    0   22   22 =SYNX|-
   2    1   23   23 =WSPC|.
   2    2   24   24 +NODE|
   2    2   24   24 +SEQ |
   2    2   24   24 =SYNX|[
   2    3   25   25 =WSPC|.
   2    4   26   26 +MAP |
   2    4   26   26 +PAIR|
   2    4   26   26 +NODE|
   2    4   26   26 +VAL |
   2    4   26   26 =SYNX|"
   2    5   27   27 =TEXT|JSON.like
   2   14   36   36 =SYNX|"
   2   15   37   37 -VAL |
   2   15   37   37 -NODE|
   2   15   37   37 =SYNX|:
   2   16   38   38 +NODE|
   2   16   38   38 +VAL |
   2   16   38   38 =TEXT|adjacent
   2   24   46   46 -VAL |
   2   24   46   46 -NODE|
   2   24   46   46 -PAIR|
   2   24   46   46 -MAP |
   2   24   46   46 =WSPC|.
   2   25   47   47 =SYNX|]
   2   26   48   48 -SEQ |
   2   26   48   48 -NODE|
   2   26   48   48 =EOL |\x0a
   3    0   49   49 =SYNX|-
   3    1   50   50 =WSPC|.
   3    2   51   51 +NODE|
   3    2   51   51 +SEQ |
   3    2   51   51 =SYNX|[
   3    3   52   52 =WSPC|.
   3    4   53   53 +MAP |
   3    4   53   53 +PAIR|
   3    4   53   53 +NODE|
   3    4   53   53 +MAP |
   3    4   53   53 =SYNX|{
   3    5   54   54 +PAIR|
   3    5   54   54 +NODE|
   3    5   54   54 +VAL |
   3    5   54   54 =TEXT|JSON
   3    9   58   58 -VAL |
   3    9   58   58 -NODE|
   3    9   58   58 =SYNX|:
   3   10   59   59 =WSPC|.
   3   11   60   60 +NODE|
   3   11   60   60 +VAL |
   3   11   60   60 =TEXT|like
   3   15   64   64 -VAL |
   3   15   64   64 -NODE|
   3   15   64   64 -PAIR|
   3   15   64   64 =SYNX|}
   3   16   65   65 -MAP |
   3   16   65   65 -NODE|
   3   16   65   65 =SYNX|:
   3   17   66   66 +NODE|
   3   17   66   66 +VAL |
   3   17   66   66 =TEXT|adjacent
   3   25   74   74 -VAL |
   3   25   74   74 -NODE|
   3   25   74   74 -PAIR|
   3   25   74   74 -MAP |
   3   25   74   74 =WSPC|.
   3   26   75   75 =SYNX|]
   3   27   76   76 -SEQ |
   3   27   76   76 -NODE|
   3   27   76   76 =EOL |\x0a
   4    0   77   77 -SEQ |
   4    0   77   77 -NODE|
   4    0   77   77 -DOC |

js-jsyaml-json

 na
[[{"YAML":"separate"}],[{"JSON like":"adjacent"}],[{"[object Object]":"adjacent"}]]

js-yaml-json

 na
[
  [
    {
      "YAML": "separate"
    }
  ],
  [
    {
      "JSON like": "adjacent"
    }
  ],
  [
    {
      "{ JSON: like }": "adjacent"
    }
  ]
]
(node:1436) Warning: Keys with collection values will be stringified due to JS Object restrictions: "{ JSON: like }". Set mapAsMap: true to use object keys.
(Use `node --trace-warnings ...` to show where the warning was created)

lua-lyaml-json

 na
luajit: /yaml/bin/lua-lyaml-json:8: Cannot serialise table: table key must be a number or string
stack traceback:
	[C]: in function 'encode'
	/yaml/bin/lua-lyaml-json:8: in main chunk
	[C]: at 0x55c9837e5ed0

perl-pp-json

 na
Line      : 3
Column    : 17
Expected  : EOL FLOWSEQ_END FLOW_COMMA WS
Got       : PLAIN
Where     : /perl5/lib/perl5/YAML/PP/Parser.pm line 392
YAML      : ":adjacent ]"
  at /perl5/lib/perl5/YAML/PP/Loader.pm line 94.

perl-pplibyaml-json

 na
[
   [
      {
         "YAML" : "separate"
      }
   ],
   [
      {
         "JSON like" : "adjacent"
      }
   ],
   [
      {
         "{JSON => 'like'}" : "adjacent"
      }
   ]
]

perl-pplibyaml-perl

 na
[
  [
    {
      'YAML' => 'separate'
    }
  ],
  [
    {
      'JSON like' => 'adjacent'
    }
  ],
  [
    {
      '{JSON => \'like\'}' => 'adjacent'
    }
  ]
]

perl-syck-json

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

perl-tiny-json

 na
YAML::Tiny found illegal characters in plain scalar: '[ YAML : separate ]' at /yaml/bin/perl-tiny-json line 12.

perl-xs-json

 na
[
   [
      {
         "YAML" : "separate"
      }
   ],
   [
      {
         "JSON like" : "adjacent"
      }
   ],
   [
      {
         "HASH(0x7f6d86290088)" : "adjacent"
      }
   ]
]

perl-xs-perl

 na
[
  [
    {
      'YAML' => 'separate'
    }
  ],
  [
    {
      'JSON like' => 'adjacent'
    }
  ],
  [
    {
      'HASH(0x7ffa4a050cc8)' => 'adjacent'
    }
  ]
]

perl-yaml-json

 na
YAML Error: Can't parse inline sequence
   Code: YAML_PARSE_ERR_INLINE_SEQUENCE
   Line: 2
   Document: 1
 at /perl5/lib/perl5/YAML/Loader.pm line 551.

py-pyyaml-json

 na
Traceback (most recent call last):
  File "/yaml/bin/py-pyyaml-json", line 19, in <module>
    for doc in yaml.load_all(sys.stdin.read(), Loader=yaml.FullLoader):
  File "/python/lib/python3.12/site-packages/yaml/__init__.py", line 130, in load_all
    yield loader.get_data()
          ^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 45, in get_data
    return self.construct_document(self.get_node())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 60, in construct_document
    for dummy in generator:
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 413, in construct_yaml_map
    value = self.construct_mapping(node)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 218, in construct_mapping
    return super().construct_mapping(node, deep=deep)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 141, in construct_mapping
    raise ConstructorError("while constructing a mapping", node.start_mark,
yaml.constructor.ConstructorError: while constructing a mapping
found unhashable key
  in "<unicode string>", line 3, column 5:
    - [ {JSON: like}:adjacent ]
        ^

py-ruamel-json

 na
Traceback (most recent call last):
  File "/yaml/bin/py-ruamel-json", line 21, in <module>
    for doc in yaml.load_all(sys.stdin.read()):
  File "/python/lib/python3.12/site-packages/ruamel/yaml/main.py", line 476, in load_all
    yield constructor.get_data()
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 110, in get_data
    return self.construct_document(self.composer.get_node())
                                   ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 63, in get_node
    return self.compose_document()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 94, in compose_document
    node = self.compose_node(None, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 128, in compose_node
    node = self.compose_sequence_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 173, in compose_sequence_node
    node.value.append(self.compose_node(node, index))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 128, in compose_node
    node = self.compose_sequence_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 172, in compose_sequence_node
    while not self.parser.check_event(SequenceEndEvent):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/parser.py", line 141, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/parser.py", line 678, in parse_flow_sequence_entry
    raise ParserError(
ruamel.yaml.parser.ParserError: while parsing a flow sequence
  in "<unicode string>", line 2, column 3:
    - [ "JSON like":adjacent ]
      ^ (line: 2)
expected ',' or ']', but got '<scalar>'
  in "<unicode string>", line 2, column 16:
    - [ "JSON like":adjacent ]
                   ^ (line: 2)

ruby-psych-json

 na
[[{"YAML":"separate"}],[{"JSON like":"adjacent"}],[{"{\"JSON\"=>\"like\"}":"adjacent"}]]

perl-tiny-perl

 ni
YAML::Tiny found illegal characters in plain scalar: '[ YAML : separate ]' at /yaml/bin/perl-tiny-perl line 15.