Fixes #20 : Creation of subgroup in table arrays
diff --git a/lexer.go b/lexer.go
index fa10649..b13c87b 100644
--- a/lexer.go
+++ b/lexer.go
@@ -1,4 +1,6 @@
-// TOML lexer.// Written using the principles developped by Rob Pike in
+// TOML lexer.
+//
+// Written using the principles developped by Rob Pike in
 // http://www.youtube.com/watch?v=HxaD_trXwRE
 
 package toml
diff --git a/parser_test.go b/parser_test.go
index 752c4a7..20b9dd8 100644
--- a/parser_test.go
+++ b/parser_test.go
@@ -299,6 +299,16 @@
 	})
 }
 
+func TestParseKeyGroupArraySpec(t *testing.T) {
+	tree, err := Load("[[fruit]]\n name=\"apple\"\n [fruit.physical]\n color=\"red\"\n shape=\"round\"\n [[fruit]]\n name=\"banana\"")
+	assertTree(t, tree, err, map[string]interface{}{
+		"fruit": []map[string]interface{}{
+			{"name": "apple", "physical": map[string]interface{}{"color": "red", "shape": "round"}},
+			{"name": "banana"},
+		},
+	})
+}
+
 func TestToTomlValue(t *testing.T) {
 	for idx, item := range []struct {
 		Value  interface{}
diff --git a/toml.go b/toml.go
index 7be23dd..8beb392 100644
--- a/toml.go
+++ b/toml.go
@@ -155,7 +155,15 @@
 			var new_tree TomlTree = make(TomlTree)
 			(*subtree)[intermediate_key] = &new_tree
 		}
-		subtree = ((*subtree)[intermediate_key]).(*TomlTree)
+
+		switch node := (*subtree)[intermediate_key].(type) {
+		case []*TomlTree:
+			subtree = node[len(node)-1]
+		case *TomlTree:
+			subtree = node
+		default:
+			return fmt.Errorf("unknown type for path %s", key)
+		}
 	}
 	return nil
 }