1
0
mirror of https://github.com/json-iterator/go.git synced 2025-07-06 23:37:39 +02:00

#115 check object end

This commit is contained in:
Tao Wen
2017-07-06 16:04:52 +08:00
parent 8700644196
commit f7df62f1b5
3 changed files with 43 additions and 10 deletions

View File

@ -154,6 +154,18 @@ func (iter *Iterator) skipWhitespacesWithoutLoadMore() bool {
return true
}
func (iter *Iterator) isObjectEnd() bool {
c := iter.nextToken()
if c == ',' {
return false
}
if c == '}' {
return true
}
iter.ReportError("isObjectEnd", "object ended prematurely")
return true
}
func (iter *Iterator) nextToken() byte {
// a variation of skip whitespaces, returning the next non-whitespace token
for {