Commit Graph

39 Commits

Author SHA1 Message Date
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
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
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
Thomas Pelletier 7e6e4b1314 Rewrite TomlTree encoding (#133)
* Rewrite `TomlTree` encoding
* Introduce `TomlTree.WriteTo`
2017-03-02 09:17:06 -08:00
Thomas Pelletier 31055c2ff0 Allow empty quoted keys (#97) 2016-09-06 22:25:57 +02:00
Thomas Pelletier 8d9c606c69 Improve test coverage (#66) 2016-04-22 14:26:15 +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
Cameron Moore 6e26017b00 Clean up lint (#56)
The only real change in this commit is that MaxInt is made private.
Everything else should be gofmt'ing, docs and cleanup of lint.
2016-04-18 16:58:23 +02:00
Thomas Pelletier f963bc320f Generic input
Fixes #47
2016-01-31 16:54:40 +01:00
Thomas Pelletier 209315c2af Fixes #35: Retrieve dotted keys 2015-07-14 20:15:02 -07:00
Evan Phoenix 71e7762db5 Don't wrap native types in a tomlValue{} 2014-11-05 09:23:41 -08:00
Evan Phoenix 34da10d880 Report the type and value that generated the error 2014-11-05 09:23:28 -08:00
Evan Phoenix 8ef71920bd Expose ability to make an empty tree and handle raw values 2014-10-28 11:49:50 -07:00
Evan Phoenix fa055bcbba Fix inserting values into a tree 2014-10-28 11:49:14 -07:00
eanderton d9de45b5b5 Revised after review
* Dropped 'script' support
* Improved documentation
* Made pathFn members private
2014-09-30 14:57:03 -04:00
eanderton d9e8f54d1c gofmt pass 2014-09-12 22:50:39 -04:00
eanderton 081f3db916 Final Toml-Path Solution
* Refactored type names and file names to mesh with existing TOML library more closely
* Added QueryResult structure that provides values and position data
* Added Query() method to TomlTree type
* Tests, tests, and more tests
* Fixed bug where positions returned from some tables were invalid
* Added test case for bug patch

The bugfix was an interesting case. Position information wasn't being
set in cases where createPath was called.  So table names like [foo.bar]
would result in table 'foo' having no position.
2014-09-12 22:32:15 -04:00
eanderton 2811a1a3c9 Added QueryResult and patched bugs
QueryResult now stores result items and position data, which aligns more
strongly with the rest of the library features than a plain
[]interface[}.  The design of the parser_test unittest was revised to
use array/map/scalar serialization (like match_test), since Go 1.3
redesigned maps to randomly order their keys. Since naive comparisons of
map data is now no longer possible, the unittest now sorts map
keys:value combinations.

* Patched a bug where getPosition("") was returning an invalid Position
* Revised parser_test to use serialization for comparisons for Go 1.3
2014-09-09 22:31:41 -04:00
Thomas Pelletier fb5423fba2 Fixes #22: Fixes style issues 2014-08-29 18:24:51 +02:00
eanderton 7c63fff960 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
2014-08-26 21:00:41 -04:00
Thomas Pelletier 65684e6bb0 Fixes #20 : Creation of subgroup in table arrays 2014-08-14 10:12:39 +02:00
Thomas Pelletier bf549a2194 Run gofmt 2014-08-07 12:52:42 +02:00
eanderton 1f8a8cbc06 Added error context for parsing of subtrees 2014-08-06 08:20:53 -04:00
Philipp Brüll e9ae961088 extended Has function to work with paths 2014-07-09 16:34:41 +02:00
eanderton 5dd3b53635 Fixed formatting 2014-07-08 22:02:42 -04:00
eanderton 262211488d Fixed path handling and key group array name lexing for test compliance 2014-07-08 22:00:46 -04:00
eanderton 7b208738bc Fixed formatting; added name to license file 2014-07-07 21:06:42 -04:00
eanderton c8b5633273 Group array support; ToString() support 2014-07-07 20:48:29 -04:00
Thomas Pelletier dc20c454d7 Handle dots in keys 2013-12-10 21:51:40 +01:00
Thomas Pelletier c743c90315 Don't allow empty intermediate tables 2013-12-10 16:23:53 +01:00
Thomas Pelletier 8081f3cc09 Don't allow tables to be redefined 2013-12-10 16:10:26 +01:00
Thomas Pelletier 23d36c08ab Add GetDefault to TomlTree 2013-05-01 18:47:27 +02:00
Thomas Pelletier 558a227433 Run gofmt 2013-03-26 12:10:14 +01:00
Thomas Pelletier 21a8fb6ee0 Add LoadFile 2013-03-22 17:14:16 +01:00
Thomas Pelletier 2bd1eb4f21 Add tests for errors (fixes #5) 2013-03-22 15:23:53 +01:00
Thomas Pelletier 183bbe2aa9 Return an error instead of panicking 2013-03-22 15:03:51 +01:00
Thomas Pelletier 8783fed844 Readd source files. I need coffee now 2013-02-25 10:57:12 +01:00