2018-02-20 18:22:15 +00:00
|
|
|
// Package walker declares walking behavior
|
|
|
|
package walker
|
2018-01-17 16:58:45 +00:00
|
|
|
|
2018-02-20 17:52:07 +00:00
|
|
|
// Walkable interface
|
2018-02-20 18:05:04 +00:00
|
|
|
//
|
|
|
|
// Every node must implement this interface
|
2018-02-20 17:52:07 +00:00
|
|
|
type Walkable interface {
|
2018-01-17 16:58:45 +00:00
|
|
|
Walk(v Visitor)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Visitor interface
|
|
|
|
type Visitor interface {
|
2018-06-18 20:29:52 +00:00
|
|
|
EnterNode(w Walkable) bool
|
|
|
|
LeaveNode(w Walkable)
|
|
|
|
|
|
|
|
EnterChildNode(key string, w Walkable)
|
|
|
|
LeaveChildNode(key string, w Walkable)
|
|
|
|
|
|
|
|
EnterChildList(key string, w Walkable)
|
|
|
|
LeaveChildList(key string, w Walkable)
|
2018-01-17 16:58:45 +00:00
|
|
|
}
|