Этот коммит содержится в:
Christopher Speller
2018-01-29 14:17:40 -08:00
коммит произвёл GitHub
родитель 8d66523ba7
Коммит 961c04cae9
1508 изменённых файлов: 182081 добавлений и 24688 удалений

19
vendor/github.com/pelletier/go-toml/parser.go сгенерированный поставляемый
Просмотреть файл

@@ -5,6 +5,7 @@ package toml
import (
"errors"
"fmt"
"math"
"reflect"
"regexp"
"strconv"
@@ -110,7 +111,7 @@ func (p *tomlParser) parseGroupArray() tomlParserStateFn {
newTree := newTree()
newTree.position = startToken.Position
array = append(array, newTree)
p.tree.SetPath(p.currentTable, "", false, array)
p.tree.SetPath(p.currentTable, array)
// remove all keys that were children of this table array
prefix := key.val + "."
@@ -185,10 +186,7 @@ func (p *tomlParser) parseAssign() tomlParserStateFn {
}
// assign value to the found table
keyVals, err := parseKey(key.val)
if err != nil {
p.raiseError(key, "%s", err)
}
keyVals := []string{key.val}
if len(keyVals) != 1 {
p.raiseError(key, "Invalid key")
}
@@ -246,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
@@ -340,7 +345,7 @@ Loop:
key := p.getToken()
p.assume(tokenEqual)
value := p.parseRvalue()
tree.Set(key.val, "", false, value)
tree.Set(key.val, value)
case tokenComma:
if previous == nil {
p.raiseError(follow, "inline table cannot start with a comma")
@@ -350,7 +355,7 @@ Loop:
}
p.getToken()
default:
p.raiseError(follow, "unexpected token type in inline table: %s", follow.typ.String())
p.raiseError(follow, "unexpected token type in inline table: %s", follow.String())
}
previous = follow
}