436 Commits

Author SHA1 Message Date
John K. Luebs 53be957dac Allow unmarshal from any TomlTree (#157)
Fixes #153
2017-05-07 15:55:38 -07:00
Kevin Burke 97253b98df Fix plural mistake in Set* docs (#154) 2017-05-03 21:03:14 -07:00
Kevin Burke 76c552dcd7 Initialize keys array to final length (#155)
Previously we'd create an empty array and need to continuously resize
it as we appended more entries. This way we immediately create the
correct size array, and then add entries to it.
2017-05-03 21:02:36 -07:00
Carolyn Van Slyck fe206efb84 Provide Marshaler interface (#151)
The toml.Marhshaler interface allows marshalling custom objects implementing
the interface. Design based off json.Marshaler.
2017-04-04 18:41:05 -07:00
tro3 e32a2e0474 Reflection-based marshaling / unmarshaling (#149)
Fixes #146
2017-03-29 14:49:41 -07:00
Thomas Pelletier f6e7596e8d Reflect actual slice type in TreeFromMap (#145)
* Reflect actual slice type in TreeFromMap
* Fix writeTo for slices tomlValues

Fixes #143
2017-03-23 11:20:46 +01:00
tro3 25e50242f6 Fix TestMissingFile on Windows (#148)
Closing #147
2017-03-21 15:10:48 +01:00
Albert Nigmatzianov 62e2d802ed Fix #141 (#142)
* Use String() of key if it exists during TreeFromMap
2017-03-21 10:01:44 +01:00
Thomas Pelletier fee7787d3f Rework tree from map (#139)
* Make TreeFromMap reflect to construct tree
* Fix wording of invalid value type in writeTo

Fixes #138, #139, #134 

⚠️ TreeFromMap signature changed to `TreeFromMap(map[string]interface{}) (*TomlTree, error)`
2017-03-14 13:16:40 -07:00
Cameron Moore 3b00596b2e Support lowercase unicode escape sequences (#140) 2017-03-13 20:04:08 -07:00
Thomas Pelletier 13d49d4606 Fix coveralls (#136) v0.5.0 2017-03-02 09:43:01 -08:00
Thomas Pelletier 7e6e4b1314 Rewrite TomlTree encoding (#133)
* Rewrite `TomlTree` encoding
* Introduce `TomlTree.WriteTo`
2017-03-02 09:17:06 -08:00
Thomas Pelletier 3616783228 Run go vet as part of the test suite (#132)
* Run go vet as part of the test suite
2017-02-27 14:29:04 -08:00
Thomas Pelletier d0ec4317d3 Fix compatibility with latest go-buffruneio (#131) 2017-02-27 14:18:12 -08:00
Thomas Pelletier 22139eb546 Test with go 1.8 (#129) 2017-02-16 17:27:36 -08:00
Thomas Pelletier c9506ee963 Update license (#128)
* Update LICENSE badge
* Update license year to 2017
2017-02-09 13:38:35 -08:00
David Brown 3a6d01f7a0 Fix syntax errors in package-level documentation (#126) 2017-02-09 13:23:28 -08:00
Thomas Pelletier d1fa2118c1 Bump test go to 1.7.5 (#127)
* Bump test go to 1.7.5
* Use travis container infrastructure
* Don't run the tests twice on PRs
2017-02-03 13:36:21 -08:00
Thomas Pelletier a1f048ba24 Make ToString() return an error instead of panic (#117)
Fixes #100
2017-01-15 18:49:11 -08:00
Jordan Bach ee2c0b51cf Fix typo in README tomljson installation instructions (#125) 2017-01-15 18:48:04 -08:00
Thomas Pelletier 439fbba1f8 Make lexComment jump back to the previous state (#122)
When a comment appears in an rvalue, the lexer needs to jump back to
lexRValue, not to lexVoid.

Fixes #120.
2016-12-29 19:51:04 +01:00
Christopher Mancini 017119f7a7 Use a single line for slice encoding (#119) 2016-12-13 15:20:06 +01:00
Thomas Pelletier ce7be745f0 Rename group to table (#115)
* Rename Group to Table Fixes #45 
* Change fmt.Errorf to errors.new for simple strings
2016-12-03 12:32:16 +01:00
Thomas Pelletier d464759235 Bump test go patchlevels (#113)
* 1.6.4
* 1.7.4
v0.4.0
2016-12-02 11:42:58 +01:00
Thomas Pelletier 7cb988051d Make values come before tables in ToString output (#111)
If no order on the key is enforced in ToString, the following tree:

foo = 1
bar = "baz"
foobar = true
[qux]
  foo = 1
  bar = "baz"

may come out as:

bar = "baz"
foobar = true
[qux]
  foo = 1
  bar = "baz"
foo = 1

which is incorrect, since putting that back to the parser would panic
because of a duplicated key (qux.foo). Those changes make sure that
leaf values come before tables in the ToString output.
2016-11-23 16:24:52 +01:00
Thomas Pelletier 3ddb37c944 Fix []*Toml.Tree being wrapped in *Toml.Value (#110)
Nodes can be either *Toml.Tree, []*Toml.Tree, or *Toml.Value.
Arrays of trees were incorrectly wrapped in a *Toml.Value,
making the conversion functions think they were leaf nodes.
2016-11-23 15:48:39 +01:00
Thomas Pelletier f7f14983c3 Update travis to go1.7.3 (#109) 2016-11-23 15:21:57 +01:00
Cameron Moore 45932ad32d Handle nil, map[string]string, and map[interface{}]interface{} input (#103)
* Handle map[string]string and map[interface{}]interface{} input
* Handle nil values

Fixes #99
2016-09-20 09:07:15 +02:00
Cameron Moore 67b7b944a8 Support all numeric type conversions (#102)
Fixes #101
2016-09-20 09:04:39 +02:00
Thomas Pelletier 31055c2ff0 Allow empty quoted keys (#97) 2016-09-06 22:25:57 +02:00
Cameron Moore 5a62685873 Add license and Go Report Card badges to README (#93) 2016-08-23 09:47:07 +02:00
Cameron Moore d05a14897c Fix typo in comment (#94) 2016-08-23 09:46:25 +02:00
Cameron Moore 0599275eb9 Simplify redundant types in literals (#95)
Using `gofmt -s`
2016-08-23 09:45:54 +02:00
Cameron Moore 0049ab3dc4 Update Travis build (#89)
* Test with the latest releases.
* Allow tip to fail.
2016-08-22 14:27:12 +02:00
Cameron Moore bfe4a7e160 Fix gofmt and golint issues (#90) 2016-08-22 11:20:25 +02:00
Thomas Pelletier e6271032cc Move license to LICENSE file (#91) 2016-08-22 11:17:53 +02:00
Cameron Moore 887411a2a8 Add \U support to query lexer (#88) 2016-08-22 10:55:12 +02:00
Thomas Pelletier 31c735e72c Test with go 1.7. Stop testing with 1.4 (#87) 2016-08-16 14:03:31 +02:00
Thomas Pelletier 06484b677b Fix ToMap conversion of array of tables (#83) 2016-08-15 21:00:14 +02:00
Thomas Pelletier de2e921d55 TOML to JSON cli tool (#85)
* Implement tomljson
* Add note about tools in README
2016-08-14 13:50:18 +02:00
Thomas Pelletier 7f292800de Target latest Go patch level in Travis (#80) 2016-07-25 09:41:11 +02:00
Sam Broughton 923742e542 Fix String() comment (#79) 2016-07-22 09:53:40 +02:00
Sam Broughton 65ad89c1a7 Pointer cleanup (#78)
Remove unnecessary pointer receivers for Position and QueryResult
2016-07-21 16:42:51 +02:00
Thomas Pelletier 64ff1ea4d5 Don't hang when reading an invalid rvalue (#77)
Fixes #76
v0.3.5
2016-06-30 16:21:25 +02:00
Sam Broughton b39f6ef1f9 Add a toml linter (#74)
* Add a toml linter

* Use if/else instead of os.Exit(0)

* Add usage warning about destructive changes
2016-06-06 12:29:13 +02:00
Sam Broughton c187221f01 Implement fmt.Stringer and alias ToString (#73) 2016-06-06 10:23:55 +02:00
Thomas Pelletier 8e6ab94eec Fix inline tables parsing
Inline tables were wrapped inside a TomlValue, although they should
just be part of the tree.
v0.3.4
2016-04-22 17:38:16 +02:00
Thomas Pelletier 8d9c606c69 Improve test coverage (#66) 2016-04-22 14:26:15 +02:00
Thomas Pelletier 288bc57940 Better logging for parser tests (#65)
* Better logging for parser tests

* Add spew to tests deps list
2016-04-22 11:01:31 +02:00
Thomas Pelletier e3b2497729 TomlTree.ToMap (#59)
* Extract TomlTree conversion to its own file

* Implement ToMap

* Reorder imports in tomltree_conversions
2016-04-22 09:46:28 +02:00