vendor: added vendor packages necessary for the swarm-network-rewrite merge (#16792)
* vendor: added vendor packages necessary for the swarm-network-rewrite merge into ethereum master * vendor: removed multihash deps
This commit is contained in:
12
vendor/github.com/naoina/toml/encode.go
generated
vendored
12
vendor/github.com/naoina/toml/encode.go
generated
vendored
@ -61,20 +61,26 @@ func (cfg *Config) NewEncoder(w io.Writer) *Encoder {
|
||||
// Encode writes the TOML of v to the stream.
|
||||
// See the documentation for Marshal for details about the conversion of Go values to TOML.
|
||||
func (e *Encoder) Encode(v interface{}) error {
|
||||
rv := reflect.ValueOf(v)
|
||||
var (
|
||||
buf = &tableBuf{typ: ast.TableTypeNormal}
|
||||
rv = reflect.ValueOf(v)
|
||||
err error
|
||||
)
|
||||
|
||||
for rv.Kind() == reflect.Ptr {
|
||||
if rv.IsNil() {
|
||||
return &marshalNilError{rv.Type()}
|
||||
}
|
||||
rv = rv.Elem()
|
||||
}
|
||||
buf := &tableBuf{typ: ast.TableTypeNormal}
|
||||
var err error
|
||||
|
||||
switch rv.Kind() {
|
||||
case reflect.Struct:
|
||||
err = buf.structFields(e.cfg, rv)
|
||||
case reflect.Map:
|
||||
err = buf.mapFields(e.cfg, rv)
|
||||
case reflect.Interface:
|
||||
return e.Encode(rv.Interface())
|
||||
default:
|
||||
err = &marshalTableError{rv.Type()}
|
||||
}
|
||||
|
52
vendor/github.com/naoina/toml/parse.go
generated
vendored
52
vendor/github.com/naoina/toml/parse.go
generated
vendored
@ -97,6 +97,7 @@ type toml struct {
|
||||
currentTable *ast.Table
|
||||
s string
|
||||
key string
|
||||
tableKeys []string
|
||||
val ast.Value
|
||||
arr *array
|
||||
stack []*stack
|
||||
@ -180,12 +181,12 @@ func (p *tomlParser) SetArray(begin, end int) {
|
||||
}
|
||||
|
||||
func (p *toml) SetTable(buf []rune, begin, end int) {
|
||||
p.setTable(p.table, buf, begin, end)
|
||||
rawName := string(buf[begin:end])
|
||||
p.setTable(p.table, rawName, p.tableKeys)
|
||||
p.tableKeys = nil
|
||||
}
|
||||
|
||||
func (p *toml) setTable(parent *ast.Table, buf []rune, begin, end int) {
|
||||
name := string(buf[begin:end])
|
||||
names := splitTableKey(name)
|
||||
func (p *toml) setTable(parent *ast.Table, name string, names []string) {
|
||||
parent, err := p.lookupTable(parent, names[:len(names)-1])
|
||||
if err != nil {
|
||||
p.Error(err)
|
||||
@ -230,12 +231,12 @@ func (p *tomlParser) SetTableString(begin, end int) {
|
||||
}
|
||||
|
||||
func (p *toml) SetArrayTable(buf []rune, begin, end int) {
|
||||
p.setArrayTable(p.table, buf, begin, end)
|
||||
rawName := string(buf[begin:end])
|
||||
p.setArrayTable(p.table, rawName, p.tableKeys)
|
||||
p.tableKeys = nil
|
||||
}
|
||||
|
||||
func (p *toml) setArrayTable(parent *ast.Table, buf []rune, begin, end int) {
|
||||
name := string(buf[begin:end])
|
||||
names := splitTableKey(name)
|
||||
func (p *toml) setArrayTable(parent *ast.Table, name string, names []string) {
|
||||
parent, err := p.lookupTable(parent, names[:len(names)-1])
|
||||
if err != nil {
|
||||
p.Error(err)
|
||||
@ -260,11 +261,11 @@ func (p *toml) setArrayTable(parent *ast.Table, buf []rune, begin, end int) {
|
||||
func (p *toml) StartInlineTable() {
|
||||
p.skip = false
|
||||
p.stack = append(p.stack, &stack{p.key, p.currentTable})
|
||||
buf := []rune(p.key)
|
||||
names := []string{p.key}
|
||||
if p.arr == nil {
|
||||
p.setTable(p.currentTable, buf, 0, len(buf))
|
||||
p.setTable(p.currentTable, names[0], names)
|
||||
} else {
|
||||
p.setArrayTable(p.currentTable, buf, 0, len(buf))
|
||||
p.setArrayTable(p.currentTable, names[0], names)
|
||||
}
|
||||
}
|
||||
|
||||
@ -282,6 +283,13 @@ func (p *toml) AddLineCount(i int) {
|
||||
|
||||
func (p *toml) SetKey(buf []rune, begin, end int) {
|
||||
p.key = string(buf[begin:end])
|
||||
if len(p.key) > 0 && p.key[0] == '"' {
|
||||
p.key = p.unquote(p.key)
|
||||
}
|
||||
}
|
||||
|
||||
func (p *toml) AddTableKey() {
|
||||
p.tableKeys = append(p.tableKeys, p.key)
|
||||
}
|
||||
|
||||
func (p *toml) AddKeyValue() {
|
||||
@ -352,25 +360,3 @@ func (p *toml) lookupTable(t *ast.Table, keys []string) (*ast.Table, error) {
|
||||
}
|
||||
return t, nil
|
||||
}
|
||||
|
||||
func splitTableKey(tk string) []string {
|
||||
key := make([]byte, 0, 1)
|
||||
keys := make([]string, 0, 1)
|
||||
inQuote := false
|
||||
for i := 0; i < len(tk); i++ {
|
||||
k := tk[i]
|
||||
switch {
|
||||
case k == tableSeparator && !inQuote:
|
||||
keys = append(keys, string(key))
|
||||
key = key[:0] // reuse buffer.
|
||||
case k == '"':
|
||||
inQuote = !inQuote
|
||||
case (k == ' ' || k == '\t') && !inQuote:
|
||||
// skip.
|
||||
default:
|
||||
key = append(key, k)
|
||||
}
|
||||
}
|
||||
keys = append(keys, string(key))
|
||||
return keys
|
||||
}
|
||||
|
8
vendor/github.com/naoina/toml/parse.peg
generated
vendored
8
vendor/github.com/naoina/toml/parse.peg
generated
vendored
@ -29,7 +29,7 @@ key <- bareKey / quotedKey
|
||||
|
||||
bareKey <- <[0-9A-Za-z\-_]+> { p.SetKey(p.buffer, begin, end) }
|
||||
|
||||
quotedKey <- '"' <basicChar+> '"' { p.SetKey(p.buffer, begin-1, end+1) }
|
||||
quotedKey <- < '"' basicChar* '"' > { p.SetKey(p.buffer, begin, end) }
|
||||
|
||||
val <- (
|
||||
<datetime> { p.SetTime(begin, end) }
|
||||
@ -55,7 +55,9 @@ inlineTable <- (
|
||||
|
||||
inlineTableKeyValues <- (keyval inlineTableValSep?)*
|
||||
|
||||
tableKey <- key (tableKeySep key)*
|
||||
tableKey <- tableKeyComp (tableKeySep tableKeyComp)*
|
||||
|
||||
tableKeyComp <- key { p.AddTableKey() }
|
||||
|
||||
tableKeySep <- ws '.' ws
|
||||
|
||||
@ -117,7 +119,7 @@ timeNumoffset <- [\-+] timeHour ':' timeMinute
|
||||
timeOffset <- 'Z' / timeNumoffset
|
||||
partialTime <- timeHour ':' timeMinute ':' timeSecond timeSecfrac?
|
||||
fullDate <- dateFullYear '-' dateMonth '-' dateMDay
|
||||
fullTime <- partialTime timeOffset
|
||||
fullTime <- partialTime timeOffset?
|
||||
datetime <- (fullDate ('T' fullTime)?) / partialTime
|
||||
|
||||
digit <- [0-9]
|
||||
|
1378
vendor/github.com/naoina/toml/parse.peg.go
generated
vendored
1378
vendor/github.com/naoina/toml/parse.peg.go
generated
vendored
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user