diff options
-rw-r--r-- | decode_scan.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/decode_scan.go b/decode_scan.go index 507bc42..85f3190 100644 --- a/decode_scan.go +++ b/decode_scan.go @@ -40,6 +40,7 @@ func (sc *runeTypeScanner) ReadRuneType() (rune, int, jsonparse.RuneType, error) case sc.initialized && (sc.rType == jsonparse.RuneTypeError || sc.rType == jsonparse.RuneTypeEOF): // do nothing case sc.repeat: + sc.offset += int64(sc.rSize) _, _, _ = sc.inner.ReadRune() default: sc.initialized = true @@ -93,16 +94,13 @@ func (sc *runeTypeScanner) UnreadRune() error { return ErrInvalidUnreadRune } sc.repeat = true + sc.offset -= int64(sc.rSize) _ = sc.inner.UnreadRune() return nil } func (sc *runeTypeScanner) InputOffset() int64 { - ret := sc.offset - if sc.repeat { - ret -= int64(sc.rSize) - } - return ret + return sc.offset } func (sc *runeTypeScanner) PushReadBarrier() { |