1
0
mirror of https://github.com/json-iterator/go.git synced 2025-06-15 22:50:24 +02:00

expose Parse from Any

This commit is contained in:
Tao Wen
2017-01-26 15:40:38 +08:00
parent 4d7e181f9f
commit 97472ecd96
9 changed files with 84 additions and 39 deletions

View File

@ -13,15 +13,20 @@ type floatLazyAny struct {
cache float64
}
func (any *floatLazyAny) fillCache() {
if any.err != nil {
return
}
func (any *floatLazyAny) Parse() *Iterator {
iter := any.iter
if iter == nil {
iter = NewIterator()
}
iter.ResetBytes(any.buf)
return iter
}
func (any *floatLazyAny) fillCache() {
if any.err != nil {
return
}
iter := any.Parse()
any.cache = iter.ReadFloat64()
if iter.Error != io.EOF {
iter.reportError("floatLazyAny", "there are bytes left")