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

Function lastToken

parser.go:263–275  ·  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

261// return true
262// }
263func lastToken(data []byte) int {
264 for i := len(data) - 1; i >= 0; i-- {
265 // reqproof:invariant -1 <= i
266 // reqproof:invariant i < len(data)
267 c := data[i]
268 if c == ' ' || c == '\n' || c == '\r' || c == '\t' {
269 continue
270 }
271 return i
272 }
273
274 return -1
275}
276
277// SYS-REQ-045
278// Tries to find the end of string

Callers 4

DeleteFunction · 0.85
SetFunction · 0.85

Calls

no outgoing calls

Tested by 2