<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/json_tokens
diff options
context:
space:
mode:
Diffstat (limited to 'json_tokens')
-rw-r--r--json_tokens/read.go16
-rw-r--r--json_tokens/write.go4
2 files changed, 10 insertions, 10 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
}
diff --git a/json_tokens/write.go b/json_tokens/write.go
index 813f2f3..78ed186 100644
--- a/json_tokens/write.go
+++ b/json_tokens/write.go
@@ -29,7 +29,7 @@ func (out *JSONOut) indent(adjust int) {
fmt.Fprint(out.writer, strings.Repeat("\t", len(out.structure) - 1 + adjust))
}
-func (out *JSONOut) atomOut(key string, atom walk.Atom) {
+func (out *JSONOut) atomOut(key string, atom walk.AtomOLD) {
state := out.structure[len(out.structure) - 1]
switch state {
case JSONOutRoot, JSONOutMap, JSONOutArray:
@@ -115,7 +115,7 @@ func (out *JSONOut) atomOut(key string, atom walk.Atom) {
}
}
-func (out *JSONOut) Print(path walk.Path, values []walk.Atom) {
+func (out *JSONOut) Print(path walk.Path, values []walk.AtomOLD) {
var segment walk.PathSegment
if len(path) > 0 {
segment = path[len(path) - 1]