Skip to content

Commit

Permalink
Fix handling of quotation character (#28)
Browse files Browse the repository at this point in the history
Fix handling of quotation character
  • Loading branch information
goccy authored Nov 7, 2019
2 parents bc661e8 + 00a1ab9 commit 24e68b4
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 24e68b4

Please sign in to comment.