Assisted-by: GLM 5.3 Flash
This commit is contained in:
@@ -36,6 +36,10 @@ type parser struct {
|
||||
maxDepth int
|
||||
depth int
|
||||
|
||||
// useNumber leaves the numbers a Number carries the literal, instead of
|
||||
// the evaluated int64 or float64 the tree holds by default.
|
||||
useNumber bool
|
||||
|
||||
root map[string]any
|
||||
current map[string]any
|
||||
headers map[string]bool
|
||||
@@ -721,6 +725,11 @@ func (p *parser) parseAtom() (any, error) {
|
||||
if err != nil {
|
||||
return nil, p.errf("%s", err)
|
||||
}
|
||||
// The token's shape is validated either way; UseNumber only keeps the
|
||||
// literal instead of the evaluated value.
|
||||
if p.useNumber {
|
||||
return Number(tok), nil
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user