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