From 2b9473f5e8816eeea76b2fdada184532be00d3a2 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 7 Feb 2023 12:18:29 -0700 Subject: internal: Split in to sub-packages --- decode_scan.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'decode_scan.go') diff --git a/decode_scan.go b/decode_scan.go index 521c5c4..7a52975 100644 --- a/decode_scan.go +++ b/decode_scan.go @@ -7,7 +7,7 @@ package lowmemjson import ( "io" - "git.lukeshu.com/go/lowmemjson/internal" + "git.lukeshu.com/go/lowmemjson/internal/jsonparse" ) type runeTypeScanner struct { @@ -16,7 +16,7 @@ type runeTypeScanner struct { inner io.RuneScanner // initialized by constructor - parser internal.Parser // initialized by constructor + parser jsonparse.Parser // initialized by constructor offset int64 initialized bool @@ -24,13 +24,13 @@ type runeTypeScanner struct { rRune rune rSize int - rType internal.RuneType + rType jsonparse.RuneType rErr error } func (sc *runeTypeScanner) Reset() { sc.parser.Reset() - if sc.repeat || (sc.rType == internal.RuneTypeEOF && sc.rSize > 0) { + if sc.repeat || (sc.rType == jsonparse.RuneTypeEOF && sc.rSize > 0) { sc.repeat = false // re-figure the rType and rErr var err error @@ -57,9 +57,9 @@ func (sc *runeTypeScanner) Reset() { // end of both value and file: (_, 0, RuneTypeEOF, nil) // end of file in middle of value: (_, 0, RuneTypeError, &DecodeSyntaxError{Offset: offset: Err: io.ErrUnexepctedEOF}) // end of file at start of value: (_, 0, RuneTypeError, &DecodeSyntaxError{Offset: offset: Err: io.EOF}) -func (sc *runeTypeScanner) ReadRuneType() (rune, int, internal.RuneType, error) { +func (sc *runeTypeScanner) ReadRuneType() (rune, int, jsonparse.RuneType, error) { switch { - case sc.initialized && (sc.rType == internal.RuneTypeError || sc.rType == internal.RuneTypeEOF): + case sc.initialized && (sc.rType == jsonparse.RuneTypeError || sc.rType == jsonparse.RuneTypeEOF): // do nothing case sc.repeat: _, _, _ = sc.inner.ReadRune() @@ -80,7 +80,7 @@ func (sc *runeTypeScanner) ReadRuneType() (rune, int, internal.RuneType, error) } else { sc.rErr = nil } - if sc.rType == internal.RuneTypeSpace { + if sc.rType == jsonparse.RuneTypeSpace { goto again } case io.EOF: @@ -133,7 +133,7 @@ func (sc *runeTypeScanner) PushReadBarrier() { func (sc *runeTypeScanner) PopReadBarrier() { sc.parser.PopBarrier() - if sc.repeat || (sc.rType == internal.RuneTypeEOF && sc.rSize > 0) { + if sc.repeat || (sc.rType == jsonparse.RuneTypeEOF && sc.rSize > 0) { // re-figure the rType and rErr var err error sc.rType, err = sc.parser.HandleRune(sc.rRune) @@ -147,7 +147,7 @@ func (sc *runeTypeScanner) PopReadBarrier() { } // tell it to use that rType and rErr _ = sc.UnreadRune() // we set it up to always succeed - } else if sc.rType == internal.RuneTypeEOF { + } else if sc.rType == jsonparse.RuneTypeEOF { // re-figure the rType and rErr var err error sc.rType, err = sc.parser.HandleEOF() -- cgit v1.2.3-2-g168b