Thomas Pelletier
fe7536c3de
Run benchmarks and fmt in travis ( #174 )
2017-06-01 23:55:32 -07:00
Thomas Pelletier
e94d595cd4
Update tested Go versions ( #173 )
2017-06-01 21:42:09 -07:00
Thomas Pelletier
0d5a6db8dd
Fix toString float encoding ( #172 )
...
Ensure a round float does contain a decimal point. Otherwise
feeding the output back to the parser would convert to an integer.
Fixes #171
2017-06-01 21:36:58 -07:00
Cameron Moore
a60c71373e
Optimize some string handling ( #170 )
...
* Don't use fmt.Sprintf on simple strings
* Use bytes.Buffer in encodeTomlString
name old time/op new time/op delta
Lexer-8 162µs ± 0% 161µs ± 0% -0.12%
TreeToTomlString-8 19.7µs ± 0% 7.5µs ± 0% -61.80%
name old alloc/op new alloc/op delta
TreeToTomlString-8 9.75kB ± 0% 4.96kB ± 0% -49.12%
name old allocs/op new allocs/op delta
TreeToTomlString-8 485 ± 0% 78 ± 0% -83.92%
2017-06-01 21:03:55 -07:00
Thomas Pelletier
5ccdfb18c7
Write empty tables as well ( #169 )
...
Empty tables are allowed by the spec, so they should not be removed:
[[empty-tables]]
[[empty-tables]]
is perfectly valid.
Fixes #163
v1.0.0
2017-05-30 18:35:27 -07:00
Thomas Pelletier
40ecdac242
Clean up documentation ( #168 )
...
Fixes #135
2017-05-30 18:33:25 -07:00
Albert Nigmatzianov
26ae43fdee
Use bytes.Buffer for tomlLexer.buffer ( #166 )
...
* Use bytes.Buffer for tomlLexer.buffer
* Add BenchmarkLexer
Fix #165
name old time/op new time/op delta
Lexer-4 343µs ± 1% 331µs ± 1% -3.56% (p=0.000 n=20+19)
name old alloc/op new alloc/op delta
Lexer-4 55.8kB ± 0% 50.8kB ± 0% -8.86% (p=0.000 n=20+20)
name old allocs/op new allocs/op delta
Lexer-4 2.01k ± 0% 1.84k ± 0% -8.46% (p=0.000 n=20+20)
2017-05-30 10:27:36 -07:00
Jordan Krage
048765b449
Switch kindToTypeMapping from map to array ( #164 )
...
Improve lookup performance by 8x.
2017-05-25 09:02:42 -07:00
Cameron Moore
5c26a6ff6f
Fix Tree.ToMap godoc comment ( #162 )
...
Fixes #160
2017-05-16 10:14:30 -07:00
Thomas Pelletier
685a1f1cb7
Rename TomlTree to Tree ( #159 )
...
Avoid stutter.
Fixes #55
2017-05-10 17:53:23 -07:00
Thomas Pelletier
23f644976a
Move query to its own subpackage ( #152 )
...
Move all the query system to its own package. The reason is to
avoid it to rely on unexported methods and structures, and move
it out of the main package since this is really not a core
feature. It is still tied to the toml.TomlTree and toml.Position
structures for now.
* Move query mechanism to its own subpackage
* Rename QueryResult to Result to avoid stutter
* Add query.CompileAndExecute
Fixes #116
2017-05-07 17:14:13 -07:00
Thomas Pelletier
64bc956d5e
Remove clean.sh ( #158 )
2017-05-07 16:09:32 -07:00
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