diff options
author | Wim <wim@42.be> | 2017-03-25 19:13:47 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2017-03-25 19:13:47 +0100 |
commit | be15cc8a36ed3c207251f9b92815781f2fa8618d (patch) | |
tree | 2acd08d74feb3cbcd747bdc1f8628469a9899528 /vendor/github.com/BurntSushi/toml/parse.go | |
parent | 2f68519b3c6b5a70028882c99afeb76f291b7725 (diff) | |
download | matterbridge-msglm-be15cc8a36ed3c207251f9b92815781f2fa8618d.tar.gz matterbridge-msglm-be15cc8a36ed3c207251f9b92815781f2fa8618d.tar.bz2 matterbridge-msglm-be15cc8a36ed3c207251f9b92815781f2fa8618d.zip |
Update vendored toml. Adds support for inline tables
Diffstat (limited to 'vendor/github.com/BurntSushi/toml/parse.go')
-rw-r--r-- | vendor/github.com/BurntSushi/toml/parse.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/vendor/github.com/BurntSushi/toml/parse.go b/vendor/github.com/BurntSushi/toml/parse.go index a5625555..50869ef9 100644 --- a/vendor/github.com/BurntSushi/toml/parse.go +++ b/vendor/github.com/BurntSushi/toml/parse.go @@ -269,6 +269,41 @@ func (p *parser) value(it item) (interface{}, tomlType) { types = append(types, typ) } return array, p.typeOfArray(types) + case itemInlineTableStart: + var ( + hash = make(map[string]interface{}) + outerContext = p.context + outerKey = p.currentKey + ) + + p.context = append(p.context, p.currentKey) + p.currentKey = "" + for it := p.next(); it.typ != itemInlineTableEnd; it = p.next() { + if it.typ != itemKeyStart { + p.bug("Expected key start but instead found %q, around line %d", + it.val, p.approxLine) + } + if it.typ == itemCommentStart { + p.expect(itemText) + continue + } + + // retrieve key + k := p.next() + p.approxLine = k.line + kname := p.keyString(k) + + // retrieve value + p.currentKey = kname + val, typ := p.value(p.next()) + // make sure we keep metadata up to date + p.setType(kname, typ) + p.ordered = append(p.ordered, p.context.add(p.currentKey)) + hash[kname] = val + } + p.context = outerContext + p.currentKey = outerKey + return hash, tomlHash } p.bug("Unexpected value type: %s", it.typ) panic("unreachable") |