package jximport ()// Elem skips to the start of next array element, returning true boolean// if element exists.//// Can be called before or in Array.func ( *Decoder) () ( bool, error) { , := .next()if != nil {returnfalse, }switch {case'[': , := .more()if != nil {returnfalse, }if != ']' { .unread()returntrue, nil }returnfalse, nilcase']':returnfalse, nilcase',':returntrue, nildefault:returnfalse, errors.Wrap(badToken(, .offset()), `"[", "," or "]" expected`) }}// Arr decodes array and invokes callback on each array element.func ( *Decoder) ( func( *Decoder) error) error {if := .consume('['); != nil {returnerrors.Wrap(, `"[" expected`) }if == nil {return .skipArr() }if := .incDepth(); != nil {return } , := .more()if != nil {returnerrors.Wrap(, `value or "]" expected`) }if == ']' {return .decDepth() } .unread()if := (); != nil {returnerrors.Wrap(, "callback") } , = .more()if != nil {returnerrors.Wrap(, `"," or "]" expected`) }for == ',' {// Skip whitespace before reading element.if , := .next(); != nil {return } .unread()if := (); != nil {returnerrors.Wrap(, "callback") }if , = .next(); != nil {return } }if != ']' { := badToken(, .offset()-1)returnerrors.Wrap(, `"]" expected`) }return .decDepth()}
The pages are generated with Goldsv0.6.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.