Skip to content

Parser fails to parse valid Yaml pattern foo: {abc} #348

@nma

Description

@nma

The change in parser from PR #213 introduces a bug.
Valid yaml is unable to be parsed.

We found this bug when trying to update from 1.8.9 -> 1.9.0. The latest version of go-yaml still exhibits this bug.


The following is valid YAML according to http://yamllint.com/

foo: {abc}

The new parser returns an error. The existing parser in v1.8.9 resolves {abc} as {"abc": null}.

func TestParser(t *testing.T) {
        source := `foo: {abc}`

        _, err := parser.ParseBytes([]byte(source), parser.ParseComments)
        if err != nil {
                t.Errorf("unable to parse yaml: %q, error: %v", source, err)
        }
}

Expected Behaviour: Parser properly tokenizes the valid foo: {abc} source string.
Actual Behaviour: Got error.

unable to parse yaml: "foo: {abc}", error: [1:6] unterminated flow mapping
            >  1 | foo: {abc}
                        ^

Other Observations:

Decode seems to work with the right struct field tagging.

Metadata

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