We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7b96513 commit b2c438fCopy full SHA for b2c438f
parser.go
@@ -23,18 +23,19 @@ func nextValue(data []byte) int {
23
// Tries to find the end of string
24
// Support if string contains escaped quote symbols.
25
func stringEnd(data []byte) int {
26
- escaped := false
27
for i, c := range data {
28
- switch c {
29
- case '\\':
30
- escaped = !escaped
31
- case '"':
32
- if !escaped {
33
- return i + 1
+ if c == '"' {
+ j := i - 1
+ for {
+ if j < 0 || data[j] != '\\' {
+ return i + 1 // even number of backslashes
+ }
+ j--
34
35
+ break // odd number of backslashes
36
37
38
}
- escaped = false
- default:
39
40
41
0 commit comments