1 | /*=============================================================================
|
---|
2 | Copyright (c) 2002-2003 Hartmut Kaiser
|
---|
3 | http://spirit.sourceforge.net/
|
---|
4 |
|
---|
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
|
---|
11 |
|
---|
12 | #include <boost/spirit/meta/impl/fundamental.ipp>
|
---|
13 |
|
---|
14 | namespace boost { namespace spirit
|
---|
15 | {
|
---|
16 | ///////////////////////////////////////////////////////////////////////////
|
---|
17 | //
|
---|
18 | // Helper template for counting the number of nodes contained in a
|
---|
19 | // given parser type.
|
---|
20 | // All parser_category type parsers are counted as nodes.
|
---|
21 | //
|
---|
22 | ///////////////////////////////////////////////////////////////////////////
|
---|
23 | template <typename ParserT>
|
---|
24 | struct node_count {
|
---|
25 |
|
---|
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;
|
---|
29 |
|
---|
30 | BOOST_STATIC_CONSTANT(int, value = count_t::value);
|
---|
31 | };
|
---|
32 |
|
---|
33 | ///////////////////////////////////////////////////////////////////////////
|
---|
34 | //
|
---|
35 | // Helper template for counting the number of leaf nodes contained in a
|
---|
36 | // given parser type.
|
---|
37 | // Only plain_parser_category type parsers are counted as leaf nodes.
|
---|
38 | //
|
---|
39 | ///////////////////////////////////////////////////////////////////////////
|
---|
40 | template <typename ParserT>
|
---|
41 | struct leaf_count {
|
---|
42 |
|
---|
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;
|
---|
46 |
|
---|
47 | BOOST_STATIC_CONSTANT(int, value = count_t::value);
|
---|
48 | };
|
---|
49 |
|
---|
50 | }} // namespace boost::spirit
|
---|
51 |
|
---|
52 | #endif // !defined(BOOST_SPIRIT_FUNDAMENTAL_HPP)
|
---|