Add support for special float values (inf and nan) (#210)
This commit is contained in:
committed by
Thomas Pelletier
parent
a1e8a8d702
commit
778c285afa
@@ -5,6 +5,7 @@ package toml
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strconv"
|
||||
@@ -243,6 +244,13 @@ func (p *tomlParser) parseRvalue() interface{} {
|
||||
return true
|
||||
case tokenFalse:
|
||||
return false
|
||||
case tokenInf:
|
||||
if tok.val[0] == '-' {
|
||||
return math.Inf(-1)
|
||||
}
|
||||
return math.Inf(1)
|
||||
case tokenNan:
|
||||
return math.NaN()
|
||||
case tokenInteger:
|
||||
cleanedVal := cleanupNumberToken(tok.val)
|
||||
var err error
|
||||
|
||||
Reference in New Issue
Block a user