MCPcopy Index your code
hub / github.com/go-openapi/jsonpointer / skipJSONSeparator

Function skipJSONSeparator

pointer.go:197–209  ·  view source on GitHub ↗

skipJSONSeparator advances offset past trailing JSON whitespace and at most one value separator (comma) in document, so the result points at the first byte of the next JSON token. The streaming decoder's InputOffset sits right after the most recently consumed token, which between values is the comm

(document string, offset int64)

Source from the content-addressed store, hash-verified

195// regardless of position within the parent container, the returned offset always points at the
196// first byte of the addressed token.
197func skipJSONSeparator(document string, offset int64) int64 {
198 n := int64(len(document))
199 for offset < n && isJSONWhitespace(document[offset]) {
200 offset++
201 }
202 if offset < n && document[offset] == ',' {
203 offset++
204 }
205 for offset < n && isJSONWhitespace(document[offset]) {
206 offset++
207 }
208 return offset
209}
210
211func isJSONWhitespace(c byte) bool {
212 return c == ' ' || c == '\t' || c == '\n' || c == '\r'

Callers 1

OffsetMethod · 0.85

Calls 1

isJSONWhitespaceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…