|
|
@ -100,6 +100,7 @@ func (t *Tree) next(n *node, route string, result *Result) bool {
|
|
|
|
if route[i] != slash {
|
|
|
|
if route[i] != slash {
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
token := route[:i]
|
|
|
|
token := route[:i]
|
|
|
|
return n.forEach(func(k string, v *node) bool {
|
|
|
|
return n.forEach(func(k string, v *node) bool {
|
|
|
|
r := match(k, token)
|
|
|
|
r := match(k, token)
|
|
|
@ -163,21 +164,23 @@ func add(nd *node, route string, item interface{}) error {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for i := range route {
|
|
|
|
for i := range route {
|
|
|
|
if route[i] == slash {
|
|
|
|
if route[i] != slash {
|
|
|
|
token := route[:i]
|
|
|
|
continue
|
|
|
|
children := nd.getChildren(token)
|
|
|
|
}
|
|
|
|
if child, ok := children[token]; ok {
|
|
|
|
|
|
|
|
if child != nil {
|
|
|
|
token := route[:i]
|
|
|
|
return add(child, route[i+1:], item)
|
|
|
|
children := nd.getChildren(token)
|
|
|
|
}
|
|
|
|
if child, ok := children[token]; ok {
|
|
|
|
|
|
|
|
if child != nil {
|
|
|
|
return errInvalidState
|
|
|
|
return add(child, route[i+1:], item)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
child := newNode(nil)
|
|
|
|
return errInvalidState
|
|
|
|
children[token] = child
|
|
|
|
|
|
|
|
return add(child, route[i+1:], item)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
child := newNode(nil)
|
|
|
|
|
|
|
|
children[token] = child
|
|
|
|
|
|
|
|
return add(child, route[i+1:], item)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
children := nd.getChildren(route)
|
|
|
|
children := nd.getChildren(route)
|
|
|
|