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

Function lastToken

parser.go:279–291  ·  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

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

Callers 4

deleteFoundConfigFunction · 0.85
setConfigFunction · 0.85

Calls

no outgoing calls

Tested by 2