Skip to content

Commit

Permalink
Fix handling of quotation character
Browse files Browse the repository at this point in the history
  • Loading branch information
goccy committed Nov 7, 2019
1 parent bc661e8 commit 00a1ab9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}{
Expand Down
12 changes: 7 additions & 5 deletions scanner/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 00a1ab9

Please sign in to comment.