ModErn Text Analysis
META Enumerates Textual Applications
|
This is a visitor that finds all of the leaf nodes in a parse tree. More...
#include <leaf_node_finder.h>
Public Member Functions | |
void | operator() (const leaf_node &) override |
void | operator() (const internal_node &) override |
std::vector< std::unique_ptr< leaf_node > > | leaves () |
Returns the leaf nodes found by the visitor. More... | |
Private Attributes | |
std::vector< std::unique_ptr< leaf_node > > | leaves_ |
The storage for the leaf nodes found so far. | |
Additional Inherited Members | |
Public Types inherited from meta::parser::const_visitor< void > | |
using | result_type = void |
The result of running the visitor over the tree. | |
This is a visitor that finds all of the leaf nodes in a parse tree.
The list is built via side-effect, so the visiting methods return void and a separate method is used to extract the leaf node list.
The leaf nodes are copied into the list.
|
overridevirtual |
Implements meta::parser::const_visitor< void >.
|
overridevirtual |
Implements meta::parser::const_visitor< void >.
std::vector< std::unique_ptr< leaf_node > > meta::parser::leaf_node_finder::leaves | ( | ) |
Returns the leaf nodes found by the visitor.
This should be called to extract the leaves after the visitor has been run. The leaves are moved into the return value, so the visitor will be left empty by this operation.