MCPcopy Index your code
hub / github.com/buger/jsonparser / stringEnd

Function stringEnd

parser.go:170–196  ·  view source on GitHub ↗

SYS-REQ-045 Tries to find the end of string Support if string contains escaped quote symbols.

(data []byte)

Source from the content-addressed store, hash-verified

168// Tries to find the end of string
169// Support if string contains escaped quote symbols.
170func stringEnd(data []byte) (int, bool) {
171 escaped := false
172 for i, c := range data {
173 if c == '"' {
174 if !escaped {
175 return i + 1, false
176 } else {
177 j := i - 1
178 for {
179 if j < 0 || data[j] != '\\' {
180 return i + 1, true // even number of backslashes
181 }
182 j--
183 if j < 0 || data[j] != '\\' {
184 break // odd number of backslashes
185 }
186 j--
187
188 }
189 }
190 } else if c == '\\' {
191 escaped = true
192 }
193 }
194
195 return -1, escaped
196}
197
198// SYS-REQ-046
199// Find end of the data structure, array or object.

Callers 7

findKeyStartFunction · 0.85
blockEndFunction · 0.85
searchKeysFunction · 0.85
EachKeyFunction · 0.85
getTypeFunction · 0.85
ObjectEachFunction · 0.85
TestStringEndSentinelFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestStringEndSentinelFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…