ModErn Text Analysis
META Enumerates Textual Applications
visitor.h
1 
9 #ifndef META_PARSE_TREE_VISITOR_H_
10 #define META_PARSE_TREE_VISITOR_H_
11 
12 namespace meta
13 {
14 namespace parser
15 {
16 
17 class leaf_node;
18 class internal_node;
19 
24 template <class T>
26 {
27  public:
31  using result_type = T;
32 
36  virtual result_type operator()(const leaf_node&) = 0;
37 
42  virtual result_type operator()(const internal_node&) = 0;
43 };
44 
49 template <class T>
50 class visitor
51 {
52  public:
56  using result_type = T;
57 
61  virtual result_type operator()(leaf_node&) = 0;
62 
67  virtual result_type operator()(internal_node&) = 0;
68 };
69 }
70 }
71 
72 #endif
bool result_type
The result of running the visitor over the tree.
Definition: visitor.h:31
Abstract base class for visitors over parse trees that are allowed to modify the underlying tree...
Definition: visitor.h:50
An internal node in a parse tree.
Definition: internal_node.h:28
The ModErn Text Analysis toolkit is a suite of natural language processing, classification, information retreival, data mining, and other applications of text processing.
Definition: analyzer.h:24
virtual result_type operator()(leaf_node &)=0
virtual result_type operator()(const leaf_node &)=0
Abstract base class for visitors over parse trees that do not modify the underlying tree...
Definition: visitor.h:25
void result_type
The result of running the visitor over the tree.
Definition: visitor.h:56
A leaf node (pre-terminal) in a parse tree.
Definition: leaf_node.h:24