Skip to content

Commit ae82452

Browse files
committed
test
1 parent 54fc746 commit ae82452

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

example/yml.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func runYml() {
1818

1919
knot.Print()
2020

21-
log.Println()
21+
log.Println(knot.Parent)
2222

2323
/* for knot.Next != nil {
2424
log.Println(knot.Key)

yml/yml.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package yml
22

33
import (
4+
"log"
45
"os"
56

67
"github.com/mstgnz/transformer/node"
@@ -44,13 +45,16 @@ func DecodeYml(data []byte) (*node.Node, error) {
4445

4546
Knot = &node.Node{Value: &node.Value{}}
4647

48+
log.Println(yaml.DocumentNode, yaml.SequenceNode, yaml.MappingNode, yaml.ScalarNode, yaml.AliasNode)
49+
4750
// recursive
4851
parser = func(yam *yaml.Node) {
49-
indent := 0
50-
current := 0
51-
for k, child := range yam.Content {
52+
//indent := 0
53+
//current := 0
54+
for _, child := range yam.Content {
55+
log.Println(child.Kind, child.Line, child.Column, child.Tag, child.Value)
5256
// mod 2 = Key
53-
if k%2 == 0 {
57+
/* if k%2 == 0 {
5458
indent = child.Column - 1
5559
Knot.Key = child.Value
5660
} else {
@@ -65,7 +69,7 @@ func DecodeYml(data []byte) (*node.Node, error) {
6569
if Knot.Parent != nil {
6670
Knot = Knot.Parent
6771
}
68-
}
72+
} */
6973
parser(child)
7074
}
7175
}

0 commit comments

Comments
 (0)