diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-02-18 22:45:30 -0700 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-02-18 22:45:30 -0700 |
commit | cf75ff06887d7bbb5bbbd682587b9d3f5e474670 (patch) | |
tree | 7f8999f73fa4e4c5759a174cebed7c8919fa05e1 /internal/jsonparse/parse.go | |
parent | 1b773c966cdb6b38cc4bc73e218793db3a9442ba (diff) | |
parent | ec0482f598f4b7b05c21b1d19fe8183665e3fe93 (diff) |
Merge branch 'lukeshu/scan-tidy'
Diffstat (limited to 'internal/jsonparse/parse.go')
-rw-r--r-- | internal/jsonparse/parse.go | 20 |
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...) } |