stabilize build system: depends, installer, boost/bdb fixes, cross targets groundwork
This commit is contained in:
@@ -0,0 +1,387 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2003 Daniel Nuffer
|
||||
Copyright (c) 2001-2007 Hartmut Kaiser
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
#ifndef BOOST_SPIRIT_TREE_AST_HPP
|
||||
#define BOOST_SPIRIT_TREE_AST_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/tree/common.hpp>
|
||||
#include <boost/spirit/home/classic/core/scanner/scanner.hpp>
|
||||
|
||||
#include <boost/spirit/home/classic/tree/ast_fwd.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
//////////////////////////////////
|
||||
// ast_match_policy is simply an id so the correct specialization of
|
||||
// tree_policy can be found.
|
||||
template <
|
||||
typename IteratorT,
|
||||
typename NodeFactoryT,
|
||||
typename T
|
||||
>
|
||||
struct ast_match_policy :
|
||||
public common_tree_match_policy<
|
||||
ast_match_policy<IteratorT, NodeFactoryT, T>,
|
||||
IteratorT,
|
||||
NodeFactoryT,
|
||||
ast_tree_policy<
|
||||
ast_match_policy<IteratorT, NodeFactoryT, T>,
|
||||
NodeFactoryT,
|
||||
T
|
||||
>,
|
||||
T
|
||||
>
|
||||
{
|
||||
typedef
|
||||
common_tree_match_policy<
|
||||
ast_match_policy<IteratorT, NodeFactoryT, T>,
|
||||
IteratorT,
|
||||
NodeFactoryT,
|
||||
ast_tree_policy<
|
||||
ast_match_policy<IteratorT, NodeFactoryT, T>,
|
||||
NodeFactoryT,
|
||||
T
|
||||
>,
|
||||
T
|
||||
>
|
||||
common_tree_match_policy_;
|
||||
|
||||
ast_match_policy()
|
||||
{
|
||||
}
|
||||
|
||||
template <typename PolicyT>
|
||||
ast_match_policy(PolicyT const & policies)
|
||||
: common_tree_match_policy_(policies)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename MatchPolicyT, typename NodeFactoryT, typename T>
|
||||
struct ast_tree_policy :
|
||||
public common_tree_tree_policy<MatchPolicyT, NodeFactoryT>
|
||||
{
|
||||
typedef typename MatchPolicyT::match_t match_t;
|
||||
typedef typename MatchPolicyT::iterator_t iterator_t;
|
||||
|
||||
template<typename MatchAT, typename MatchBT>
|
||||
static void concat(MatchAT& a, MatchBT const& b)
|
||||
{
|
||||
BOOST_SPIRIT_ASSERT(a && b);
|
||||
|
||||
#if defined(BOOST_SPIRIT_DEBUG) && \
|
||||
(BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES)
|
||||
BOOST_SPIRIT_DEBUG_OUT << "\n>>>AST concat. a = " << a <<
|
||||
"\n\tb = " << b << "<<<\n";
|
||||
#endif
|
||||
typedef typename tree_match<iterator_t, NodeFactoryT, T>::container_t
|
||||
container_t;
|
||||
|
||||
// test for size() is nessecary, because no_tree_gen_node leaves a.trees
|
||||
// and/or b.trees empty
|
||||
if (0 != b.trees.size() && b.trees.begin()->value.is_root())
|
||||
{
|
||||
BOOST_SPIRIT_ASSERT(b.trees.size() == 1);
|
||||
|
||||
container_t tmp;
|
||||
std::swap(a.trees, tmp); // save a into tmp
|
||||
std::swap(b.trees, a.trees); // make b.trees[0] be new root (a.trees[0])
|
||||
container_t* pnon_root_trees = &a.trees;
|
||||
while (pnon_root_trees->size() > 0 &&
|
||||
pnon_root_trees->begin()->value.is_root())
|
||||
{
|
||||
pnon_root_trees = & pnon_root_trees->begin()->children;
|
||||
}
|
||||
pnon_root_trees->insert(pnon_root_trees->begin(),
|
||||
tmp.begin(), tmp.end());
|
||||
}
|
||||
else if (0 != a.trees.size() && a.trees.begin()->value.is_root())
|
||||
{
|
||||
BOOST_SPIRIT_ASSERT(a.trees.size() == 1);
|
||||
|
||||
#if !defined(BOOST_SPIRIT_USE_LIST_FOR_TREES)
|
||||
a.trees.begin()->children.reserve(a.trees.begin()->children.size() + b.trees.size());
|
||||
#endif
|
||||
std::copy(b.trees.begin(),
|
||||
b.trees.end(),
|
||||
std::back_insert_iterator<container_t>(
|
||||
a.trees.begin()->children));
|
||||
}
|
||||
else
|
||||
{
|
||||
#if !defined(BOOST_SPIRIT_USE_LIST_FOR_TREES)
|
||||
a.trees.reserve(a.trees.size() + b.trees.size());
|
||||
#endif
|
||||
std::copy(b.trees.begin(),
|
||||
b.trees.end(),
|
||||
std::back_insert_iterator<container_t>(a.trees));
|
||||
}
|
||||
|
||||
#if defined(BOOST_SPIRIT_DEBUG) && \
|
||||
(BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES)
|
||||
BOOST_SPIRIT_DEBUG_OUT << ">>>after AST concat. a = " << a << "<<<\n\n";
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
template <typename MatchT, typename Iterator1T, typename Iterator2T>
|
||||
static void group_match(MatchT& m, parser_id const& id,
|
||||
Iterator1T const& first, Iterator2T const& last)
|
||||
{
|
||||
if (!m)
|
||||
return;
|
||||
|
||||
typedef typename tree_match<iterator_t, NodeFactoryT, T>::container_t
|
||||
container_t;
|
||||
typedef typename container_t::iterator cont_iterator_t;
|
||||
typedef typename NodeFactoryT::template factory<iterator_t> factory_t;
|
||||
|
||||
if (m.trees.size() == 1
|
||||
#ifdef BOOST_SPIRIT_NO_TREE_NODE_COLLAPSING
|
||||
&& !(id.to_long() && m.trees.begin()->value.id().to_long())
|
||||
#endif
|
||||
)
|
||||
{
|
||||
// set rule_id's. There may have been multiple nodes created.
|
||||
// Because of root_node[] they may be left-most children of the top
|
||||
// node.
|
||||
container_t* punset_id = &m.trees;
|
||||
while (punset_id->size() > 0 &&
|
||||
punset_id->begin()->value.id() == 0)
|
||||
{
|
||||
punset_id->begin()->value.id(id);
|
||||
punset_id = &punset_id->begin()->children;
|
||||
}
|
||||
|
||||
m.trees.begin()->value.is_root(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
match_t newmatch(m.length(),
|
||||
m.trees.empty() ?
|
||||
factory_t::empty_node() :
|
||||
factory_t::create_node(first, last, false));
|
||||
|
||||
std::swap(newmatch.trees.begin()->children, m.trees);
|
||||
// set this node and all it's unset children's rule_id
|
||||
newmatch.trees.begin()->value.id(id);
|
||||
for (cont_iterator_t i = newmatch.trees.begin();
|
||||
i != newmatch.trees.end();
|
||||
++i)
|
||||
{
|
||||
if (i->value.id() == 0)
|
||||
i->value.id(id);
|
||||
}
|
||||
m = newmatch;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename FunctorT, typename MatchT>
|
||||
static void apply_op_to_match(FunctorT const& op, MatchT& m)
|
||||
{
|
||||
op(m);
|
||||
}
|
||||
};
|
||||
|
||||
namespace impl {
|
||||
|
||||
template <typename IteratorT, typename NodeFactoryT, typename T>
|
||||
struct tree_policy_selector<ast_match_policy<IteratorT, NodeFactoryT, T> >
|
||||
{
|
||||
typedef ast_tree_policy<
|
||||
ast_match_policy<IteratorT, NodeFactoryT, T>,
|
||||
NodeFactoryT,
|
||||
T
|
||||
> type;
|
||||
};
|
||||
|
||||
} // namespace impl
|
||||
|
||||
|
||||
//////////////////////////////////
|
||||
struct gen_ast_node_parser_gen;
|
||||
|
||||
template <typename T>
|
||||
struct gen_ast_node_parser
|
||||
: public unary<T, parser<gen_ast_node_parser<T> > >
|
||||
{
|
||||
typedef gen_ast_node_parser<T> self_t;
|
||||
typedef gen_ast_node_parser_gen parser_generator_t;
|
||||
typedef unary_parser_category parser_category_t;
|
||||
|
||||
gen_ast_node_parser(T const& a)
|
||||
: unary<T, parser<gen_ast_node_parser<T> > >(a) {}
|
||||
|
||||
template <typename ScannerT>
|
||||
typename parser_result<self_t, ScannerT>::type
|
||||
parse(ScannerT const& scan) const
|
||||
{
|
||||
typedef typename ScannerT::iteration_policy_t iteration_policy_t;
|
||||
typedef typename ScannerT::match_policy_t::iterator_t iterator_t;
|
||||
typedef typename ScannerT::match_policy_t::factory_t factory_t;
|
||||
typedef ast_match_policy<iterator_t, factory_t> match_policy_t;
|
||||
typedef typename ScannerT::action_policy_t action_policy_t;
|
||||
typedef scanner_policies<
|
||||
iteration_policy_t,
|
||||
match_policy_t,
|
||||
action_policy_t
|
||||
> policies_t;
|
||||
|
||||
return this->subject().parse(scan.change_policies(policies_t(scan)));
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////////////////
|
||||
struct gen_ast_node_parser_gen
|
||||
{
|
||||
template <typename T>
|
||||
struct result {
|
||||
|
||||
typedef gen_ast_node_parser<T> type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
static gen_ast_node_parser<T>
|
||||
generate(parser<T> const& s)
|
||||
{
|
||||
return gen_ast_node_parser<T>(s.derived());
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
gen_ast_node_parser<T>
|
||||
operator[](parser<T> const& s) const
|
||||
{
|
||||
return gen_ast_node_parser<T>(s.derived());
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////////////////
|
||||
const gen_ast_node_parser_gen gen_ast_node_d = gen_ast_node_parser_gen();
|
||||
|
||||
|
||||
//////////////////////////////////
|
||||
struct root_node_op
|
||||
{
|
||||
template <typename MatchT>
|
||||
void operator()(MatchT& m) const
|
||||
{
|
||||
BOOST_SPIRIT_ASSERT(m.trees.size() > 0);
|
||||
m.trees.begin()->value.is_root(true);
|
||||
}
|
||||
};
|
||||
|
||||
const node_parser_gen<root_node_op> root_node_d =
|
||||
node_parser_gen<root_node_op>();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Parse functions for ASTs
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <
|
||||
typename AstFactoryT, typename IteratorT, typename ParserT,
|
||||
typename SkipT
|
||||
>
|
||||
inline tree_parse_info<IteratorT, AstFactoryT>
|
||||
ast_parse(
|
||||
IteratorT const& first_,
|
||||
IteratorT const& last_,
|
||||
parser<ParserT> const& parser,
|
||||
SkipT const& skip_,
|
||||
AstFactoryT const & /*dummy_*/ = AstFactoryT())
|
||||
{
|
||||
typedef skip_parser_iteration_policy<SkipT> iter_policy_t;
|
||||
typedef ast_match_policy<IteratorT, AstFactoryT> ast_match_policy_t;
|
||||
typedef
|
||||
scanner_policies<iter_policy_t, ast_match_policy_t>
|
||||
scanner_policies_t;
|
||||
typedef scanner<IteratorT, scanner_policies_t> scanner_t;
|
||||
|
||||
iter_policy_t iter_policy(skip_);
|
||||
scanner_policies_t policies(iter_policy);
|
||||
IteratorT first = first_;
|
||||
scanner_t scan(first, last_, policies);
|
||||
tree_match<IteratorT, AstFactoryT> hit = parser.derived().parse(scan);
|
||||
return tree_parse_info<IteratorT, AstFactoryT>(
|
||||
first, hit, hit && (first == last_), hit.length(), hit.trees);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename IteratorT, typename ParserT, typename SkipT>
|
||||
inline tree_parse_info<IteratorT>
|
||||
ast_parse(
|
||||
IteratorT const& first_,
|
||||
IteratorT const& last_,
|
||||
parser<ParserT> const& parser,
|
||||
SkipT const& skip_)
|
||||
{
|
||||
typedef node_val_data_factory<nil_t> default_factory_t;
|
||||
return ast_parse(first_, last_, parser, skip_, default_factory_t());
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename IteratorT, typename ParserT>
|
||||
inline tree_parse_info<IteratorT>
|
||||
ast_parse(
|
||||
IteratorT const& first_,
|
||||
IteratorT const& last,
|
||||
parser<ParserT> const& parser)
|
||||
{
|
||||
typedef ast_match_policy<IteratorT> ast_match_policy_t;
|
||||
IteratorT first = first_;
|
||||
scanner<
|
||||
IteratorT,
|
||||
scanner_policies<iteration_policy, ast_match_policy_t>
|
||||
> scan(first, last);
|
||||
tree_match<IteratorT> hit = parser.derived().parse(scan);
|
||||
return tree_parse_info<IteratorT>(
|
||||
first, hit, hit && (first == last), hit.length(), hit.trees);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT, typename ParserT, typename SkipT>
|
||||
inline tree_parse_info<CharT const*>
|
||||
ast_parse(
|
||||
CharT const* str,
|
||||
parser<ParserT> const& parser,
|
||||
SkipT const& skip)
|
||||
{
|
||||
CharT const* last = str;
|
||||
while (*last)
|
||||
last++;
|
||||
return ast_parse(str, last, parser, skip);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT, typename ParserT>
|
||||
inline tree_parse_info<CharT const*>
|
||||
ast_parse(
|
||||
CharT const* str,
|
||||
parser<ParserT> const& parser)
|
||||
{
|
||||
CharT const* last = str;
|
||||
while (*last)
|
||||
{
|
||||
last++;
|
||||
}
|
||||
return ast_parse(str, last, parser);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}} // namespace BOOST_SPIRIT_CLASSIC_NS
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006 Tobias Schwinger
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
#if !defined(BOOST_SPIRIT_TREE_AST_FWD_HPP)
|
||||
#define BOOST_SPIRIT_TREE_AST_FWD_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/core/nil.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
template <
|
||||
typename MatchPolicyT,
|
||||
typename NodeFactoryT,
|
||||
typename T = nil_t
|
||||
>
|
||||
struct ast_tree_policy;
|
||||
|
||||
template <
|
||||
typename IteratorT,
|
||||
typename NodeFactoryT = node_val_data_factory<nil_t>,
|
||||
typename T = nil_t
|
||||
>
|
||||
struct ast_match_policy;
|
||||
|
||||
template <typename T>
|
||||
struct gen_ast_node_parser;
|
||||
|
||||
struct root_node_op;
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}} // namespace BOOST_SPIRIT_CLASSIC_NS
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,96 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006 Tobias Schwinger
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
#if !defined(BOOST_SPIRIT_TREE_COMMON_FWD_HPP)
|
||||
#define BOOST_SPIRIT_TREE_COMMON_FWD_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/core/nil.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
template <typename T>
|
||||
struct tree_node;
|
||||
|
||||
template <typename IteratorT = char const*, typename ValueT = nil_t>
|
||||
struct node_iter_data;
|
||||
|
||||
template <typename ValueT = nil_t>
|
||||
class node_iter_data_factory;
|
||||
|
||||
template <typename ValueT = nil_t>
|
||||
class node_val_data_factory;
|
||||
|
||||
template <typename ValueT = nil_t>
|
||||
class node_all_val_data_factory;
|
||||
|
||||
template <
|
||||
typename IteratorT,
|
||||
typename NodeFactoryT = node_val_data_factory<nil_t>,
|
||||
typename T = nil_t
|
||||
>
|
||||
class tree_match;
|
||||
|
||||
struct tree_policy;
|
||||
|
||||
template <
|
||||
typename MatchPolicyT,
|
||||
typename IteratorT,
|
||||
typename NodeFactoryT,
|
||||
typename TreePolicyT,
|
||||
typename T = nil_t
|
||||
>
|
||||
struct common_tree_match_policy;
|
||||
|
||||
template <typename MatchPolicyT, typename NodeFactoryT>
|
||||
struct common_tree_tree_policy;
|
||||
|
||||
template <typename T>
|
||||
struct no_tree_gen_node_parser;
|
||||
|
||||
template <typename T>
|
||||
struct leaf_node_parser;
|
||||
|
||||
template <typename T, typename NodeParserT>
|
||||
struct node_parser;
|
||||
|
||||
struct discard_node_op;
|
||||
struct reduced_node_op;
|
||||
struct infix_node_op;
|
||||
struct discard_first_node_op;
|
||||
struct discard_last_node_op;
|
||||
struct inner_node_op;
|
||||
|
||||
template <typename T, typename ActionParserT>
|
||||
struct action_directive_parser;
|
||||
|
||||
struct access_match_action
|
||||
{
|
||||
template <typename ParserT, typename ActionT>
|
||||
struct action;
|
||||
};
|
||||
|
||||
struct access_node_action
|
||||
{
|
||||
template <typename ParserT, typename ActionT>
|
||||
struct action;
|
||||
};
|
||||
|
||||
template <
|
||||
typename IteratorT = char const *,
|
||||
typename NodeFactoryT = node_val_data_factory<nil_t>,
|
||||
typename T = nil_t
|
||||
>
|
||||
struct tree_parse_info;
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}} // namespace BOOST_SPIRIT_CLASSIC_NS
|
||||
|
||||
#endif
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Hartmut Kaiser
|
||||
Copyright (c) 2001-2003 Daniel Nuffer
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
|
||||
#if !defined(PARSE_TREE_UTILS_IPP)
|
||||
#define PARSE_TREE_UTILS_IPP
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost {
|
||||
namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Returnes the first leaf node of the given parsetree.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
inline tree_node<T> const &
|
||||
get_first_leaf (tree_node<T> const &node)
|
||||
{
|
||||
if (node.children.size() > 0)
|
||||
return get_first_leaf(*node.children.begin());
|
||||
return node;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Find a specified node through recursive search.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
inline bool
|
||||
find_node (tree_node<T> const &node, parser_id node_to_search,
|
||||
tree_node<T> const **found_node)
|
||||
{
|
||||
if (node.value.id() == node_to_search) {
|
||||
*found_node = &node;
|
||||
return true;
|
||||
}
|
||||
if (node.children.size() > 0) {
|
||||
typedef typename tree_node<T>::const_tree_iterator const_tree_iterator;
|
||||
|
||||
const_tree_iterator end = node.children.end();
|
||||
for (const_tree_iterator it = node.children.begin(); it != end; ++it)
|
||||
{
|
||||
if (find_node (*it, node_to_search, found_node))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false; // not found here
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The functions 'get_node_range' return a pair of iterators pointing at the
|
||||
// range, which containes the elements of a specified node.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace impl {
|
||||
|
||||
template <typename T>
|
||||
inline bool
|
||||
get_node_range (typename tree_node<T>::const_tree_iterator const &start,
|
||||
parser_id node_to_search,
|
||||
std::pair<typename tree_node<T>::const_tree_iterator,
|
||||
typename tree_node<T>::const_tree_iterator> &nodes)
|
||||
{
|
||||
// look at this node first
|
||||
tree_node<T> const &node = *start;
|
||||
|
||||
if (node.value.id() == node_to_search) {
|
||||
if (node.children.size() > 0) {
|
||||
// full subrange
|
||||
nodes.first = node.children.begin();
|
||||
nodes.second = node.children.end();
|
||||
}
|
||||
else {
|
||||
// only this node
|
||||
nodes.first = start;
|
||||
nodes.second = start;
|
||||
std::advance(nodes.second, 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// look at subnodes now
|
||||
if (node.children.size() > 0) {
|
||||
typedef typename tree_node<T>::const_tree_iterator const_tree_iterator;
|
||||
|
||||
const_tree_iterator end = node.children.end();
|
||||
for (const_tree_iterator it = node.children.begin(); it != end; ++it)
|
||||
{
|
||||
if (impl::get_node_range<T>(it, node_to_search, nodes))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // end of namespace impl
|
||||
|
||||
template <typename T>
|
||||
inline bool
|
||||
get_node_range (tree_node<T> const &node, parser_id node_to_search,
|
||||
std::pair<typename tree_node<T>::const_tree_iterator,
|
||||
typename tree_node<T>::const_tree_iterator> &nodes)
|
||||
{
|
||||
if (node.children.size() > 0) {
|
||||
typedef typename tree_node<T>::const_tree_iterator const_tree_iterator;
|
||||
|
||||
const_tree_iterator end = node.children.end();
|
||||
for (const_tree_iterator it = node.children.begin(); it != end; ++it)
|
||||
{
|
||||
if (impl::get_node_range<T>(it, node_to_search, nodes))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
} // namespace spirit
|
||||
} // namespace boost
|
||||
|
||||
#endif // !defined(PARSE_TREE_UTILS_IPP)
|
||||
+527
@@ -0,0 +1,527 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2008 Hartmut Kaiser
|
||||
Copyright (c) 2001-2003 Daniel Nuffer
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
|
||||
#if !defined(TREE_TO_XML_IPP)
|
||||
#define TREE_TO_XML_IPP
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdarg>
|
||||
#include <locale>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/scoped_array.hpp>
|
||||
|
||||
#ifdef BOOST_NO_STRINGSTREAM
|
||||
#include <strstream>
|
||||
#define BOOST_SPIRIT_OSSTREAM std::ostrstream
|
||||
inline
|
||||
std::string BOOST_SPIRIT_GETSTRING(std::ostrstream& ss)
|
||||
{
|
||||
ss << std::ends;
|
||||
std::string rval = ss.str();
|
||||
ss.freeze(false);
|
||||
return rval;
|
||||
}
|
||||
#else
|
||||
#include <sstream>
|
||||
#define BOOST_SPIRIT_GETSTRING(ss) ss.str()
|
||||
#define BOOST_SPIRIT_OSSTREAM std::basic_ostringstream<CharT>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
namespace impl {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename CharT>
|
||||
struct string_lit;
|
||||
|
||||
template <>
|
||||
struct string_lit<char>
|
||||
{
|
||||
static char get(char c) { return c; }
|
||||
static std::string get(char const* str = "") { return str; }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct string_lit<wchar_t>
|
||||
{
|
||||
static wchar_t get(char c)
|
||||
{
|
||||
typedef std::ctype<wchar_t> ctype_t;
|
||||
return std::use_facet<ctype_t>(std::locale()).widen(c);
|
||||
}
|
||||
static std::basic_string<wchar_t> get(char const* source = "")
|
||||
{
|
||||
using namespace std; // some systems have size_t in ns std
|
||||
size_t len = strlen(source);
|
||||
boost::scoped_array<wchar_t> result (new wchar_t[len+1]);
|
||||
result.get()[len] = '\0';
|
||||
|
||||
// working with wide character streams is supported only if the
|
||||
// platform provides the std::ctype<wchar_t> facet
|
||||
BOOST_ASSERT(std::has_facet<std::ctype<wchar_t> >(std::locale()));
|
||||
|
||||
std::use_facet<std::ctype<wchar_t> >(std::locale())
|
||||
.widen(source, source + len, result.get());
|
||||
return result.get();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// xml formatting helper classes
|
||||
namespace xml {
|
||||
|
||||
template <typename CharT>
|
||||
inline void
|
||||
encode (std::basic_string<CharT> &str, char s, char const *r, int len)
|
||||
{
|
||||
typedef typename std::basic_string<CharT>::size_type size_type;
|
||||
|
||||
size_type pos = 0;
|
||||
while ((pos = str.find_first_of (impl::string_lit<CharT>::get(s), pos)) !=
|
||||
size_type(std::basic_string<CharT>::npos))
|
||||
{
|
||||
str.replace (pos, 1, impl::string_lit<CharT>::get(r));
|
||||
pos += len;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename CharT>
|
||||
inline std::basic_string<CharT>
|
||||
encode (std::basic_string<CharT> str)
|
||||
{
|
||||
encode(str, '&', "&", 3);
|
||||
encode(str, '<', "<", 2);
|
||||
encode(str, '>', ">", 2);
|
||||
encode(str, '\r', "\\r", 1);
|
||||
encode(str, '\n', "\\n", 1);
|
||||
return str;
|
||||
}
|
||||
|
||||
template <typename CharT>
|
||||
inline std::basic_string<CharT>
|
||||
encode (CharT const *text)
|
||||
{
|
||||
return encode (std::basic_string<CharT>(text));
|
||||
}
|
||||
|
||||
// format a xml attribute
|
||||
template <typename CharT>
|
||||
struct attribute
|
||||
{
|
||||
attribute()
|
||||
{
|
||||
}
|
||||
|
||||
attribute (std::basic_string<CharT> const& key_,
|
||||
std::basic_string<CharT> const& value_)
|
||||
: key (key_), value(value_)
|
||||
{
|
||||
}
|
||||
|
||||
bool has_value()
|
||||
{
|
||||
return value.size() > 0;
|
||||
}
|
||||
|
||||
std::basic_string<CharT> key;
|
||||
std::basic_string<CharT> value;
|
||||
};
|
||||
|
||||
template <typename CharT>
|
||||
inline std::basic_ostream<CharT>&
|
||||
operator<< (std::basic_ostream<CharT> &ostrm, attribute<CharT> const &attr)
|
||||
{
|
||||
if (0 == attr.key.size())
|
||||
return ostrm;
|
||||
ostrm << impl::string_lit<CharT>::get(" ") << encode(attr.key)
|
||||
<< impl::string_lit<CharT>::get("=\"") << encode(attr.value)
|
||||
<< impl::string_lit<CharT>::get("\"");
|
||||
return ostrm;
|
||||
}
|
||||
|
||||
// output a xml element (base class, not used directly)
|
||||
template <typename CharT>
|
||||
class element
|
||||
{
|
||||
protected:
|
||||
element(std::basic_ostream<CharT> &ostrm_, bool incr_indent_ = true)
|
||||
: ostrm(ostrm_), incr_indent(incr_indent_)
|
||||
{
|
||||
if (incr_indent) ++get_indent();
|
||||
}
|
||||
~element()
|
||||
{
|
||||
if (incr_indent) --get_indent();
|
||||
}
|
||||
|
||||
public:
|
||||
void output_space ()
|
||||
{
|
||||
for (int i = 0; i < get_indent(); i++)
|
||||
ostrm << impl::string_lit<CharT>::get(" ");
|
||||
}
|
||||
|
||||
protected:
|
||||
int &get_indent()
|
||||
{
|
||||
static int indent;
|
||||
|
||||
return indent;
|
||||
}
|
||||
|
||||
std::basic_ostream<CharT> &ostrm;
|
||||
bool incr_indent;
|
||||
};
|
||||
|
||||
// a xml node
|
||||
template <typename CharT>
|
||||
class node : public element<CharT>
|
||||
{
|
||||
public:
|
||||
node (std::basic_ostream<CharT> &ostrm_,
|
||||
std::basic_string<CharT> const& tag_, attribute<CharT> &attr)
|
||||
: element<CharT>(ostrm_), tag(tag_)
|
||||
{
|
||||
this->output_space();
|
||||
this->ostrm
|
||||
<< impl::string_lit<CharT>::get("<") << tag_ << attr
|
||||
<< impl::string_lit<CharT>::get(">\n");
|
||||
}
|
||||
node (std::basic_ostream<CharT> &ostrm_,
|
||||
std::basic_string<CharT> const& tag_)
|
||||
: element<CharT>(ostrm_), tag(tag_)
|
||||
{
|
||||
this->output_space();
|
||||
this->ostrm
|
||||
<< impl::string_lit<CharT>::get("<") << tag_
|
||||
<< impl::string_lit<CharT>::get(">\n");
|
||||
}
|
||||
~node()
|
||||
{
|
||||
this->output_space();
|
||||
this->ostrm
|
||||
<< impl::string_lit<CharT>::get("</") << tag
|
||||
<< impl::string_lit<CharT>::get(">\n");
|
||||
}
|
||||
|
||||
private:
|
||||
std::basic_string<CharT> tag;
|
||||
};
|
||||
|
||||
template <typename CharT>
|
||||
class text : public element<CharT>
|
||||
{
|
||||
public:
|
||||
text (std::basic_ostream<CharT> &ostrm_,
|
||||
std::basic_string<CharT> const& tag,
|
||||
std::basic_string<CharT> const& textlit)
|
||||
: element<CharT>(ostrm_)
|
||||
{
|
||||
this->output_space();
|
||||
this->ostrm
|
||||
<< impl::string_lit<CharT>::get("<") << tag
|
||||
<< impl::string_lit<CharT>::get(">") << encode(textlit)
|
||||
<< impl::string_lit<CharT>::get("</") << tag
|
||||
<< impl::string_lit<CharT>::get(">\n");
|
||||
}
|
||||
|
||||
text (std::basic_ostream<CharT> &ostrm_,
|
||||
std::basic_string<CharT> const& tag,
|
||||
std::basic_string<CharT> const& textlit,
|
||||
attribute<CharT> &attr)
|
||||
: element<CharT>(ostrm_)
|
||||
{
|
||||
this->output_space();
|
||||
this->ostrm
|
||||
<< impl::string_lit<CharT>::get("<") << tag << attr
|
||||
<< impl::string_lit<CharT>::get(">") << encode(textlit)
|
||||
<< impl::string_lit<CharT>::get("</") << tag
|
||||
<< impl::string_lit<CharT>::get(">\n");
|
||||
}
|
||||
|
||||
text (std::basic_ostream<CharT> &ostrm_,
|
||||
std::basic_string<CharT> const& tag,
|
||||
std::basic_string<CharT> const& textlit,
|
||||
attribute<CharT> &attr1, attribute<CharT> &attr2)
|
||||
: element<CharT>(ostrm_)
|
||||
{
|
||||
this->output_space();
|
||||
this->ostrm
|
||||
<< impl::string_lit<CharT>::get("<") << tag << attr1 << attr2
|
||||
<< impl::string_lit<CharT>::get(">") << encode(textlit)
|
||||
<< impl::string_lit<CharT>::get("</") << tag
|
||||
<< impl::string_lit<CharT>::get(">\n");
|
||||
}
|
||||
};
|
||||
|
||||
// a xml comment
|
||||
template <typename CharT>
|
||||
class comment : public element<CharT>
|
||||
{
|
||||
public:
|
||||
comment (std::basic_ostream<CharT> &ostrm_,
|
||||
std::basic_string<CharT> const& commentlit)
|
||||
: element<CharT>(ostrm_, false)
|
||||
{
|
||||
if ('\0' != commentlit[0])
|
||||
{
|
||||
this->output_space();
|
||||
this->ostrm << impl::string_lit<CharT>::get("<!-- ")
|
||||
<< encode(commentlit)
|
||||
<< impl::string_lit<CharT>::get(" -->\n");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// a xml document
|
||||
template <typename CharT>
|
||||
class document : public element<CharT>
|
||||
{
|
||||
public:
|
||||
document (std::basic_ostream<CharT> &ostrm_)
|
||||
: element<CharT>(ostrm_)
|
||||
{
|
||||
this->get_indent() = -1;
|
||||
this->ostrm << impl::string_lit<CharT>::get(
|
||||
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n");
|
||||
}
|
||||
|
||||
document (std::basic_ostream<CharT> &ostrm_,
|
||||
std::basic_string<CharT> const& mainnode,
|
||||
std::basic_string<CharT> const& dtd)
|
||||
: element<CharT>(ostrm_)
|
||||
{
|
||||
this->get_indent() = -1;
|
||||
this->ostrm << impl::string_lit<CharT>::get(
|
||||
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n");
|
||||
|
||||
this->output_space();
|
||||
this->ostrm << impl::string_lit<CharT>::get("<!DOCTYPE ") << mainnode
|
||||
<< impl::string_lit<CharT>::get(" SYSTEM \"") << dtd
|
||||
<< impl::string_lit<CharT>::get("\">\n");
|
||||
}
|
||||
~document()
|
||||
{
|
||||
BOOST_SPIRIT_ASSERT(-1 == this->get_indent());
|
||||
}
|
||||
};
|
||||
|
||||
} // end of namespace xml
|
||||
|
||||
namespace impl {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// look up the rule name from the given parser_id
|
||||
template <typename AssocContainerT>
|
||||
inline typename AssocContainerT::value_type::second_type
|
||||
get_rulename (AssocContainerT const &id_to_name_map,
|
||||
BOOST_SPIRIT_CLASSIC_NS::parser_id const &id)
|
||||
{
|
||||
typename AssocContainerT::const_iterator it = id_to_name_map.find(id);
|
||||
if (it != id_to_name_map.end())
|
||||
return (*it).second;
|
||||
typedef typename AssocContainerT::value_type::second_type second_t;
|
||||
return second_t();
|
||||
}
|
||||
|
||||
// dump a parse tree as xml
|
||||
template <
|
||||
typename CharT, typename IteratorT, typename GetIdT, typename GetValueT
|
||||
>
|
||||
inline void
|
||||
token_to_xml (std::basic_ostream<CharT> &ostrm, IteratorT const &it,
|
||||
bool is_root, GetIdT const &get_token_id, GetValueT const &get_token_value)
|
||||
{
|
||||
BOOST_SPIRIT_OSSTREAM stream;
|
||||
|
||||
stream << get_token_id(*it) << std::ends;
|
||||
xml::attribute<CharT> token_id (
|
||||
impl::string_lit<CharT>::get("id"),
|
||||
BOOST_SPIRIT_GETSTRING(stream).c_str());
|
||||
xml::attribute<CharT> is_root_attr (
|
||||
impl::string_lit<CharT>::get("is_root"),
|
||||
impl::string_lit<CharT>::get(is_root ? "1" : ""));
|
||||
xml::attribute<CharT> nil;
|
||||
xml::text<CharT>(ostrm,
|
||||
impl::string_lit<CharT>::get("token"),
|
||||
get_token_value(*it).c_str(),
|
||||
token_id,
|
||||
is_root_attr.has_value() ? is_root_attr : nil);
|
||||
}
|
||||
|
||||
template <
|
||||
typename CharT, typename TreeNodeT, typename AssocContainerT,
|
||||
typename GetIdT, typename GetValueT
|
||||
>
|
||||
inline void
|
||||
tree_node_to_xml (std::basic_ostream<CharT> &ostrm, TreeNodeT const &node,
|
||||
AssocContainerT const& id_to_name_map, GetIdT const &get_token_id,
|
||||
GetValueT const &get_token_value)
|
||||
{
|
||||
typedef typename TreeNodeT::const_iterator node_iter_t;
|
||||
typedef
|
||||
typename TreeNodeT::value_type::parse_node_t::const_iterator_t
|
||||
value_iter_t;
|
||||
|
||||
xml::attribute<CharT> nil;
|
||||
node_iter_t end = node.end();
|
||||
for (node_iter_t it = node.begin(); it != end; ++it)
|
||||
{
|
||||
// output a node
|
||||
xml::attribute<CharT> id (
|
||||
impl::string_lit<CharT>::get("rule"),
|
||||
get_rulename(id_to_name_map, (*it).value.id()).c_str());
|
||||
xml::node<CharT> currnode (ostrm,
|
||||
impl::string_lit<CharT>::get("parsenode"),
|
||||
(*it).value.id() != 0 && id.has_value() ? id : nil);
|
||||
|
||||
// first dump the value
|
||||
std::size_t cnt = std::distance((*it).value.begin(), (*it).value.end());
|
||||
|
||||
if (1 == cnt)
|
||||
{
|
||||
token_to_xml (ostrm, (*it).value.begin(),
|
||||
(*it).value.is_root(), get_token_id, get_token_value);
|
||||
}
|
||||
else if (cnt > 1)
|
||||
{
|
||||
xml::node<CharT> value (ostrm,
|
||||
impl::string_lit<CharT>::get("value"));
|
||||
bool is_root = (*it).value.is_root();
|
||||
|
||||
value_iter_t val_end = (*it).value.end();
|
||||
for (value_iter_t val_it = (*it).value.begin();
|
||||
val_it != val_end; ++val_it)
|
||||
{
|
||||
token_to_xml (ostrm, val_it, is_root, get_token_id,
|
||||
get_token_value);
|
||||
}
|
||||
}
|
||||
tree_node_to_xml(ostrm, (*it).children, id_to_name_map,
|
||||
get_token_id, get_token_value); // dump all subnodes
|
||||
}
|
||||
}
|
||||
|
||||
template <typename CharT, typename TreeNodeT, typename AssocContainerT>
|
||||
inline void
|
||||
tree_node_to_xml (std::basic_ostream<CharT> &ostrm, TreeNodeT const &node,
|
||||
AssocContainerT const& id_to_name_map)
|
||||
{
|
||||
typedef typename TreeNodeT::const_iterator node_iter_t;
|
||||
|
||||
xml::attribute<CharT> nil;
|
||||
node_iter_t end = node.end();
|
||||
for (node_iter_t it = node.begin(); it != end; ++it)
|
||||
{
|
||||
// output a node
|
||||
xml::attribute<CharT> id (
|
||||
impl::string_lit<CharT>::get("rule"),
|
||||
get_rulename(id_to_name_map, (*it).value.id()).c_str());
|
||||
xml::node<CharT> currnode (ostrm,
|
||||
impl::string_lit<CharT>::get("parsenode"),
|
||||
(*it).value.id() != parser_id() && id.has_value() ? id : nil);
|
||||
|
||||
// first dump the value
|
||||
if ((*it).value.begin() != (*it).value.end())
|
||||
{
|
||||
std::basic_string<CharT> tokens ((*it).value.begin(), (*it).value.end());
|
||||
|
||||
if (tokens.size() > 0)
|
||||
{
|
||||
// output all subtokens as one string (for better readability)
|
||||
xml::attribute<CharT> is_root (
|
||||
impl::string_lit<CharT>::get("is_root"),
|
||||
impl::string_lit<CharT>::get((*it).value.is_root() ? "1" : ""));
|
||||
xml::text<CharT>(ostrm,
|
||||
impl::string_lit<CharT>::get("value"), tokens.c_str(),
|
||||
is_root.has_value() ? is_root : nil);
|
||||
}
|
||||
|
||||
}
|
||||
// dump all subnodes
|
||||
tree_node_to_xml(ostrm, (*it).children, id_to_name_map);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace impl
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// dump a parse tree as a xml stream (generic variant)
|
||||
template <
|
||||
typename CharT, typename TreeNodeT, typename AssocContainerT,
|
||||
typename GetIdT, typename GetValueT
|
||||
>
|
||||
inline void
|
||||
basic_tree_to_xml (std::basic_ostream<CharT> &ostrm, TreeNodeT const &tree,
|
||||
std::basic_string<CharT> const &input_line, AssocContainerT const& id_to_name,
|
||||
GetIdT const &get_token_id, GetValueT const &get_token_value)
|
||||
{
|
||||
// generate xml dump
|
||||
xml::document<CharT> doc (ostrm,
|
||||
impl::string_lit<CharT>::get("parsetree"),
|
||||
impl::string_lit<CharT>::get("parsetree.dtd"));
|
||||
xml::comment<CharT> input (ostrm, input_line.c_str());
|
||||
xml::attribute<CharT> ver (
|
||||
impl::string_lit<CharT>::get("version"),
|
||||
impl::string_lit<CharT>::get("1.0"));
|
||||
xml::node<CharT> mainnode (ostrm,
|
||||
impl::string_lit<CharT>::get("parsetree"), ver);
|
||||
|
||||
impl::tree_node_to_xml (ostrm, tree, id_to_name, get_token_id,
|
||||
get_token_value);
|
||||
}
|
||||
|
||||
// dump a parse tree as a xml steam (for character based parsers)
|
||||
template <typename CharT, typename TreeNodeT, typename AssocContainerT>
|
||||
inline void
|
||||
basic_tree_to_xml (std::basic_ostream<CharT> &ostrm, TreeNodeT const &tree,
|
||||
std::basic_string<CharT> const &input_line,
|
||||
AssocContainerT const& id_to_name)
|
||||
{
|
||||
// generate xml dump
|
||||
xml::document<CharT> doc (ostrm,
|
||||
impl::string_lit<CharT>::get("parsetree"),
|
||||
impl::string_lit<CharT>::get("parsetree.dtd"));
|
||||
xml::comment<CharT> input (ostrm, input_line.c_str());
|
||||
xml::attribute<CharT> ver (
|
||||
impl::string_lit<CharT>::get("version"),
|
||||
impl::string_lit<CharT>::get("1.0"));
|
||||
xml::node<CharT> mainnode (ostrm,
|
||||
impl::string_lit<CharT>::get("parsetree"), ver);
|
||||
|
||||
impl::tree_node_to_xml(ostrm, tree, id_to_name);
|
||||
}
|
||||
|
||||
template <typename CharT, typename TreeNodeT>
|
||||
inline void
|
||||
basic_tree_to_xml (std::basic_ostream<CharT> &ostrm, TreeNodeT const &tree,
|
||||
std::basic_string<CharT> const &input_line)
|
||||
{
|
||||
return basic_tree_to_xml<CharT>(ostrm, tree, input_line,
|
||||
std::map<BOOST_SPIRIT_CLASSIC_NS::parser_id, std::basic_string<CharT> >());
|
||||
}
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}} // namespace boost::spirit
|
||||
|
||||
#undef BOOST_SPIRIT_OSSTREAM
|
||||
#undef BOOST_SPIRIT_GETSTRING
|
||||
|
||||
#endif // !defined(PARSE_TREE_XML_HPP)
|
||||
@@ -0,0 +1,295 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2003 Daniel Nuffer
|
||||
Copyright (c) 2001-2007 Hartmut Kaiser
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
#ifndef BOOST_SPIRIT_TREE_PARSE_TREE_HPP
|
||||
#define BOOST_SPIRIT_TREE_PARSE_TREE_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/tree/common.hpp>
|
||||
#include <boost/spirit/home/classic/core/scanner/scanner.hpp>
|
||||
|
||||
#include <boost/spirit/home/classic/tree/parse_tree_fwd.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
//////////////////////////////////
|
||||
// pt_match_policy is simply an id so the correct specialization of tree_policy can be found.
|
||||
template <
|
||||
typename IteratorT,
|
||||
typename NodeFactoryT,
|
||||
typename T
|
||||
>
|
||||
struct pt_match_policy :
|
||||
public common_tree_match_policy<
|
||||
pt_match_policy<IteratorT, NodeFactoryT, T>,
|
||||
IteratorT,
|
||||
NodeFactoryT,
|
||||
pt_tree_policy<
|
||||
pt_match_policy<IteratorT, NodeFactoryT, T>,
|
||||
NodeFactoryT,
|
||||
T
|
||||
>,
|
||||
T
|
||||
>
|
||||
{
|
||||
typedef
|
||||
common_tree_match_policy<
|
||||
pt_match_policy<IteratorT, NodeFactoryT, T>,
|
||||
IteratorT,
|
||||
NodeFactoryT,
|
||||
pt_tree_policy<
|
||||
pt_match_policy<IteratorT, NodeFactoryT, T>,
|
||||
NodeFactoryT,
|
||||
T
|
||||
>,
|
||||
T
|
||||
>
|
||||
common_tree_match_policy_;
|
||||
|
||||
pt_match_policy()
|
||||
{
|
||||
}
|
||||
|
||||
template <typename PolicyT>
|
||||
pt_match_policy(PolicyT const & policies)
|
||||
: common_tree_match_policy_(policies)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename MatchPolicyT, typename NodeFactoryT, typename T>
|
||||
struct pt_tree_policy :
|
||||
public common_tree_tree_policy<MatchPolicyT, NodeFactoryT>
|
||||
{
|
||||
typedef typename MatchPolicyT::match_t match_t;
|
||||
typedef typename MatchPolicyT::iterator_t iterator_t;
|
||||
|
||||
template<typename MatchAT, typename MatchBT>
|
||||
static void concat(MatchAT& a, MatchBT const& b)
|
||||
{
|
||||
BOOST_SPIRIT_ASSERT(a && b);
|
||||
|
||||
std::copy(b.trees.begin(), b.trees.end(),
|
||||
std::back_insert_iterator<typename match_t::container_t>(a.trees));
|
||||
}
|
||||
|
||||
template <typename MatchT, typename Iterator1T, typename Iterator2T>
|
||||
static void group_match(MatchT& m, parser_id const& id,
|
||||
Iterator1T const& first, Iterator2T const& last)
|
||||
{
|
||||
if (!m)
|
||||
return;
|
||||
|
||||
typedef typename NodeFactoryT::template factory<iterator_t> factory_t;
|
||||
typedef typename tree_match<iterator_t, NodeFactoryT, T>::container_t
|
||||
container_t;
|
||||
typedef typename container_t::iterator cont_iterator_t;
|
||||
|
||||
match_t newmatch(m.length(),
|
||||
factory_t::create_node(first, last, false));
|
||||
|
||||
std::swap(newmatch.trees.begin()->children, m.trees);
|
||||
// set this node and all it's unset children's rule_id
|
||||
newmatch.trees.begin()->value.id(id);
|
||||
for (cont_iterator_t i = newmatch.trees.begin()->children.begin();
|
||||
i != newmatch.trees.begin()->children.end();
|
||||
++i)
|
||||
{
|
||||
if (i->value.id() == 0)
|
||||
i->value.id(id);
|
||||
}
|
||||
m = newmatch;
|
||||
}
|
||||
|
||||
template <typename FunctorT, typename MatchT>
|
||||
static void apply_op_to_match(FunctorT const& op, MatchT& m)
|
||||
{
|
||||
op(m);
|
||||
}
|
||||
};
|
||||
|
||||
namespace impl {
|
||||
|
||||
template <typename IteratorT, typename NodeFactoryT, typename T>
|
||||
struct tree_policy_selector<pt_match_policy<IteratorT, NodeFactoryT, T> >
|
||||
{
|
||||
typedef pt_tree_policy<
|
||||
pt_match_policy<IteratorT, NodeFactoryT, T>,
|
||||
NodeFactoryT,
|
||||
T
|
||||
> type;
|
||||
};
|
||||
|
||||
} // namespace impl
|
||||
|
||||
|
||||
//////////////////////////////////
|
||||
struct gen_pt_node_parser_gen;
|
||||
|
||||
template <typename T>
|
||||
struct gen_pt_node_parser
|
||||
: public unary<T, parser<gen_pt_node_parser<T> > >
|
||||
{
|
||||
typedef gen_pt_node_parser<T> self_t;
|
||||
typedef gen_pt_node_parser_gen parser_generator_t;
|
||||
typedef unary_parser_category parser_category_t;
|
||||
|
||||
gen_pt_node_parser(T const& a)
|
||||
: unary<T, parser<gen_pt_node_parser<T> > >(a) {}
|
||||
|
||||
template <typename ScannerT>
|
||||
typename parser_result<self_t, ScannerT>::type
|
||||
parse(ScannerT const& scan) const
|
||||
{
|
||||
typedef typename ScannerT::iteration_policy_t iteration_policy_t;
|
||||
typedef typename ScannerT::match_policy_t::iterator_t iterator_t;
|
||||
typedef typename ScannerT::match_policy_t::factory_t factory_t;
|
||||
typedef pt_match_policy<iterator_t, factory_t> match_policy_t;
|
||||
typedef typename ScannerT::action_policy_t action_policy_t;
|
||||
typedef scanner_policies<
|
||||
iteration_policy_t,
|
||||
match_policy_t,
|
||||
action_policy_t
|
||||
> policies_t;
|
||||
|
||||
return this->subject().parse(scan.change_policies(policies_t(scan)));
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////////////////
|
||||
struct gen_pt_node_parser_gen
|
||||
{
|
||||
template <typename T>
|
||||
struct result {
|
||||
|
||||
typedef gen_pt_node_parser<T> type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
static gen_pt_node_parser<T>
|
||||
generate(parser<T> const& s)
|
||||
{
|
||||
return gen_pt_node_parser<T>(s.derived());
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
gen_pt_node_parser<T>
|
||||
operator[](parser<T> const& s) const
|
||||
{
|
||||
return gen_pt_node_parser<T>(s.derived());
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////////////////
|
||||
const gen_pt_node_parser_gen gen_pt_node_d = gen_pt_node_parser_gen();
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Parse functions for parse trees
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <
|
||||
typename NodeFactoryT, typename IteratorT, typename ParserT,
|
||||
typename SkipT
|
||||
>
|
||||
inline tree_parse_info<IteratorT, NodeFactoryT>
|
||||
pt_parse(
|
||||
IteratorT const& first_,
|
||||
IteratorT const& last,
|
||||
parser<ParserT> const& p,
|
||||
SkipT const& skip,
|
||||
NodeFactoryT const& /*dummy_*/ = NodeFactoryT())
|
||||
{
|
||||
typedef skip_parser_iteration_policy<SkipT> iter_policy_t;
|
||||
typedef pt_match_policy<IteratorT, NodeFactoryT> pt_match_policy_t;
|
||||
typedef
|
||||
scanner_policies<iter_policy_t, pt_match_policy_t>
|
||||
scanner_policies_t;
|
||||
typedef scanner<IteratorT, scanner_policies_t> scanner_t;
|
||||
|
||||
iter_policy_t iter_policy(skip);
|
||||
scanner_policies_t policies(iter_policy);
|
||||
IteratorT first = first_;
|
||||
scanner_t scan(first, last, policies);
|
||||
tree_match<IteratorT, NodeFactoryT> hit = p.derived().parse(scan);
|
||||
return tree_parse_info<IteratorT, NodeFactoryT>(
|
||||
first, hit, hit && (first == last), hit.length(), hit.trees);
|
||||
}
|
||||
|
||||
template <typename IteratorT, typename ParserT, typename SkipT>
|
||||
inline tree_parse_info<IteratorT>
|
||||
pt_parse(
|
||||
IteratorT const& first,
|
||||
IteratorT const& last,
|
||||
parser<ParserT> const& p,
|
||||
SkipT const& skip)
|
||||
{
|
||||
typedef node_val_data_factory<nil_t> default_node_factory_t;
|
||||
return pt_parse(first, last, p, skip, default_node_factory_t());
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename IteratorT, typename ParserT>
|
||||
inline tree_parse_info<IteratorT>
|
||||
pt_parse(
|
||||
IteratorT const& first_,
|
||||
IteratorT const& last,
|
||||
parser<ParserT> const& parser)
|
||||
{
|
||||
typedef pt_match_policy<IteratorT> pt_match_policy_t;
|
||||
IteratorT first = first_;
|
||||
scanner<
|
||||
IteratorT,
|
||||
scanner_policies<iteration_policy, pt_match_policy_t>
|
||||
> scan(first, last);
|
||||
tree_match<IteratorT> hit = parser.derived().parse(scan);
|
||||
return tree_parse_info<IteratorT>(
|
||||
first, hit, hit && (first == last), hit.length(), hit.trees);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT, typename ParserT, typename SkipT>
|
||||
inline tree_parse_info<CharT const*>
|
||||
pt_parse(
|
||||
CharT const* str,
|
||||
parser<ParserT> const& p,
|
||||
SkipT const& skip)
|
||||
{
|
||||
CharT const* last = str;
|
||||
while (*last)
|
||||
last++;
|
||||
return pt_parse(str, last, p, skip);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT, typename ParserT>
|
||||
inline tree_parse_info<CharT const*>
|
||||
pt_parse(
|
||||
CharT const* str,
|
||||
parser<ParserT> const& parser)
|
||||
{
|
||||
CharT const* last = str;
|
||||
while (*last)
|
||||
{
|
||||
last++;
|
||||
}
|
||||
return pt_parse(str, last, parser);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}} // namespace BOOST_SPIRIT_CLASSIC_NS
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006 Tobias Schwinger
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
#if !defined(BOOST_SPIRIT_TREE_PARSE_TREE_FWD_HPP)
|
||||
#define BOOST_SPIRIT_TREE_PARSE_TREE_FWD_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
template <
|
||||
typename MatchPolicyT,
|
||||
typename NodeFactoryT,
|
||||
typename T = nil_t
|
||||
>
|
||||
struct pt_tree_policy;
|
||||
|
||||
template <
|
||||
typename IteratorT,
|
||||
typename NodeFactoryT = node_val_data_factory<nil_t>,
|
||||
typename T = nil_t
|
||||
>
|
||||
struct pt_match_policy;
|
||||
|
||||
template <typename T>
|
||||
struct gen_pt_node_parser;
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}} // namespace BOOST_SPIRIT_CLASSIC_NS
|
||||
|
||||
#endif
|
||||
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2003 Daniel Nuffer
|
||||
Copyright (c) 2001-2007 Hartmut Kaiser
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
|
||||
#if !defined(PARSE_TREE_UTILS_HPP)
|
||||
#define PARSE_TREE_UTILS_HPP
|
||||
|
||||
#include <utility> // for std::pair
|
||||
|
||||
#include <boost/spirit/home/classic/tree/parse_tree.hpp> // needed for parse tree generation
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost {
|
||||
namespace spirit {
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The function 'get_first_leaf' returnes a reference to the first leaf node
|
||||
// of the given parsetree.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
tree_node<T> const &
|
||||
get_first_leaf (tree_node<T> const &node);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The function 'find_node' finds a specified node through recursive search.
|
||||
// If the return value is true, the variable to which points the parameter
|
||||
// 'found_node' will contain the address of the node with the given rule_id.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
bool
|
||||
find_node (tree_node<T> const &node, parser_id node_to_search,
|
||||
tree_node<T> const **found_node);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The function 'get_node_range' return a pair of iterators pointing at the
|
||||
// range, which containes the elements of a specified node. It's very useful
|
||||
// for locating all information related with a specified node.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
bool
|
||||
get_node_range (tree_node<T> const &node, parser_id node_to_search,
|
||||
std::pair<typename tree_node<T>::const_tree_iterator,
|
||||
typename tree_node<T>::const_tree_iterator> &nodes);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
} // namespace spirit
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/spirit/home/classic/tree/impl/parse_tree_utils.ipp>
|
||||
|
||||
#endif // !defined(PARSE_TREE_UTILS_HPP)
|
||||
@@ -0,0 +1,116 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Hartmut Kaiser
|
||||
Copyright (c) 2001-2003 Daniel Nuffer
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
|
||||
#if !defined(TREE_TO_XML_HPP)
|
||||
#define TREE_TO_XML_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
namespace impl {
|
||||
template <typename CharT> struct default_string;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dump a parse tree as a xml stream
|
||||
//
|
||||
// The functions 'tree_to_xml' can be used to output a parse tree as a xml
|
||||
// stream into the given ostream. The parameters have the following
|
||||
// meaning:
|
||||
//
|
||||
// mandatory parameters:
|
||||
// ostrm The output stream used for streaming the parse tree.
|
||||
// tree The parse tree to output.
|
||||
//
|
||||
// optional parameters:
|
||||
// input_line The input line from which the parse tree was
|
||||
// generated (if given, it is used to output a comment
|
||||
// containing this line).
|
||||
// id_to_name A map, which is used for converting the rule id's contained
|
||||
// in the parse tree to readable strings. Here a auxiliary
|
||||
// associative container can be used, which maps a rule_id to
|
||||
// a std::string (i.e. a std::map<rule_id, std::string>).
|
||||
// get_token_id
|
||||
// A function or functor, which takes an instance of a token
|
||||
// and which should return a token id (i.e. something like
|
||||
// 'int f(char const c)').
|
||||
// get_token_value
|
||||
// A function or functor, which takes an instance of a token
|
||||
// and which should return a readable representation of this
|
||||
// token (i.e. something like 'std::string f(char const c)').
|
||||
//
|
||||
// The structure of the generated xml stream conforms to the DTD given in the
|
||||
// file 'parsetree.dtd'. This file is located in the spirit/tree directory.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <
|
||||
typename CharT, typename TreeNodeT, typename AssocContainerT,
|
||||
typename GetIdT, typename GetValueT
|
||||
>
|
||||
inline void
|
||||
basic_tree_to_xml (std::basic_ostream<CharT> &ostrm, TreeNodeT const &tree,
|
||||
std::basic_string<CharT> const &input_line,
|
||||
AssocContainerT const& id_to_name, GetIdT const &get_token_id,
|
||||
GetValueT const &get_token_value);
|
||||
|
||||
template <typename CharT, typename TreeNodeT, typename AssocContainerT>
|
||||
inline void
|
||||
basic_tree_to_xml (std::basic_ostream<CharT> &ostrm, TreeNodeT const &tree,
|
||||
std::basic_string<CharT> const &input_line,
|
||||
AssocContainerT const& id_to_name);
|
||||
|
||||
template <typename CharT, typename TreeNodeT>
|
||||
inline void
|
||||
basic_tree_to_xml (std::basic_ostream<CharT> &ostrm, TreeNodeT const &tree,
|
||||
std::basic_string<CharT> const &input_line =
|
||||
impl::default_string<CharT>::get());
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <
|
||||
typename TreeNodeT, typename AssocContainerT,
|
||||
typename GetIdT, typename GetValueT
|
||||
>
|
||||
inline void
|
||||
tree_to_xml (std::ostream &ostrm, TreeNodeT const &tree,
|
||||
std::string const &input_line, AssocContainerT const& id_to_name,
|
||||
GetIdT const &get_token_id, GetValueT const &get_token_value)
|
||||
{
|
||||
basic_tree_to_xml<char>(ostrm, tree, input_line, id_to_name,
|
||||
get_token_id, get_token_value);
|
||||
}
|
||||
|
||||
template <typename TreeNodeT, typename AssocContainerT>
|
||||
inline void
|
||||
tree_to_xml (std::ostream &ostrm, TreeNodeT const &tree,
|
||||
std::string const &input_line, AssocContainerT const& id_to_name)
|
||||
{
|
||||
basic_tree_to_xml<char>(ostrm, tree, input_line, id_to_name);
|
||||
}
|
||||
|
||||
template <typename TreeNodeT>
|
||||
inline void
|
||||
tree_to_xml (std::ostream &ostrm, TreeNodeT const &tree,
|
||||
std::string const &input_line = "")
|
||||
{
|
||||
basic_tree_to_xml<char>(ostrm, tree, input_line);
|
||||
}
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}} // namespace BOOST_SPIRIT_CLASSIC_NS
|
||||
|
||||
#include <boost/spirit/home/classic/tree/impl/tree_to_xml.ipp>
|
||||
|
||||
#endif // !defined(TREE_TO_XML_HPP)
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006 Tobias Schwinger
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
#if !defined(BOOST_SPIRIT_TREE_TYPEOF_HPP)
|
||||
#define BOOST_SPIRIT_TREE_TYPEOF_HPP
|
||||
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
|
||||
#include <boost/spirit/home/classic/core/typeof.hpp>
|
||||
|
||||
#include <boost/spirit/home/classic/tree/common_fwd.hpp>
|
||||
#include <boost/spirit/home/classic/tree/parse_tree_fwd.hpp>
|
||||
#include <boost/spirit/home/classic/tree/ast_fwd.hpp>
|
||||
|
||||
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
|
||||
// common.hpp (has forward header)
|
||||
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::tree_node,1)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::node_iter_data,2)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::node_iter_data_factory,1)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::node_val_data_factory,1)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::node_all_val_data_factory,1)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::tree_match,3)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(BOOST_SPIRIT_CLASSIC_NS::tree_policy)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::common_tree_match_policy,4)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::common_tree_tree_policy,2)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::no_tree_gen_node_parser,1)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::leaf_node_parser,1)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::node_parser,2)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(BOOST_SPIRIT_CLASSIC_NS::discard_node_op)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(BOOST_SPIRIT_CLASSIC_NS::reduced_node_op)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(BOOST_SPIRIT_CLASSIC_NS::infix_node_op)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(BOOST_SPIRIT_CLASSIC_NS::discard_first_node_op)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(BOOST_SPIRIT_CLASSIC_NS::discard_last_node_op)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(BOOST_SPIRIT_CLASSIC_NS::inner_node_op)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::action_directive_parser,2)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(BOOST_SPIRIT_CLASSIC_NS::access_match_action)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::access_match_action::action,2)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(BOOST_SPIRIT_CLASSIC_NS::access_node_action)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::access_node_action::action,2)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::tree_parse_info,3)
|
||||
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::node_iter_data,1)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(BOOST_SPIRIT_CLASSIC_NS::node_iter_data_factory<BOOST_SPIRIT_CLASSIC_NS::nil_t>)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(BOOST_SPIRIT_CLASSIC_NS::node_val_data_factory<BOOST_SPIRIT_CLASSIC_NS::nil_t>)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(BOOST_SPIRIT_CLASSIC_NS::node_all_val_data_factory<BOOST_SPIRIT_CLASSIC_NS::nil_t>)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::tree_match,2)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::tree_match,1)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::tree_parse_info,2)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::tree_parse_info,1)
|
||||
|
||||
|
||||
// parse_tree.hpp (has forward header)
|
||||
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::pt_tree_policy,2)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::pt_match_policy,2)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::gen_pt_node_parser,1)
|
||||
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::pt_match_policy,1)
|
||||
|
||||
|
||||
// ast.hpp (has forward header)
|
||||
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::ast_tree_policy,2)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::ast_match_policy,2)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::gen_ast_node_parser,1)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(BOOST_SPIRIT_CLASSIC_NS::root_node_op)
|
||||
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::ast_match_policy,1)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user