ruyaml
ruyaml copied to clipboard
Use of alias as a map key requires a space between alias map key and the colon
YAML code snippet:
stuff:
key1: &k1 'map_key1'
key2: &k2 'map_key2`
*k1 : value1 # works, but requires space before colon
*k2: value2 # fails with "could not find expected ':'"
PyYAML accepts no space between map key and colon, but ruyaml does not
k2:
is a valid alias name in YAML (unfortunately).
PyYAML and libyaml implemented this wrong, although I can understand the decision to not support colons in alias names.
Therefor, a space is required if an alias is used as a key (so the title of this issue is right). This is one of the things that might get removed in the next YAML version, and then the space wouldn't be required anymore, but until then, it's necessary.
Good to know. Thanks for the response.