2018-02-20 20:22:15 +02:00
|
|
|
// Package walker declares walking behavior
|
|
|
|
package walker
|
2018-01-17 18:58:45 +02:00
|
|
|
|
2018-02-20 19:52:07 +02:00
|
|
|
// Walkable interface
|
2018-02-20 20:05:04 +02:00
|
|
|
//
|
|
|
|
// Every node must implement this interface
|
2018-02-20 19:52:07 +02:00
|
|
|
type Walkable interface {
|
2018-01-17 18:58:45 +02:00
|
|
|
Walk(v Visitor)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Visitor interface
|
|
|
|
type Visitor interface {
|
2018-06-18 23:29:52 +03: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 18:58:45 +02:00
|
|
|
}
|