Fix unmarshaling of literal keys

Ref #427.
This commit is contained in:
Thomas Pelletier
2021-03-29 20:58:51 -04:00
parent 78389c641a
commit 51d78a5f0c
2 changed files with 16 additions and 1 deletions
+1 -1
View File
@@ -594,7 +594,7 @@ func (p *parser) parseSimpleKey(b []byte) (key, rest []byte, err error) {
}
if b[0] == '\'' {
key, rest, err = scanLiteralString(b)
key, rest, err = p.parseLiteralString(b)
} else if b[0] == '"' {
key, rest, err = p.parseBasicString(b)
} else if isUnquotedKeyChar(b[0]) {
+15
View File
@@ -210,6 +210,21 @@ func TestUnmarshal(t *testing.T) {
}
},
},
{
desc: "issue 427 - quotation marks in key",
input: `'"a"' = 1
"\"b\"" = 2`,
gen: func() test {
m := map[string]interface{}{}
return test{
target: &m,
expected: &map[string]interface{}{
`"a"`: int64(1),
`"b"`: int64(2),
},
}
},
},
{
desc: "multiline basic string",
input: `A = """\