1 /*=============================================================================
2 Copyright (c) 2001-2003 Daniel Nuffer
3 Copyright (c) 2001-2007 Hartmut Kaiser
4 http://spirit.sourceforge.net/
6 Distributed under the Boost Software License, Version 1.0. (See accompanying
7 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 =============================================================================*/
10 #if !defined(PARSE_TREE_UTILS_HPP)
11 #define PARSE_TREE_UTILS_HPP
13 #include <utility> // for std::pair
15 #include <boost/spirit/home/classic/tree/parse_tree.hpp> // needed for parse tree generation
17 ///////////////////////////////////////////////////////////////////////////////
20 BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
22 ///////////////////////////////////////////////////////////////////////////////
24 // The function 'get_first_leaf' returnes a reference to the first leaf node
25 // of the given parsetree.
27 ///////////////////////////////////////////////////////////////////////////////
30 get_first_leaf (tree_node<T> const &node);
32 ///////////////////////////////////////////////////////////////////////////////
34 // The function 'find_node' finds a specified node through recursive search.
35 // If the return value is true, the variable to which points the parameter
36 // 'found_node' will contain the address of the node with the given rule_id.
38 ///////////////////////////////////////////////////////////////////////////////
41 find_node (tree_node<T> const &node, parser_id node_to_search,
42 tree_node<T> const **found_node);
44 ///////////////////////////////////////////////////////////////////////////////
46 // The function 'get_node_range' return a pair of iterators pointing at the
47 // range, which containes the elements of a specified node. It's very useful
48 // for locating all information related with a specified node.
50 ///////////////////////////////////////////////////////////////////////////////
53 get_node_range (tree_node<T> const &node, parser_id node_to_search,
54 std::pair<typename tree_node<T>::const_tree_iterator,
55 typename tree_node<T>::const_tree_iterator> &nodes);
57 ///////////////////////////////////////////////////////////////////////////////
58 BOOST_SPIRIT_CLASSIC_NAMESPACE_END
62 #include "boost/spirit/home/classic/tree/impl/parse_tree_utils.ipp"
64 #endif // !defined(PARSE_TREE_UTILS_HPP)