Commit Graph

734 Commits

Author SHA1 Message Date
Thomas Pelletier 9f36448571 Basic keys parsing 2015-07-14 16:33:33 -07:00
Thomas Pelletier 222e90a7d3 Parse long unicode 2015-05-21 18:52:26 -07:00
Thomas Pelletier a8327d781a Specifiy timezone name 2015-04-23 15:42:25 -07:00
Thomas Pelletier 61449e9d32 Test for Go 1.4.1 2015-04-23 15:36:06 -07:00
Thomas Pelletier 48c977fb58 Test for golang 1.4 2015-04-23 15:33:31 -07:00
Thomas Pelletier 42e7853ef6 Merge pull request #34 from pelletier/issue-29
Changes to support #29 - Support multi-line literal strings
2015-02-27 14:48:13 +01:00
eanderton 1f3d0e03c3 Changes to support #29 - Support multi-line literal strings
* Added error output to test_program.go
* Added multi-line literal string support to lexer
* Added multi-line string supprt to lexer
* Added unit-test for new string support
* Modified test.sh to take an optional parameter to run an individual BurntSushi test suite.
* Fixed formatting
2015-02-26 18:03:30 -05:00
Thomas Pelletier 36d65b681a Merge branch 'toml-0.3.1' 2014-12-06 15:27:39 +01:00
Thomas Pelletier a56707c85f Fixes #28 : Support of literal strings 2014-12-06 15:23:37 +01:00
Thomas Pelletier 4b47f52cb0 Fixes #31 : Use RFC 3339 for datetimes 2014-12-06 15:00:24 +01:00
Thomas Pelletier 2f2f28631b Fixes #32 : Ensure keys are correctly parsed 2014-12-06 14:16:42 +01:00
Thomas Pelletier 543444f747 Fixes #30: Implement exp notation in floats 2014-12-06 13:56:27 +01:00
Thomas Pelletier b814e1a94f Merge pull request #25 from vektra/master
Make it possible to use lib to make new Toml Trees
2014-11-05 19:08:21 +01:00
Evan Phoenix 1fe62f3000 Merge remote-tracking branch 'prim/master'
Conflicts:
	match_test.go
	queryparser.go
2014-11-05 09:52:03 -08:00
Evan Phoenix 709382e9c1 Fix usage on 32bit machines 2014-11-05 09:24:08 -08: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
Thomas Pelletier db15f8a481 Merge pull request #24 from pelletier/pelletier/integer_overflow
Int overflow in queryparser
2014-11-03 22:09:12 +01: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
Thomas Pelletier 7337a63f5a Use MaxInt instead of MaxInt64 for ints
This is causing an integer overflow on 386 go builds, because ints are
int32 and not int64 on this platform.
2014-10-16 05:58:50 -07:00
Thomas Pelletier 21af3aacfe Merge pull request #23 from pelletier/jsonpath
Powerful querying interface
v0.2.1
2014-10-07 22:30:42 +02:00
eanderton 66e7f06e7d Revised readme per peer-review 2014-10-01 18:38:03 -04: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 7f678451a8 added missing token.go 2014-09-12 22:42:35 -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
eanderton 7f30fba1e6 gofmt pass 2014-09-09 04:09:36 -04:00
eanderton 12e974f892 Query interface with callback functions
* Added public Query interface
* Added filter function callback support
* Added "script" function callback support

Queries are generated via Compile(), which then may be run via Execute()
as many times as needed.  Much like compiling a regex, this is done to
elide the need to re-parse and build the funciton tree for each
execution.

The distinction between 'filter' and 'script' is borrowed from their
syntactic equivalents in jsonpath.  Right now, these accept no arguments
in the query, and instead merely pass the current node to the callback.
Filters return a bool and determine if the node is kept or culled out.
'Scripts' return a string or an in64, which is in turn used in an index
or key filter (respectively) on the current node's data.

A few callbacks are provided by default, with the ability to add
additional callbacks before calling Execute() on a compiled query.
2014-09-08 22:08:28 -04:00
eanderton c81f1892c2 Refactored match to use function chaining 2014-09-07 16:32:29 -04:00
eanderton a98788e0d7 Added additional parser tests 2014-09-07 09:01:58 -04:00
eanderton b74544d345 Changed match func strategy; added tests
As it turns out, closures are very hard to validate without running them.
Since table-driven tests tend to rely on value types that can be
compared directly, using structs that adhere to a generic callback
interface is more work, but is more easily tested.

* Changed jsonpath match functions to structs with Call() methods
* Added tests to verify the generation of jsonpath QueryPath data
* Added tests to verify jsonpath lexer
* Fixed jsonpath whitespace handling bug
* Fixed numerous flaws in jsonpath parser
2014-09-04 23:17:29 -04:00
eanderton 27416cc1b9 gofmt pass 2014-09-04 07:30:19 -04:00
eanderton 04b60e4f8d revised matching strategy 2014-09-04 07:19:35 -04:00
eanderton 9942463786 semi-functional prototype 2014-09-03 21:33:25 -04:00
Thomas Pelletier fb5423fba2 Fixes #22: Fixes style issues 2014-08-29 18:24:51 +02:00
Thomas Pelletier a2495b4806 Add positions in README 2014-08-29 17:31:58 +02:00
Thomas Pelletier e118479061 Merge pull request #21 from eanderton/master
Element Position Support
2014-08-29 17:12:06 +02:00
eanderton c0c5d65185 Removed redudant license info 2014-08-27 21:18:07 -04: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 bcbaee1079 Use SVG for the Travis badge 2014-08-23 15:40:43 +02:00
Thomas Pelletier f15dd550e8 Add godoc badge 2014-08-23 15:31:59 +02:00
Thomas Pelletier 5ad4cb7120 Add 1.3 to Travis' build matrix 2014-08-14 10:14:50 +02:00
Thomas Pelletier 65684e6bb0 Fixes #20 : Creation of subgroup in table arrays 2014-08-14 10:12:39 +02:00
Thomas Pelletier 68d2a60b37 Merge branch 'eanderton-master' 2014-08-07 12:53:56 +02:00
Thomas Pelletier bf549a2194 Run gofmt 2014-08-07 12:52:42 +02:00
eanderton aa194b5c41 Revised error message in parser test 2014-08-06 20:30:30 -04:00
eanderton 14e2d94bdd Added missing test entry 2014-08-06 20:28:44 -04:00
eanderton 1f8a8cbc06 Added error context for parsing of subtrees 2014-08-06 08:20:53 -04:00