diff --git a/parser.go b/parser.go index 09414d6..31e69cf 100644 --- a/parser.go +++ b/parser.go @@ -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]) { diff --git a/unmarshaler_test.go b/unmarshaler_test.go index 367f223..d0c1aaa 100644 --- a/unmarshaler_test.go +++ b/unmarshaler_test.go @@ -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 = """\