in hop.go [12:42]
func test(in *jlexer.Lexer, path string, start int) (ok bool) {
if start == len(path)+1 {
return true
}
if in.IsNull() {
return false
}
// We use this somewhat arduous slicing method as it avoids the
// allocation which is otherwise required by strings.Split
end := start + strings.IndexByte(path[start:], delimiter)
if end == start-1 {
end = len(path)
}
needle := path[start:end]
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if key == needle {
return test(in, path, end+1)
} else {
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
return false
}