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

Function tokenStart

parser.go:187–199  ·  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

185// return r == 0
186// }
187func tokenStart(data []byte) int {
188 for i := len(data) - 1; i >= 0; i-- {
189 // reqproof:invariant -1 <= i
190 // reqproof:invariant i < len(data)
191 c := data[i]
192 if c != 10 && c != 13 && c != 9 && c != 44 && c != 123 && c != 91 {
193 continue
194 }
195 return i
196 }
197
198 return 0
199}
200
201// SYS-REQ-001
202// 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