php-parser/walker/walker.go

17 lines
533 B
Go
Raw Normal View History

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-02-20 18:05:04 +00:00
EnterNode(w Walkable) bool // EnterNode is invoked for each node encountered by Walk.
GetChildrenVisitor(Key string) Visitor // GetChildrenVisitor is invoked at every node parameter that contains children nodes
2018-02-20 18:06:44 +00:00
LeaveNode(w Walkable) // LeaveNode is invoked after node processed
2018-01-17 16:58:45 +00:00
}