MCPcopy
hub / github.com/protocolbuffers/protobuf-go / isValueNext

Method isValueNext

internal/encoding/json/decode.go:279–294  ·  view source on GitHub ↗

isValueNext returns true if next type should be a JSON value: Null, Number, String or Bool.

()

Source from the content-addressed store, hash-verified

277// isValueNext returns true if next type should be a JSON value: Null,
278// Number, String or Bool.
279func (d *Decoder) isValueNext() bool {
280 if len(d.openStack) == 0 {
281 return d.lastToken.kind == 0
282 }
283
284 start := d.openStack[len(d.openStack)-1]
285 switch start {
286 case ObjectOpen:
287 return d.lastToken.kind&Name != 0
288 case ArrayOpen:
289 return d.lastToken.kind&(ArrayOpen|comma) != 0
290 }
291 panic(fmt.Sprintf(
292 "unreachable logic in Decoder.isValueNext, lastToken.kind: %v, openStack: %v",
293 d.lastToken.kind, start))
294}
295
296// consumeToken constructs a Token for given Kind with raw value derived from
297// current d.in and given size, and consumes the given size-length of it.

Callers 1

ReadMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected