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

Function lastToken

parser.go:264–276  ·  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

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

Callers 4

DeleteFoundFunction · 0.85
SetFunction · 0.85

Calls

no outgoing calls

Tested by 2