diff --git a/parser.go b/parser.go index a031c2f..1584038 100644 --- a/parser.go +++ b/parser.go @@ -85,13 +85,13 @@ func (vec *Vector) parseGeneric(depth, offset int, node *vector.Node) (int, erro if e < 0 { return n, vector.ErrUnexpEOS } - node.Value().SetBit(flagEscape, false) + node.Value().SetBit(flagEscape, true) // Always mark string as escaped to avoid double indexing. if src[e-1] != '\\' { - // Good case - string isn't escaped. + // Good case - quote isn't escaped. node.Value().SetLen(e - offset - 1) offset = e + 1 } else { - // Walk over double quotas and look for unescaped. + // Walk over quotas and look for unescaped one. for i := e; i < n; { i = bytealg.IndexByteAtBytes(src, '"', i+1) if i < 0 { @@ -104,7 +104,6 @@ func (vec *Vector) parseGeneric(depth, offset int, node *vector.Node) (int, erro } } node.Value().SetLen(e - offset - 1) - node.Value().SetBit(flagEscape, true) offset = e + 1 } case isDigit(src[offset]): diff --git a/unescape.go b/unescape.go index bc2e0e1..e69950b 100644 --- a/unescape.go +++ b/unescape.go @@ -12,7 +12,7 @@ import ( func Unescape(p []byte) []byte { l, i := len(p), 0 for { - i = bytealg.IndexByteAtLUR(p, '\\', i) + i = bytealg.IndexByteAtBytes(p, '\\', i) if i < 0 || i+1 == l { break }