Example #1
0
File: raku.go Project: beoran/woe
func (me *Rule) Walk(walker func(rule *Rule) *Rule) *Rule {
	node_res := tree.Walk(me,
		func(node tree.Noder) tree.Noder {
			rule_res := walker(node.(*Rule))
			if rule_res == nil {
				return nil
			} else {
				return rule_res
			}
		})
	return node_res.(*Rule)
}
Example #2
0
File: raku.go Project: beoran/woe
func (me *Ast) Walk(walker func(ast *Ast) *Ast) *Ast {
	node_res := tree.Walk(me,
		func(node tree.Noder) tree.Noder {
			ast_res := walker(node.(*Ast))
			if ast_res == nil {
				return nil
			} else {
				return ast_res
			}
		})
	if node_res != nil {
		return node_res.(*Ast)
	} else {
		return nil
	}
}