Fix inline tables parsing

Inline tables were wrapped inside a TomlValue, although they should
just be part of the tree.
This commit is contained in:
Thomas Pelletier
2016-04-22 17:38:16 +02:00
parent 8d9c606c69
commit 8e6ab94eec
2 changed files with 31 additions and 1 deletions
+9 -1
View File
@@ -208,7 +208,15 @@ func (p *tomlParser) parseAssign() tomlParserStateFn {
p.raiseError(key, "The following key was defined twice: %s",
strings.Join(finalKey, "."))
}
targetNode.values[keyVal] = &tomlValue{value, key.Position}
var toInsert interface{}
switch value.(type) {
case *TomlTree:
toInsert = value
default:
toInsert = &tomlValue{value, key.Position}
}
targetNode.values[keyVal] = toInsert
return p.parseStart
}