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

Function tokenStart

parser.go:186–198  ·  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

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