mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-07-06 22:24:06 +00:00
Update dependencies and remove old matterclient lib (#2067)
This commit is contained in:
16
vendor/github.com/d5/tengo/v2/stdlib/json/decode.go
generated
vendored
16
vendor/github.com/d5/tengo/v2/stdlib/json/decode.go
generated
vendored
@ -62,9 +62,12 @@ func (d *decodeState) scanNext() {
|
||||
|
||||
// scanWhile processes bytes in d.data[d.off:] until it
|
||||
// receives a scan code not equal to op.
|
||||
func (d *decodeState) scanWhile(op int) {
|
||||
func (d *decodeState) scanWhile(op int) (isFloat bool) {
|
||||
s, data, i := &d.scan, d.data, d.off
|
||||
for i < len(data) {
|
||||
if data[i] == '.' || data[i] == 'e' || data[i] == 'E' {
|
||||
isFloat = true
|
||||
}
|
||||
newOp := s.step(s, data[i])
|
||||
i++
|
||||
if newOp != op {
|
||||
@ -76,6 +79,7 @@ func (d *decodeState) scanWhile(op int) {
|
||||
|
||||
d.off = len(data) + 1 // mark processed EOF with len+1
|
||||
d.opcode = d.scan.eof()
|
||||
return
|
||||
}
|
||||
|
||||
func (d *decodeState) value() (tengo.Object, error) {
|
||||
@ -185,7 +189,7 @@ func (d *decodeState) object() (tengo.Object, error) {
|
||||
func (d *decodeState) literal() (tengo.Object, error) {
|
||||
// All bytes inside literal return scanContinue op code.
|
||||
start := d.readIndex()
|
||||
d.scanWhile(scanContinue)
|
||||
isFloat := d.scanWhile(scanContinue)
|
||||
|
||||
item := d.data[start:d.readIndex()]
|
||||
|
||||
@ -210,8 +214,12 @@ func (d *decodeState) literal() (tengo.Object, error) {
|
||||
if c != '-' && (c < '0' || c > '9') {
|
||||
panic(phasePanicMsg)
|
||||
}
|
||||
n, _ := strconv.ParseFloat(string(item), 10)
|
||||
return &tengo.Float{Value: n}, nil
|
||||
if isFloat {
|
||||
n, _ := strconv.ParseFloat(string(item), 10)
|
||||
return &tengo.Float{Value: n}, nil
|
||||
}
|
||||
n, _ := strconv.ParseInt(string(item), 10, 64)
|
||||
return &tengo.Int{Value: n}, nil
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user