summaryrefslogtreecommitdiff
path: root/internal/jsonparse/parse.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/jsonparse/parse.go')
-rw-r--r--internal/jsonparse/parse.go20
1 files changed, 8 insertions, 12 deletions
diff --git a/internal/jsonparse/parse.go b/internal/jsonparse/parse.go
index 2f5c1ab..d867cbc 100644
--- a/internal/jsonparse/parse.go
+++ b/internal/jsonparse/parse.go
@@ -324,8 +324,7 @@ type Parser struct {
}
type barrier struct {
- closed bool
- stack []RuneType
+ stack []RuneType
}
func (par *Parser) init() {
@@ -387,7 +386,7 @@ func (par *Parser) Reset() {
}
}
-// PushReadBarrier causes the parser to expect EOF once the end of the
+// PushReadBarrier causes the parser to emit EOF once the end of the
// element that is started by the current top-of-stack is reached,
// until this is un-done with PopBarrier. It essentially turns the
// parser in to a sub-parser.
@@ -425,14 +424,13 @@ func (par *Parser) PushReadBarrier() {
}
// Actually push.
par.barriers = append(par.barriers, barrier{
- closed: par.closed,
- stack: par.stack[:len(par.stack)-1],
+ stack: par.stack[:len(par.stack)-1],
})
par.stack = []RuneType{curState}
}
-// PushWriteBarrier causes the parser to expect EOF once the end of
-// the about-to-start element is reached, until this is un-done with
+// PushWriteBarrier causes the parser to emit EOF once the end of the
+// about-to-start element is reached, until this is un-done with
// PopBarrier. It essentially turns the parser in to a sub-parser.
//
// PushWriteBarrier may only be called at the places where an element
@@ -453,15 +451,13 @@ func (par *Parser) PushWriteBarrier() {
case runeTypeAny:
par.popState()
par.barriers = append(par.barriers, barrier{
- closed: par.closed,
- stack: par.stack,
+ stack: par.stack,
})
par.stack = []RuneType{runeTypeAny}
case RuneTypeArrayBeg:
par.replaceState(RuneTypeArrayComma)
par.barriers = append(par.barriers, barrier{
- closed: par.closed,
- stack: par.stack,
+ stack: par.stack,
})
par.stack = []RuneType{runeTypeAny}
default:
@@ -476,7 +472,7 @@ func (par *Parser) PopBarrier() {
}
barrier := par.barriers[len(par.barriers)-1]
par.barriers = par.barriers[:len(par.barriers)-1]
- par.closed = barrier.closed
+ par.closed = false
par.stack = append(barrier.stack, par.stack...)
}