diff --git a/main_test.go b/main_test.go index bbcf85d..3bad7d4 100644 --- a/main_test.go +++ b/main_test.go @@ -54,7 +54,7 @@ type Node struct { Value []rune // Name(Axis)::Value Next *Node Sel Selection - Pred Predicates + Pred []*Predicates } // compile 编译 @@ -100,6 +100,10 @@ func compile(spath string) (head *Node, tail *Node) { return head, cur } +func getPredicates(path []rune, limit int, ii *int, cur *Node) []*Predicates { + return nil +} + func getAxes(path []rune, limit int, ii *int, cur *Node) { i := *ii @@ -107,7 +111,10 @@ func getAxes(path []rune, limit int, ii *int, cur *Node) { c := path[i] switch c { case '[': + cur.Pred = getPredicates(path, limit, ii, cur) + return case '/': + return case ':': if path[i+1] == ':' { i++ @@ -142,7 +149,6 @@ func getAxes(path []rune, limit int, ii *int, cur *Node) { func getAttributeName(path []rune, limit int, ii *int) []rune { i := *ii - for start := i; i < limit; i++ { if c, ok := Escape(path, &i); !ok { switch {