ModErn Text Analysis
META Enumerates Textual Applications
Public Member Functions | Private Attributes | List of all members
meta::parser::leaf_node_finder Class Reference

This is a visitor that finds all of the leaf nodes in a parse tree. More...

#include <leaf_node_finder.h>

Inheritance diagram for meta::parser::leaf_node_finder:
meta::parser::const_visitor< void >

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.
 

Detailed Description

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.

Member Function Documentation

void meta::parser::leaf_node_finder::operator() ( const leaf_node )
overridevirtual
Returns
the result of running the visitor on the supplied leaf node

Implements meta::parser::const_visitor< void >.

void meta::parser::leaf_node_finder::operator() ( const internal_node )
overridevirtual
Returns
the result of running the visitor on the supplied internal node

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.


The documentation for this class was generated from the following files: