diff options
-rw-r--r-- | decode_scan.go | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/decode_scan.go b/decode_scan.go index 7a52975..b0fc7c3 100644 --- a/decode_scan.go +++ b/decode_scan.go @@ -28,28 +28,6 @@ type runeTypeScanner struct { rErr error } -func (sc *runeTypeScanner) Reset() { - sc.parser.Reset() - if sc.repeat || (sc.rType == jsonparse.RuneTypeEOF && sc.rSize > 0) { - sc.repeat = false - // re-figure the rType and rErr - var err error - sc.rType, err = sc.parser.HandleRune(sc.rRune) - if err != nil { - sc.rErr = &DecodeSyntaxError{ - Offset: sc.offset - int64(sc.rSize), - Err: err, - } - } else { - sc.rErr = nil - } - // tell it to use that rType and rErr - _ = sc.UnreadRune() // we set it up to always succeed - } else { - sc.initialized = false - } -} - // The returned error is a *ReadError, a *SyntaxError, or nil. // An EOF condition is represented as one of: // @@ -161,3 +139,25 @@ func (sc *runeTypeScanner) PopReadBarrier() { } } } + +func (sc *runeTypeScanner) Reset() { + sc.parser.Reset() + if sc.repeat || (sc.rType == jsonparse.RuneTypeEOF && sc.rSize > 0) { + sc.repeat = false + // re-figure the rType and rErr + var err error + sc.rType, err = sc.parser.HandleRune(sc.rRune) + if err != nil { + sc.rErr = &DecodeSyntaxError{ + Offset: sc.offset - int64(sc.rSize), + Err: err, + } + } else { + sc.rErr = nil + } + // tell it to use that rType and rErr + _ = sc.UnreadRune() // we set it up to always succeed + } else { + sc.initialized = false + } +} |