MCPcopy Create free account
hub / github.com/blues/note / scanWhile

Method scanWhile

jsonxt/decode.go:344–358  ·  view source on GitHub ↗

scanWhile processes bytes in d.data[d.off:] until it receives a scan code not equal to op.

(op int)

Source from the content-addressed store, hash-verified

342// scanWhile processes bytes in d.data[d.off:] until it
343// receives a scan code not equal to op.
344func (d *decodeState) scanWhile(op int) {
345 s, data, i := &d.scan, d.data, d.off
346 for i < len(data) {
347 newOp := s.step(s, data[i])
348 i++
349 if newOp != op {
350 d.opcode = newOp
351 d.off = i
352 return
353 }
354 }
355
356 d.off = len(data) + 1 // mark processed EOF with len+1
357 d.opcode = d.scan.eof()
358}
359
360// value consumes a JSON value from d.data[d.off-1:], decoding into v, and
361// reads the following byte ahead. If v is invalid, the value is discarded.

Callers 7

unmarshalMethod · 0.95
valueMethod · 0.95
arrayMethod · 0.95
objectMethod · 0.95
arrayInterfaceMethod · 0.95
objectInterfaceMethod · 0.95
literalInterfaceMethod · 0.95

Calls 1

eofMethod · 0.80

Tested by

no test coverage detected