dtolnay / serde-yaml

Strongly typed YAML library for Rust
Apache License 2.0
964 stars 164 forks source link

[BUG] Tagged null at end of flow sequence gives scanner error #396

Open Kyuuhachi opened 1 year ago

Kyuuhachi commented 1 year ago

From what I can tell, [!tag] is supposed to be valid syntax. However, trying to parse it, we get

Error {
    kind: SCANNER,
    problem: "did not find expected whitespace or line break",
    problem_mark: Mark {
        line: 1,
        column: 6,
    },
    context: "while scanning a tag",
    context_mark: Mark {
        line: 1,
        column: 2,
    },
}

Adding a trailing space, newline, or comma makes it parse correctly:

[!tag,]

is parsed as

Sequence [
    TaggedValue {
        tag: !tag,
        value: Null,
    },
]