Added Position Support to TomlTree

TomlDocument provides an optional TOML processing path where position
informaiton is stored alongside a TomlTree.
* Added Position struct
* Revised TomlTree to contain position data
* Added tomlValue to bind positions to values
* Revised parser to emit position data
* Revised token to use new Position struct
* Added tests for new functionality
* Bugfixed table array duplicate key handling
* Applied gofmt to all code
This commit is contained in:
eanderton
2014-08-14 22:04:25 -04:00
parent bcbaee1079
commit 7c63fff960
9 changed files with 582 additions and 314 deletions
+5 -3
View File
@@ -1,3 +1,5 @@
// Testing support for go-toml
package toml
import (
@@ -27,16 +29,16 @@ func TestTomlHasPath(t *testing.T) {
}
func TestTomlGetPath(t *testing.T) {
node := make(TomlTree)
node := newTomlTree()
//TODO: set other node data
for idx, item := range []struct {
Path []string
Expected interface{}
Expected *TomlTree
}{
{ // empty path test
[]string{},
&node,
node,
},
} {
result := node.GetPath(item.Path)