Accept underscores in integers

This commit is contained in:
Thomas Pelletier
2015-07-16 22:07:16 -07:00
parent 8fc7451ffc
commit 8e75093380
4 changed files with 42 additions and 1 deletions
+2 -1
View File
@@ -224,7 +224,8 @@ func (p *tomlParser) parseRvalue() interface{} {
case tokenFalse:
return false
case tokenInteger:
val, err := strconv.ParseInt(tok.val, 10, 64)
cleanedVal := strings.Replace(tok.val, "_", "", -1)
val, err := strconv.ParseInt(cleanedVal, 10, 64)
if err != nil {
p.raiseError(tok, "%s", err)
}