| 1 | /*============================================================================= |
| 2 | Copyright (c) 2002-2003 Hartmut Kaiser |
| 3 | http://spirit.sourceforge.net/ |
| 4 | |
| 5 | Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 6 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 7 | =============================================================================*/ |
| 8 | #if !defined(BOOST_SPIRIT_FUNDAMENTAL_HPP) |
| 9 | #define BOOST_SPIRIT_FUNDAMENTAL_HPP |
| 10 | |
| 11 | #include <boost/spirit/home/classic/namespace.hpp> |
| 12 | #include <boost/spirit/home/classic/meta/impl/fundamental.ipp> |
| 13 | |
| 14 | namespace boost { namespace spirit { |
| 15 | |
| 16 | BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN |
| 17 | |
| 18 | /////////////////////////////////////////////////////////////////////////// |
| 19 | // |
| 20 | // Helper template for counting the number of nodes contained in a |
| 21 | // given parser type. |
| 22 | // All parser_category type parsers are counted as nodes. |
| 23 | // |
| 24 | /////////////////////////////////////////////////////////////////////////// |
| 25 | template <typename ParserT> |
| 26 | struct node_count { |
| 27 | |
| 28 | typedef typename ParserT::parser_category_t parser_category_t; |
| 29 | typedef typename impl::nodes<parser_category_t> |
| 30 | ::template count<ParserT, mpl::int_<0> > count_t; |
| 31 | |
| 32 | BOOST_STATIC_CONSTANT(int, value = count_t::value); |
| 33 | }; |
| 34 | |
| 35 | /////////////////////////////////////////////////////////////////////////// |
| 36 | // |
| 37 | // Helper template for counting the number of leaf nodes contained in a |
| 38 | // given parser type. |
| 39 | // Only plain_parser_category type parsers are counted as leaf nodes. |
| 40 | // |
| 41 | /////////////////////////////////////////////////////////////////////////// |
| 42 | template <typename ParserT> |
| 43 | struct leaf_count { |
| 44 | |
| 45 | typedef typename ParserT::parser_category_t parser_category_t; |
| 46 | typedef typename impl::leafs<parser_category_t> |
| 47 | ::template count<ParserT, mpl::int_<0> > count_t; |
| 48 | |
| 49 | BOOST_STATIC_CONSTANT(int, value = count_t::value); |
| 50 | }; |
| 51 | |
| 52 | BOOST_SPIRIT_CLASSIC_NAMESPACE_END |
| 53 | |
| 54 | }} // namespace BOOST_SPIRIT_CLASSIC_NS |
| 55 | |
| 56 | #endif // !defined(BOOST_SPIRIT_FUNDAMENTAL_HPP) |
| 57 | |