First public contribution.
1 /*=============================================================================
2 Copyright (c) 2002-2003 Hartmut Kaiser
3 http://spirit.sourceforge.net/
5 Use, modification and distribution is subject to the Boost Software
6 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 http://www.boost.org/LICENSE_1_0.txt)
8 =============================================================================*/
9 #if !defined(BOOST_SPIRIT_FUNDAMENTAL_HPP)
10 #define BOOST_SPIRIT_FUNDAMENTAL_HPP
12 #include <boost/spirit/meta/impl/fundamental.ipp>
14 namespace boost { namespace spirit
16 ///////////////////////////////////////////////////////////////////////////
18 // Helper template for counting the number of nodes contained in a
20 // All parser_category type parsers are counted as nodes.
22 ///////////////////////////////////////////////////////////////////////////
23 template <typename ParserT>
26 typedef typename ParserT::parser_category_t parser_category_t;
27 typedef typename impl::nodes<parser_category_t>
28 ::template count<ParserT, mpl::int_<0> > count_t;
30 BOOST_STATIC_CONSTANT(int, value = count_t::value);
33 ///////////////////////////////////////////////////////////////////////////
35 // Helper template for counting the number of leaf nodes contained in a
37 // Only plain_parser_category type parsers are counted as leaf nodes.
39 ///////////////////////////////////////////////////////////////////////////
40 template <typename ParserT>
43 typedef typename ParserT::parser_category_t parser_category_t;
44 typedef typename impl::leafs<parser_category_t>
45 ::template count<ParserT, mpl::int_<0> > count_t;
47 BOOST_STATIC_CONSTANT(int, value = count_t::value);
50 }} // namespace boost::spirit
52 #endif // !defined(BOOST_SPIRIT_FUNDAMENTAL_HPP)