# YAML Test Matrix

--- &test-W5VH
  Title: Allowed characters in alias
  Tags: [ 1.3-err, alias ]

YAML

a: &:@*!$"<foo>: scalar a
b: *:@*!$"<foo>:

Expected Events

+STR
+DOC
+MAP
=VAL :a
=VAL &:@*!$"<foo>: :scalar a
=VAL :b
=ALI *:@*!$"<foo>:
-MAP
-DOC
-STR

Expected JSON

{
"a": "scalar a",
"b": "scalar a"
}

c-libfyaml-event

 ok

cpp-rapidyaml-event

 ok

cpp-yamlcpp-event

 ok

dotnet-yamldotnet-event

 ok

hs-hsyaml-event

 ok

js-yaml-event

 ok

nim-nimyaml-event

 ok

perl-pp-event

 ok

perl-refparser-event

 ok

py-ruamel-event

 ok

c-libfyaml-json

 json_ok

dotnet-yamldotnet-json

 json_ok

hs-hsyaml-json

 json_ok

js-jsyaml-json

 json_ok

js-yaml-json

 json_ok

perl-pp-json

 json_ok

py-ruamel-json

 json_ok

c-libyaml-event

 error
+STR
+DOC
+MAP
=VAL :a
Parse error: did not find expected alphabetic or numeric character

go-yaml-json

 error
yaml: did not find expected alphabetic or numeric character

lua-lyaml-json

 error
luajit: 1:1: did not find expected alphabetic or numeric character
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:443: in function 'load_node'
	/usr/local/share/lua/5.1/lyaml/init.lua:378: in function 'load_node'
	/usr/local/share/lua/5.1/lyaml/init.lua:497: in function 'load'
	/yaml/bin/lua-lyaml-json:6: in main chunk
	[C]: at 0x562d79952ed0

perl-pplibyaml-json

 error
YAML::PP::LibYAML Error: The problem:

    did not find expected alphabetic or numeric character

was found at , line: 1, column: 5
while scanning an anchor at line: 1, column: 4

perl-pplibyaml-perl

 error
YAML::PP::LibYAML Error: The problem:

    did not find expected alphabetic or numeric character

was found at , line: 1, column: 5
while scanning an anchor at line: 1, column: 4

perl-syck-json

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

perl-syck-perl

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

perl-xs-json

 error
YAML::XS::Load Error: The problem:

    did not find expected alphabetic or numeric character

was found at document: 1, line: 1, column: 5
while scanning an anchor at line: 1, column: 4

perl-xs-perl

 error
YAML::XS::Load Error: The problem:

    did not find expected alphabetic or numeric character

was found at document: 1, line: 1, column: 5
while scanning an anchor at line: 1, column: 4

perl-yaml-json

 error
YAML Error: Invalid anchor
   Code: YAML_PARSE_ERR_BAD_ANCHOR
   Line: 2
   Document: 1
 at /perl5/lib/perl5/YAML/Loader.pm line 238.

perl-yaml-perl

 error
YAML Error: Invalid anchor
   Code: YAML_PARSE_ERR_BAD_ANCHOR
   Line: 2
   Document: 1
 at /perl5/lib/perl5/YAML/Loader.pm line 238.

py-pyyaml-event

 error
+STR
+DOC
+MAP
=VAL :a
Traceback (most recent call last):
  File "/yaml/bin/py-pyyaml-event", line 7, in <module>
    for event in yaml.parse(sys.stdin.read()):
  File "/python/lib/python3.12/site-packages/yaml/__init__.py", line 75, in parse
    while loader.check_event():
          ^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/parser.py", line 449, in parse_block_mapping_value
    if not self.check_token(KeyToken, ValueToken, BlockEndToken):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/scanner.py", line 116, in check_token
    self.fetch_more_tokens()
  File "/python/lib/python3.12/site-packages/yaml/scanner.py", line 231, in fetch_more_tokens
    return self.fetch_anchor()
           ^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/scanner.py", line 621, in fetch_anchor
    self.tokens.append(self.scan_anchor(AnchorToken))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/scanner.py", line 922, in scan_anchor
    raise ScannerError("while scanning an %s" % name, start_mark,
yaml.scanner.ScannerError: while scanning an anchor
  in "<unicode string>", line 1, column 4:
    a: &:@*!$"<foo>: scalar a
       ^
expected alphabetic or numeric character, but found ':'
  in "<unicode string>", line 1, column 5:
    a: &:@*!$"<foo>: scalar a
        ^

py-pyyaml-json

 error
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/composer.py", line 27, in get_node
    return self.compose_document()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/composer.py", line 64, in compose_node
    if self.check_event(AliasEvent):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/parser.py", line 449, in parse_block_mapping_value
    if not self.check_token(KeyToken, ValueToken, BlockEndToken):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/scanner.py", line 116, in check_token
    self.fetch_more_tokens()
  File "/python/lib/python3.12/site-packages/yaml/scanner.py", line 231, in fetch_more_tokens
    return self.fetch_anchor()
           ^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/scanner.py", line 621, in fetch_anchor
    self.tokens.append(self.scan_anchor(AnchorToken))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/scanner.py", line 922, in scan_anchor
    raise ScannerError("while scanning an %s" % name, start_mark,
yaml.scanner.ScannerError: while scanning an anchor
  in "<unicode string>", line 1, column 4:
    a: &:@*!$"<foo>: scalar a
       ^
expected alphabetic or numeric character, but found ':'
  in "<unicode string>", line 1, column 5:
    a: &:@*!$"<foo>: scalar a
        ^

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/composer.py", line 27, in get_node
    return self.compose_document()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/composer.py", line 64, in compose_node
    if self.check_event(AliasEvent):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/parser.py", line 449, in parse_block_mapping_value
    if not self.check_token(KeyToken, ValueToken, BlockEndToken):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/scanner.py", line 116, in check_token
    self.fetch_more_tokens()
  File "/python/lib/python3.12/site-packages/yaml/scanner.py", line 231, in fetch_more_tokens
    return self.fetch_anchor()
           ^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/scanner.py", line 621, in fetch_anchor
    self.tokens.append(self.scan_anchor(AnchorToken))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/scanner.py", line 922, in scan_anchor
    raise ScannerError("while scanning an %s" % name, start_mark,
yaml.scanner.ScannerError: while scanning an anchor
  in "<unicode string>", line 1, column 4:
    a: &:@*!$"<foo>: scalar a
       ^
expected alphabetic or numeric character, but found ':'
  in "<unicode string>", line 1, column 5:
    a: &:@*!$"<foo>: scalar a
        ^

ruby-psych-json

 error
/ruby/gems/psych/lib/psych.rb:458:in `parse': (<unknown>): did not find expected alphabetic or numeric character while scanning an anchor at line 1 column 4 (Psych::SyntaxError)
	from /ruby/gems/psych/lib/psych.rb:458:in `parse_stream'
	from /ruby/gems/psych/lib/psych.rb:632:in `load_stream'
	from /yaml/bin/ruby-psych-json:6:in `<main>'

rust-yamlrust-event

 error
+STR
+DOC
+MAP
=VAL :a
Error: ScanError { mark: Marker { index: 3, line: 1, col: 3 }, info: "while scanning an anchor or alias, did not find expected alphabetic or numeric character" }

hs-reference-yeast

 na
Line  Col Char Byte Token|Content
   1    0    0    0 +DOC |
   1    0    0    0 +NODE|
   1    0    0    0 +MAP |
   1    0    0    0 +PAIR|
   1    0    0    0 +NODE|
   1    0    0    0 +VAL |
   1    0    0    0 =TEXT|a
   1    1    1    1 -VAL |
   1    1    1    1 -NODE|
   1    1    1    1 =SYNX|:
   1    2    2    2 =WSPC|.
   1    3    3    3 +NODE|
   1    3    3    3 +PROP|
   1    3    3    3 +ANCH|
   1    3    3    3 =SYNX|&
   1    4    4    4 =META|:@*!$"<foo>:
   1   16   16   16 -ANCH|
   1   16   16   16 -PROP|
   1   16   16   16 =WSPC|.
   1   17   17   17 +VAL |
   1   17   17   17 =TEXT|scalar.a
   1   25   25   25 -VAL |
   1   25   25   25 -NODE|
   1   25   25   25 =EOL |\x0a
   2    0   26   26 -PAIR|
   2    0   26   26 +PAIR|
   2    0   26   26 +NODE|
   2    0   26   26 +VAL |
   2    0   26   26 =TEXT|b
   2    1   27   27 -VAL |
   2    1   27   27 -NODE|
   2    1   27   27 =SYNX|:
   2    2   28   28 =WSPC|.
   2    3   29   29 +NODE|
   2    3   29   29 +ALI |
   2    3   29   29 =SYNX|*
   2    4   30   30 =META|:@*!$"<foo>:
   2   16   42   42 -ALI |
   2   16   42   42 -NODE|
   2   16   42   42 =EOL |\x0a
   3    0   43   43 -PAIR|
   3    0   43   43 -MAP |
   3    0   43   43 -NODE|
   3    0   43   43 -DOC |

perl-pp-perl

 na
{
  'a' => 'scalar a',
  'b' => 'scalar a'
}

py-ruamel-py

 na
{'a': 'scalar a', 'b': 'scalar a'}

perl-tiny-json

 ni
YAML::Tiny does not support a feature in line '&:@*!$"<foo>: scalar a' at /yaml/bin/perl-tiny-json line 12.

perl-tiny-perl

 ni
YAML::Tiny does not support a feature in line '&:@*!$"<foo>: scalar a' at /yaml/bin/perl-tiny-perl line 15.