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

Function tokenStart

parser.go:197–209  ·  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

195// return r == 0
196// }
197func tokenStart(data []byte) int {
198 for i := len(data) - 1; i >= 0; i-- {
199 // reqproof:invariant -1 <= i
200 // reqproof:invariant i < len(data)
201 c := data[i]
202 if c != 10 && c != 13 && c != 9 && c != 44 && c != 123 && c != 91 {
203 continue
204 }
205 return i
206 }
207
208 return 0
209}
210
211// SYS-REQ-001
212// 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