MCPcopy Create free account
hub / github.com/buger/jsonparser / tokenStart

Function tokenStart

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

SYS-REQ-001 reqproof:lemma tokenStart_in_range func(data []byte) bool { r := tokenStart(data) return r >= 0 && r <= len(data) } reqproof:lemma tokenStart_nonneg func(data []byte) bool { return tokenStart(data) >= 0 } reqproof:lemma tokenStart_empty_zero func(data []byte) bool { r

(data []byte)

Source from the content-addressed store, hash-verified

194// return r == 0
195// }
196func tokenStart(data []byte) int {
197 for i := len(data) - 1; i >= 0; i-- {
198 // reqproof:invariant -1 <= i
199 // reqproof:invariant i < len(data)
200 c := data[i]
201 if c != 10 && c != 13 && c != 9 && c != 44 && c != 123 && c != 91 {
202 continue
203 }
204 return i
205 }
206
207 return 0
208}
209
210// SYS-REQ-001
211// Find position of next character which is not whitespace

Callers 4

FuzzTokenStartFunction · 0.85
TestTokenStartFunction · 0.85

Calls

no outgoing calls

Tested by 3

TestTokenStartFunction · 0.68