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
This commit is contained in:
eanderton
2014-09-09 22:31:41 -04:00
parent 7f30fba1e6
commit 2811a1a3c9
6 changed files with 101 additions and 87 deletions
+1 -3
View File
@@ -70,9 +70,6 @@ func (p *parser) getToken() *token {
func parseStart(p *parser) parserStateFn {
tok := p.peek()
// prime position data with root tree instance
p.tree.position = tok.Position
// end of stream, parsing is finished
if tok == nil {
return nil
@@ -279,6 +276,7 @@ func parseArray(p *parser) []interface{} {
func parse(flow chan token) *TomlTree {
result := newTomlTree()
result.position = Position{1,1}
parser := &parser{
flow: flow,
tree: result,