summaryrefslogtreecommitdiff
path: root/decode_scan.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2023-02-07 12:18:29 -0700
committerLuke Shumaker <lukeshu@lukeshu.com>2023-02-07 14:05:26 -0700
commit2b9473f5e8816eeea76b2fdada184532be00d3a2 (patch)
tree387757b00f02521d1b3824a0e92f7778dbd32440 /decode_scan.go
parenteab38672b2467810592b61fe5b0067086d3cbd2c (diff)
internal: Split in to sub-packages
Diffstat (limited to 'decode_scan.go')
-rw-r--r--decode_scan.go18
1 files changed, 9 insertions, 9 deletions
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()