todo
This commit is contained in:
parent
6b4240ac0a
commit
a32f5b55f9
17
main_test.go
17
main_test.go
|
@ -36,15 +36,26 @@ type Node struct {
|
|||
// return string(path)
|
||||
// }
|
||||
|
||||
func xPath(spath string) string {
|
||||
var path []byte = make([]byte, len(spath))
|
||||
func xPath(spath string) {
|
||||
var path []byte = make([]byte, len(spath)+1)
|
||||
copy(path, spath)
|
||||
|
||||
for i := 0; i < len(path); i++ {
|
||||
root := &Node{}
|
||||
cur := root
|
||||
|
||||
for i := 0; i < len(spath); i++ {
|
||||
c := path[i]
|
||||
if c == '/' {
|
||||
if path[i+1] == '/' {
|
||||
cur.Type = TypeAllChildren
|
||||
} else {
|
||||
cur.Type = TypeChild
|
||||
}
|
||||
|
||||
cur.Next = &Node{Next: cur}
|
||||
cur = cur.Next
|
||||
}
|
||||
cur.Name = append(cur.Name, c)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user