2010-03-02 21:22:31 +03:00
|
|
|
#ifndef TRAVERSER_H_
|
|
|
|
#define TRAVERSER_H_
|
|
|
|
|
|
|
|
enum Response {ContinueTraversal, AbortTraversal, PruneTraversal};
|
|
|
|
|
|
|
|
class Traverser
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum TraversalType {PREFIX, POSTFIX, PRE_AND_POSTFIX};
|
|
|
|
|
|
|
|
Traverser(class Visitor &visitor, const class AbstractNode &root, TraversalType travtype)
|
|
|
|
: visitor(visitor), root(root), traversaltype(travtype) {
|
|
|
|
}
|
|
|
|
virtual ~Traverser() { }
|
|
|
|
|
|
|
|
void execute();
|
|
|
|
// FIXME: reverse parameters
|
2011-11-26 01:41:36 +04:00
|
|
|
Response traverse(const AbstractNode &node, const class State &state);
|
2011-08-04 06:58:17 +04:00
|
|
|
private:
|
2010-03-02 21:22:31 +03:00
|
|
|
|
|
|
|
Visitor &visitor;
|
|
|
|
const AbstractNode &root;
|
|
|
|
TraversalType traversaltype;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|