This commit is contained in:
eson 2020-09-22 18:57:30 +08:00
parent a9054b9704
commit 24c816c640

View File

@ -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 {