Skip to content

Tag and Anchor in implicit key #378

Closed
@stdio2016

Description

Describe the bug
When I test YAML packages, I found some seemingly correct YAML cannot be parsed by this package.
Specifically, when tags or anchors occur in all but first implicit key, and map containing such key is not the top level node, this package reports a syntax error.

To Reproduce

var yaml = require('yaml');

var doc1 = `
some:
  !!str &a1 "foo":
    !!str bar
  &a2 baz : *a1`;
// error on yaml
console.log(yaml.parse(doc1));

Expected behaviour
I don't know if this is legal YAML. However, line 2 ~ 4 of doc1 is copied from yaml 1.2.2 spec.

Versions (please complete the following information):

  • Environment:
  • Node.js: 16.13.1
  • yaml: 2.0.0
  • js-yaml: 4.1.0

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions