sl@0: /*============================================================================= sl@0: Copyright (c) 2002-2003 Hartmut Kaiser sl@0: http://spirit.sourceforge.net/ sl@0: sl@0: Use, modification and distribution is subject to the Boost Software sl@0: License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at sl@0: http://www.boost.org/LICENSE_1_0.txt) sl@0: =============================================================================*/ sl@0: #if !defined(BOOST_SPIRIT_FUNDAMENTAL_HPP) sl@0: #define BOOST_SPIRIT_FUNDAMENTAL_HPP sl@0: sl@0: #include sl@0: sl@0: namespace boost { namespace spirit sl@0: { sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // Helper template for counting the number of nodes contained in a sl@0: // given parser type. sl@0: // All parser_category type parsers are counted as nodes. sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: template sl@0: struct node_count { sl@0: sl@0: typedef typename ParserT::parser_category_t parser_category_t; sl@0: typedef typename impl::nodes sl@0: ::template count > count_t; sl@0: sl@0: BOOST_STATIC_CONSTANT(int, value = count_t::value); sl@0: }; sl@0: sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // Helper template for counting the number of leaf nodes contained in a sl@0: // given parser type. sl@0: // Only plain_parser_category type parsers are counted as leaf nodes. sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: template sl@0: struct leaf_count { sl@0: sl@0: typedef typename ParserT::parser_category_t parser_category_t; sl@0: typedef typename impl::leafs sl@0: ::template count > count_t; sl@0: sl@0: BOOST_STATIC_CONSTANT(int, value = count_t::value); sl@0: }; sl@0: sl@0: }} // namespace boost::spirit sl@0: sl@0: #endif // !defined(BOOST_SPIRIT_FUNDAMENTAL_HPP)