<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/json_tokens/read.go
diff options
context:
space:
mode:
Diffstat (limited to 'json_tokens/read.go')
-rw-r--r--json_tokens/read.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/json_tokens/read.go b/json_tokens/read.go
index 95bbb9d..b0acf71 100644
--- a/json_tokens/read.go
+++ b/json_tokens/read.go
@@ -33,11 +33,11 @@ const (
)
type JSONIn struct {
- path []walk.Atom
+ path []walk.AtomOLD
reader *bufio.Reader
structure []JSONInStructure
state JSONInState
- readBuffer []walk.Atom
+ readBuffer []walk.AtomOLD
readIndex int
readBufferCapacity int
actionBuffer []ReadAction
@@ -46,11 +46,11 @@ type JSONIn struct {
func NewJSONIn(reader *bufio.Reader) *JSONIn {
return &JSONIn {
- path: make([]walk.Atom, 0, 256),
+ path: make([]walk.AtomOLD, 0, 256),
reader: reader,
structure: []JSONInStructure{},
state: JSONInValueStart,
- readBuffer: make([]walk.Atom, 0, 256),
+ readBuffer: make([]walk.AtomOLD, 0, 256),
readIndex: 0,
readBufferCapacity: 256,
actionBuffer: make([]ReadAction, 0, 256),
@@ -122,7 +122,7 @@ func (in *JSONIn) require(criterion rune) {
}
// Returns the first full value of a list of atoms and also a boolean to indicate if there isn't a value at the beginning
-func firstValue(atoms []walk.Atom) ([]walk.Atom, bool) {
+func firstValue(atoms []walk.AtomOLD) ([]walk.AtomOLD, bool) {
if len(atoms) == 0 {
return nil, true
}
@@ -141,12 +141,12 @@ func firstValue(atoms []walk.Atom) ([]walk.Atom, bool) {
}
}
-func (in *JSONIn) readValue() []walk.Atom {
+func (in *JSONIn) readValue() []walk.AtomOLD {
try:
value, incomplete := firstValue(in.readBuffer[in.readIndex:])
if incomplete {
if in.readIndex == 0 {
- newReadBuffer := make([]walk.Atom, len(in.readBuffer), in.readBufferCapacity * 2)
+ newReadBuffer := make([]walk.AtomOLD, len(in.readBuffer), in.readBufferCapacity * 2)
in.readBufferCapacity *= 2
copy(newReadBuffer, in.readBuffer)
in.readBuffer = newReadBuffer
@@ -216,7 +216,7 @@ func (in *JSONIn) AssertDone() {
}
}
-func (in *JSONIn) pushReadBuffer(atom walk.Atom) bool {
+func (in *JSONIn) pushReadBuffer(atom walk.AtomOLD) bool {
in.readBuffer = append(in.readBuffer, atom)
return len(in.readBuffer) == in.readBufferCapacity
}