Tree visitor implementation for CTree based syntax trees.
More...
#include <Puma/CVisitor.h>
Tree visitor implementation for CTree based syntax trees.
To be derived for visiting concrete syntax trees.
This class performs depth-first tree-traversal based on CTree tree structures. The traversal is started by calling CVisitor::visit() with the root node of the tree to traverse as its argument. For every node of the tree CVisitor::pre_visit() is called before its child nodes are visited, and CVisitor::post_visit() is called after its child nodes are visited. To perform actions on the visited nodes, CVisitor::pre_visit() and CVisitor::post_visit() have to be overloaded.
Puma::CVisitor::CVisitor |
( |
) | |
|
|
inline |
virtual Puma::CVisitor::~CVisitor |
( |
) | |
|
|
inlinevirtual |
void Puma::CVisitor::abort |
( |
bool |
v = true ) | |
|
|
inline |
Set the aborted state.
- Parameters
-
v | True for aborted, false for not aborted. |
bool Puma::CVisitor::aborted |
( |
) | |
const |
|
inline |
Check if the node visiting is aborted.
virtual void Puma::CVisitor::post_visit |
( |
CTree * |
node) | |
|
|
virtual |
virtual void Puma::CVisitor::pre_visit |
( |
CTree * |
node) | |
|
|
virtual |
void Puma::CVisitor::prune |
( |
bool |
v = true ) | |
|
|
inline |
Set the pruned state (don't visit the sub-tree).
- Parameters
-
v | True for pruned, false for not pruned. |
bool Puma::CVisitor::pruned |
( |
) | |
const |
|
inline |
Check if the visiting the sub-tree is aborted.
void Puma::CVisitor::visit |
( |
CTree * |
node) | |
|
Visit the given syntax tree node.
- Parameters
-