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

Function lastToken

parser.go:278–290  ·  view source on GitHub ↗

SYS-REQ-001 Find position of last character which is not whitespace reqproof:lemma lastToken_in_range func(data []byte) bool { r := lastToken(data) return r >= -1 && r < len(data) } reqproof:lemma lastToken_empty_neg func(data []byte) bool { return !(len(data) == 0) || lastToken(data)

(data []byte)

Source from the content-addressed store, hash-verified

276// return true
277// }
278func lastToken(data []byte) int {
279 for i := len(data) - 1; i >= 0; i-- {
280 // reqproof:invariant -1 <= i
281 // reqproof:invariant i < len(data)
282 c := data[i]
283 if c == ' ' || c == '\n' || c == '\r' || c == '\t' {
284 continue
285 }
286 return i
287 }
288
289 return -1
290}
291
292// SYS-REQ-045
293// Tries to find the end of string

Callers 4

deleteFoundConfigFunction · 0.85
setConfigFunction · 0.85

Calls

no outgoing calls

Tested by 2