MCPcopy
hub / github.com/tidwall/gjson / parseString

Function parseString

gjson.go:695–731  ·  view source on GitHub ↗
(json string, i int)

Source from the content-addressed store, hash-verified

693}
694
695func parseString(json string, i int) (int, string, bool, bool) {
696 var s = i
697 for ; i < len(json); i++ {
698 if json[i] > '\\' {
699 continue
700 }
701 if json[i] == '"' {
702 return i + 1, json[s-1 : i+1], false, true
703 }
704 if json[i] == '\\' {
705 i++
706 for ; i < len(json); i++ {
707 if json[i] > '\\' {
708 continue
709 }
710 if json[i] == '"' {
711 // look for an escaped slash
712 if json[i-1] == '\\' {
713 n := 0
714 for j := i - 2; j > 0; j-- {
715 if json[j] != '\\' {
716 break
717 }
718 n++
719 }
720 if n%2 == 0 {
721 continue
722 }
723 }
724 return i + 1, json[s-1 : i+1], true, true
725 }
726 }
727 break
728 }
729 }
730 return i, json[s-1:], false, false
731}
732
733func parseNumber(json string, i int) (int, string) {
734 var s = i

Callers 4

ForEachMethod · 0.85
parseObjectFunction · 0.85
parseArrayFunction · 0.85
parseAnyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…