diff --git a/decode_test.go b/decode_test.go index d41ed480..0319398b 100644 --- a/decode_test.go +++ b/decode_test.go @@ -804,6 +804,10 @@ func TestDecoder(t *testing.T) { "v: 1[]{},!%?&*", map[string]string{"v": "1[]{},!%?&*"}, }, + { + "v: user's item", + map[string]string{"v": "user's item"}, + }, { "v: [1,[2,[3,[4,5],6],7],8]", map[string]interface{}{ diff --git a/scanner/scanner.go b/scanner/scanner.go index 5b3957a3..531bfa60 100644 --- a/scanner/scanner.go +++ b/scanner/scanner.go @@ -452,11 +452,13 @@ func (s *Scanner) scan(ctx *Context) (pos int) { pos += progress return case '\'', '"': - token, progress := s.scanQuote(ctx, c) - ctx.addToken(token) - s.progressColumn(ctx, progress) - pos += progress - return + if ctx.bufferedSrc() == "" { + token, progress := s.scanQuote(ctx, c) + ctx.addToken(token) + s.progressColumn(ctx, progress) + pos += progress + return + } case '\n': s.scanNewLine(ctx, c) continue