diff options
Diffstat (limited to 'boost/spirit/home/classic')
22 files changed, 178 insertions, 941 deletions
diff --git a/boost/spirit/home/classic/core/composite/impl/directives.ipp b/boost/spirit/home/classic/core/composite/impl/directives.ipp index b25b25fdc0..96b2dd79c5 100644 --- a/boost/spirit/home/classic/core/composite/impl/directives.ipp +++ b/boost/spirit/home/classic/core/composite/impl/directives.ipp @@ -151,169 +151,6 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN return s.parse(scan); } -#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - - /////////////////////////////////////////////////////////////////////// - // - // from spirit 1.1 (copyright (c) 2001 Bruce Florman) - // various workarounds to support longest and shortest directives - // - /////////////////////////////////////////////////////////////////////// - template <typename T> - struct is_alternative - { - // Determine at compile time (without partial specialization) - // whether a given type is an instance of the alternative<A,B> - - static T t(); - template <typename A, typename B> - static char test_(alternative<A, B> const&); // no implementation - static int test_(...); // no implementation - enum { r = sizeof(char) == sizeof(test_(t())) }; - typedef mpl::bool_<r> value; - }; - - template <typename T> struct select_to_longest; - - template <typename T> - struct to_longest_alternative - { - typedef typename select_to_longest<T>::result_t result_t; - typedef typename select_to_longest<T>::plain_t plain_t; - typedef typename select_to_longest<T>::choose_t choose_t; - static result_t convert(T const& a); - }; - - template <typename T> - struct to_longest_generic - { - typedef T const& result_t; - typedef T plain_t; - typedef mpl::false_ choose_t; - }; - - template <typename T> - inline T const& - to_longest_convert(T const& a, mpl::false_) - { return a; } - - template <typename T> - struct to_longest_recursive - { - typedef typename to_longest_alternative< - typename T::left_t>::plain_t a_t; - typedef typename to_longest_alternative< - typename T::right_t>::plain_t b_t; - - typedef longest_alternative<a_t, b_t> result_t; - - typedef result_t plain_t; - typedef mpl::true_ choose_t; - }; - - template <typename A, typename B> - inline typename to_longest_alternative<alternative<A, B> >::result_t - to_longest_convert(alternative<A, B> const& alt, mpl::true_) - { - typedef typename to_longest_alternative< - alternative<A, B> >::result_t result_t; - return result_t( - to_longest_alternative<A>::convert(alt.left()), - to_longest_alternative<B>::convert(alt.right())); - } - - template <typename T> - inline typename to_longest_alternative<T>::result_t - to_longest_alternative<T>::convert(T const& a) - { - return to_longest_convert( - a, to_longest_alternative<T>::choose_t()); - } - - template <typename T> - struct select_to_longest - { - typedef typename mpl::if_< - is_alternative<T> // IF - , to_longest_recursive<T> // THEN - , to_longest_generic<T> // ELSE - >::type type; - - typedef typename select_to_longest::type::result_t result_t; - typedef typename select_to_longest::type::plain_t plain_t; - typedef typename select_to_longest::type::choose_t choose_t; - }; - - template <typename T> struct select_to_shortest; - - template <typename T> - struct to_shortest_alternative - { - typedef typename select_to_shortest<T>::result_t result_t; - typedef typename select_to_shortest<T>::plain_t plain_t; - typedef typename select_to_shortest<T>::choose_t choose_t; - static result_t convert(T const& a); - }; - - template <typename T> - struct to_shortest_generic - { - typedef T const& result_t; - typedef T plain_t; - typedef mpl::false_ choose_t; - }; - - template <typename T> - inline T const& - to_shortest_convert(T const& a, mpl::false_) { return a; } - - template <typename T> - struct to_shortest_recursive - { - typedef typename to_shortest_alternative< - typename T::left_t>::plain_t a_t; - typedef typename to_shortest_alternative< - typename T::right_t>::plain_t b_t; - - typedef shortest_alternative<a_t, b_t> result_t; - - typedef result_t plain_t; - typedef mpl::true_ choose_t; - }; - - template <typename A, typename B> - inline typename to_shortest_alternative<alternative<A, B> >::result_t - to_shortest_convert(alternative<A, B> const& alt, mpl::true_) - { - typedef typename to_shortest_alternative< - alternative<A, B> >::result_t result_t; - return result_t( - to_shortest_alternative<A>::convert(alt.left()), - to_shortest_alternative<B>::convert(alt.right())); - } - - template <typename T> - inline typename to_shortest_alternative<T>::result_t - to_shortest_alternative<T>::convert(T const& a) - { - return to_shortest_convert( - a, to_shortest_alternative<T>::choose_t()); - } - - template <typename T> - struct select_to_shortest - { - typedef typename mpl::if_< - is_alternative<T> // IF - , to_shortest_recursive<T> // THEN - , to_shortest_generic<T> // ELSE - >::type type; - - typedef typename select_to_shortest::type::result_t result_t; - typedef typename select_to_shortest::type::plain_t plain_t; - typedef typename select_to_shortest::type::choose_t choose_t; - }; -#else template <typename T> struct to_longest_alternative { @@ -363,7 +200,6 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN to_shortest_alternative<B>::convert(alt.right())); } }; -#endif } BOOST_SPIRIT_CLASSIC_NAMESPACE_END diff --git a/boost/spirit/home/classic/core/non_terminal/grammar.hpp b/boost/spirit/home/classic/core/non_terminal/grammar.hpp index ae7b2658f3..153bc40c3e 100644 --- a/boost/spirit/home/classic/core/non_terminal/grammar.hpp +++ b/boost/spirit/home/classic/core/non_terminal/grammar.hpp @@ -79,7 +79,6 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_END }} // namespace BOOST_SPIRIT_CLASSIC_NS #undef BOOST_SPIRIT_GRAMMAR_ID -#undef BOOST_SPIRIT_GRAMMAR_ACCESS #undef BOOST_SPIRIT_GRAMMAR_STATE #endif diff --git a/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp b/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp index 3b25b3d2e3..b26f534751 100644 --- a/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp +++ b/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp @@ -33,19 +33,6 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN template <typename DerivedT, typename ContextT> struct grammar; -#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) - -BOOST_SPIRIT_DEPENDENT_TEMPLATE_WRAPPER(grammar_definition_wrapper, definition); - -////////////////////////////////// -template <typename GrammarT, typename ScannerT> -struct grammar_definition -{ - typedef typename impl::grammar_definition_wrapper<GrammarT> - ::template result_<ScannerT>::param_t type; -}; - -#else ////////////////////////////////// template <typename GrammarT, typename ScannerT> @@ -54,7 +41,6 @@ struct grammar_definition typedef typename GrammarT::template definition<ScannerT> type; }; -#endif namespace impl { @@ -122,8 +108,7 @@ struct grammar_definition ////////////////////////////////// struct grammartract_helper_list; -#if !defined(BOOST_SPIRIT_SINGLE_GRAMMAR_INSTANCE) \ - && (!defined(__GNUC__) || (__GNUC__ > 2)) +#if !defined(BOOST_SPIRIT_SINGLE_GRAMMAR_INSTANCE) struct grammartract_helper_list { @@ -162,11 +147,7 @@ struct grammar_definition define(grammar_t const* target_grammar) { grammar_helper_list<GrammarT> &helpers = -#if !defined(__GNUC__) || (__GNUC__ > 2) - grammartract_helper_list::do_(target_grammar); -#else - target_grammar->helpers; -#endif + grammartract_helper_list::do_(target_grammar); typename grammar_t::object_id id = target_grammar->get_object_id(); if (definitions.size()<=id) @@ -252,7 +233,6 @@ struct grammar_definition #endif } -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) template <int N> struct call_helper { @@ -263,11 +243,6 @@ struct grammar_definition result = def.template get_start_parser<N>()->parse(scan); } }; -#else - // The grammar_def stuff isn't supported for compilers, which do not - // support partial template specialization - template <int N> struct call_helper; -#endif template <> struct call_helper<0> { @@ -310,14 +285,9 @@ struct grammar_definition typedef typename helper_list_t::vector_t::reverse_iterator iterator_t; helper_list_t& helpers = -# if !defined(__GNUC__) || (__GNUC__ > 2) - grammartract_helper_list::do_(self); -# else - self->helpers; -# endif + grammartract_helper_list::do_(self); -# if (defined(BOOST_MSVC) && (BOOST_MSVC < 1300)) \ - || defined(BOOST_INTEL_CXX_VERSION) +# if defined(BOOST_INTEL_CXX_VERSION) for (iterator_t i = helpers.rbegin(); i != helpers.rend(); ++i) (*i)->undefine(self); # else @@ -383,16 +353,9 @@ struct grammar_definition #endif /////////////////////////////////////// -#if !defined(__GNUC__) || (__GNUC__ > 2) -#define BOOST_SPIRIT_GRAMMAR_ACCESS private: -#else -#define BOOST_SPIRIT_GRAMMAR_ACCESS -#endif - -/////////////////////////////////////// #if !defined(BOOST_SPIRIT_SINGLE_GRAMMAR_INSTANCE) #define BOOST_SPIRIT_GRAMMAR_STATE \ - BOOST_SPIRIT_GRAMMAR_ACCESS \ + private: \ friend struct impl::grammartract_helper_list; \ mutable impl::grammar_helper_list<self_t> helpers; #else diff --git a/boost/spirit/home/classic/core/non_terminal/impl/subrule.ipp b/boost/spirit/home/classic/core/non_terminal/impl/subrule.ipp index 4651cc31ec..f6bdaaf40d 100644 --- a/boost/spirit/home/classic/core/non_terminal/impl/subrule.ipp +++ b/boost/spirit/home/classic/core/non_terminal/impl/subrule.ipp @@ -22,76 +22,6 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN namespace impl { - #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - - template <int N, typename ListT> - struct get_subrule; - - template <int N, typename ListT> - struct get_subrule_chooser - { - static ListT t(); - static char test(nil_t); - static int test(...); - - // Set value to - // 0: ListT is empty - // 1: ListT's first item has same ID - // 2: ListT's first item has a different ID - - enum - { - id = ListT::first_t::id, - is_same_id = N == id, - is_nil_t = sizeof(char) == sizeof(test(t())), - value = is_nil_t ? 0 : (is_same_id ? 1 : 2) - }; - }; - - template <int N> - struct subrule_chooser; - - template <> - struct subrule_chooser<0> - { - // First case. ListT is empty - - template <int N, typename ListT> - struct result - { typedef nil_t type; }; - }; - - template <> - struct subrule_chooser<1> - { - // Second case. ListT is non-empty and the list's - // first item has the ID we are looking for. - - template <int N, typename ListT> - struct result - { typedef typename ListT::first_t::def_t type; }; - }; - - template <> - struct subrule_chooser<2> - { - // Third case. ListT is non-empty but the list's - // first item does not have the ID we are looking for. - - template <int N, typename ListT> - struct result - { typedef typename get_subrule<N, ListT::rest_t>::type type; }; - }; - - template <int N, typename ListT> - struct get_subrule - { - enum { n = get_subrule_chooser<N, ListT>::value }; - typedef typename subrule_chooser<n>::template - result<N, ListT>::type type; - }; - - #else template <int N, typename ListT> struct get_subrule @@ -122,7 +52,6 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN typedef nil_t type; }; - #endif template <typename T1, typename T2> struct get_result_t { diff --git a/boost/spirit/home/classic/core/non_terminal/rule.hpp b/boost/spirit/home/classic/core/non_terminal/rule.hpp index e905689431..1d4336bcc9 100644 --- a/boost/spirit/home/classic/core/non_terminal/rule.hpp +++ b/boost/spirit/home/classic/core/non_terminal/rule.hpp @@ -15,7 +15,7 @@ // Spirit predefined maximum number of simultaneously usable different // scanner types. // -// This limit defines the maximum number of of possible different scanner +// This limit defines the maximum number of possible different scanner // types for which a specific rule<> may be used. If this isn't defined, a // rule<> may be used with one scanner type only (multiple scanner support // is disabled). diff --git a/boost/spirit/home/classic/core/primitives/impl/primitives.ipp b/boost/spirit/home/classic/core/primitives/impl/primitives.ipp index 152e5b11be..8a52251ac6 100644 --- a/boost/spirit/home/classic/core/primitives/impl/primitives.ipp +++ b/boost/spirit/home/classic/core/primitives/impl/primitives.ipp @@ -10,21 +10,12 @@ #if !defined(BOOST_SPIRIT_PRIMITIVES_IPP) #define BOOST_SPIRIT_PRIMITIVES_IPP -// This should eventually go to a config file. -#if defined(__GNUC__) && (__GNUC__ < 3) && !defined(_STLPORT_VERSION) -# ifndef BOOST_SPIRIT_NO_CHAR_TRAITS -# define BOOST_SPIRIT_NO_CHAR_TRAITS -# endif -#endif - #include <cctype> #if !defined(BOOST_NO_CWCTYPE) #include <cwctype> #endif -#ifndef BOOST_SPIRIT_NO_CHAR_TRAITS -# include <string> // char_traits -#endif +#include <string> // char_traits #if defined(BOOST_MSVC) # pragma warning (push) @@ -79,80 +70,6 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN // /////////////////////////////////////////////////////////////////////////// -#ifndef BOOST_SPIRIT_NO_CHAR_TRAITS -# define BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE std -#else - - template <typename CharT> - struct char_traits - { - typedef CharT int_type; - typedef CharT char_type; - }; - - template<> - struct char_traits<char> - { - typedef int int_type; - typedef char char_type; - - static char_type - to_char_type(int_type c) - { - return static_cast<char_type>(c); - } - - static int - to_int_type(char c) - { - return static_cast<unsigned char>(c); - } - }; - - template<> - struct char_traits<unsigned char> - { - typedef int int_type; - typedef unsigned char char_type; - - static char_type - to_char_type(int_type c) - { - return static_cast<char_type>(c); - } - - static int - to_int_type(unsigned char c) - { - return c; - } - }; - -# define BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE impl -# ifndef BOOST_NO_CWCTYPE - - template<> - struct char_traits<wchar_t> - { - typedef wint_t int_type; - typedef wchar_t char_type; - - static char_type - to_char_type(int_type c) - { - return static_cast<char_type>(c); - } - - static wint_t - to_int_type(wchar_t c) - { - return c; - } - }; - -# endif -#endif // BOOST_SPIRIT_NO_CHAR_TRAITS - // Use char_traits for char and wchar_t only, as these are the only // specializations provided in the standard. Other types are on their // own. @@ -182,19 +99,16 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN struct char_type_char_traits_helper { typedef CharT char_type; - typedef typename BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE - ::char_traits<CharT>::int_type int_type; + typedef typename std::char_traits<CharT>::int_type int_type; static int_type to_int_type(CharT c) { - return BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE - ::char_traits<CharT>::to_int_type(c); + return std::char_traits<CharT>::to_int_type(c); } static char_type to_char_type(int_type i) { - return BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE - ::char_traits<CharT>::to_char_type(i); + return std::char_traits<CharT>::to_char_type(i); } }; diff --git a/boost/spirit/home/classic/dynamic/impl/conditions.ipp b/boost/spirit/home/classic/dynamic/impl/conditions.ipp index 713958463c..3a7b530eb2 100644 --- a/boost/spirit/home/classic/dynamic/impl/conditions.ipp +++ b/boost/spirit/home/classic/dynamic/impl/conditions.ipp @@ -36,13 +36,6 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN typedef typename T::embed_t type; }; -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - template <> struct embed_t_accessor<int> - { - typedef int type; - }; -#endif - template <typename ConditionT> struct condition_parser_selector { diff --git a/boost/spirit/home/classic/dynamic/impl/switch.ipp b/boost/spirit/home/classic/dynamic/impl/switch.ipp index ffaa3ebb8b..b881f9d121 100644 --- a/boost/spirit/home/classic/dynamic/impl/switch.ipp +++ b/boost/spirit/home/classic/dynamic/impl/switch.ipp @@ -410,7 +410,7 @@ struct parse_switch; return delegate_parse( \ chain_parser< \ case_chain<ParserT>::depth, ParserT \ - >::left(p), scan, save); \ + >::left(p), scan, save); \ \ BOOST_PP_REPEAT_FROM_TO_ ## z(1, BOOST_PP_INC(N), \ BOOST_SPIRIT_PARSE_SWITCH_CASES, _) \ diff --git a/boost/spirit/home/classic/dynamic/stored_rule.hpp b/boost/spirit/home/classic/dynamic/stored_rule.hpp index 5661ef8855..5248ba18fa 100644 --- a/boost/spirit/home/classic/dynamic/stored_rule.hpp +++ b/boost/spirit/home/classic/dynamic/stored_rule.hpp @@ -101,17 +101,11 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN friend class impl::rule_base_access; friend class stored_rule<T0, T1, T2, !EmbedByValue>; -#if defined(__GNUC__) && (__GNUC__ < 3) - public: -#endif abstract_parser_t* get() const { return ptr.get(); } -#if defined(__GNUC__) && (__GNUC__ < 3) - private: -#endif stored_rule(shared_ptr<abstract_parser_t> const& ptr) : ptr(ptr) {} diff --git a/boost/spirit/home/classic/iterator/impl/file_iterator.ipp b/boost/spirit/home/classic/iterator/impl/file_iterator.ipp index 4227b69665..0fb92c72a3 100644 --- a/boost/spirit/home/classic/iterator/impl/file_iterator.ipp +++ b/boost/spirit/home/classic/iterator/impl/file_iterator.ipp @@ -285,11 +285,7 @@ public: } private: -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION typedef boost::remove_pointer<HANDLE>::type handle_t; -#else - typedef void handle_t; -#endif boost::shared_ptr<CharT> m_mem; std::size_t m_filesize; diff --git a/boost/spirit/home/classic/iterator/multi_pass.hpp b/boost/spirit/home/classic/iterator/multi_pass.hpp index ec8e01c976..fd9482ef31 100644 --- a/boost/spirit/home/classic/iterator/multi_pass.hpp +++ b/boost/spirit/home/classic/iterator/multi_pass.hpp @@ -194,7 +194,7 @@ class buf_id_check } // called to verify that everything is okay. - void check() const + void check_if_valid() const { if (buf_id != *shared_buf_id) { @@ -226,7 +226,7 @@ class no_check no_check(no_check const&) {} void destroy() {} void swap(no_check&) {} - void check() const {} + void check_if_valid() const {} void clear_queue() {} }; @@ -1000,7 +1000,7 @@ reference multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy>:: operator*() const { - CHP::check(); + CHP::check_if_valid(); return SP::dereference(*this); } @@ -1034,7 +1034,7 @@ multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy>& multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy>:: operator++() { - CHP::check(); + CHP::check_if_valid(); SP::increment(*this); return *this; } diff --git a/boost/spirit/home/classic/meta/impl/fundamental.ipp b/boost/spirit/home/classic/meta/impl/fundamental.ipp index 798f22b61a..7b1d1aa669 100644 --- a/boost/spirit/home/classic/meta/impl/fundamental.ipp +++ b/boost/spirit/home/classic/meta/impl/fundamental.ipp @@ -15,10 +15,6 @@ namespace boost { namespace spirit { BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN -#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) - BOOST_SPIRIT_DEPENDENT_TEMPLATE_WRAPPER2(count_wrapper, count); -#endif // defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) - namespace impl { /////////////////////////////////////////////////////////////////////////// @@ -42,68 +38,6 @@ namespace impl }; }; -#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) - - template <> - struct nodes<unary_parser_category> { - - template <typename ParserT, typename LeafCountT> - struct count { - - typedef typename ParserT::subject_t subject_t; - typedef typename subject_t::parser_category_t subject_category_t; - - typedef nodes<subject_category_t> nodes_t; - typedef typename count_wrapper<nodes_t> - ::template result_<subject_t, LeafCountT> count_t; - - BOOST_STATIC_CONSTANT(int, value = count_t::value + 1); - }; - }; - - template <> - struct nodes<action_parser_category> { - - template <typename ParserT, typename LeafCountT> - struct count { - - typedef typename ParserT::subject_t subject_t; - typedef typename subject_t::parser_category_t subject_category_t; - - typedef nodes<subject_category_t> nodes_t; - typedef typename count_wrapper<nodes_t> - ::template result_<subject_t, LeafCountT> count_t; - - BOOST_STATIC_CONSTANT(int, value = count_t::value + 1); - }; - }; - - template <> - struct nodes<binary_parser_category> { - - template <typename ParserT, typename LeafCountT> - struct count { - - typedef typename ParserT::left_t left_t; - typedef typename ParserT::right_t right_t; - typedef typename left_t::parser_category_t left_category_t; - typedef typename right_t::parser_category_t right_category_t; - - typedef nodes<left_category_t> left_nodes_t; - typedef typename count_wrapper<left_nodes_t> - ::template result_<left_t, LeafCountT> left_count_t; - - typedef nodes<right_category_t> right_nodes_t; - typedef typename count_wrapper<right_nodes_t> - ::template result_<right_t, LeafCountT> right_count_t; - - BOOST_STATIC_CONSTANT(int, - value = (left_count_t::value + right_count_t::value + 1)); - }; - }; - -#else - template <> struct nodes<unary_parser_category> { @@ -158,8 +92,6 @@ namespace impl }; }; -#endif - /////////////////////////////////////////////////////////////////////////// // // Helper template for counting the number of leaf nodes contained in a @@ -181,68 +113,6 @@ namespace impl }; }; -#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) - - template <> - struct leafs<unary_parser_category> { - - template <typename ParserT, typename LeafCountT> - struct count { - - typedef typename ParserT::subject_t subject_t; - typedef typename subject_t::parser_category_t subject_category_t; - - typedef leafs<subject_category_t> nodes_t; - typedef typename count_wrapper<nodes_t> - ::template result_<subject_t, LeafCountT> count_t; - - BOOST_STATIC_CONSTANT(int, value = count_t::value); - }; - }; - - template <> - struct leafs<action_parser_category> { - - template <typename ParserT, typename LeafCountT> - struct count { - - typedef typename ParserT::subject_t subject_t; - typedef typename subject_t::parser_category_t subject_category_t; - - typedef leafs<subject_category_t> nodes_t; - typedef typename count_wrapper<nodes_t> - ::template result_<subject_t, LeafCountT> count_t; - - BOOST_STATIC_CONSTANT(int, value = count_t::value); - }; - }; - - template <> - struct leafs<binary_parser_category> { - - template <typename ParserT, typename LeafCountT> - struct count { - - typedef typename ParserT::left_t left_t; - typedef typename ParserT::right_t right_t; - typedef typename left_t::parser_category_t left_category_t; - typedef typename right_t::parser_category_t right_category_t; - - typedef leafs<left_category_t> left_nodes_t; - typedef typename count_wrapper<left_nodes_t> - ::template result_<left_t, LeafCountT> left_count_t; - - typedef leafs<right_category_t> right_nodes_t; - typedef typename count_wrapper<right_nodes_t> - ::template result_<right_t, LeafCountT> right_count_t; - - BOOST_STATIC_CONSTANT(int, - value = (left_count_t::value + right_count_t::value)); - }; - }; - -#else - template <> struct leafs<unary_parser_category> { @@ -297,8 +167,6 @@ namespace impl }; }; -#endif - } // namespace impl /////////////////////////////////////////////////////////////////////////////// diff --git a/boost/spirit/home/classic/meta/impl/parser_traits.ipp b/boost/spirit/home/classic/meta/impl/parser_traits.ipp index e648acd4d0..846a58b75f 100644 --- a/boost/spirit/home/classic/meta/impl/parser_traits.ipp +++ b/boost/spirit/home/classic/meta/impl/parser_traits.ipp @@ -21,80 +21,6 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN namespace impl { -#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - - /////////////////////////////////////////////////////////////////////////// - // - // from spirit 1.1 (copyright (c) 2001 Bruce Florman) - // various workarounds to support compile time decisions without partial - // template specialization whether a given type is an instance of a - // concrete parser type. - // - /////////////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////////////// - template <typename T> - struct parser_type_traits - { - // Determine at compile time (without partial specialization) - // whether a given type is an instance of the alternative<A,B> - - static T t(); - - typedef struct { char dummy[1]; } size1_t; - typedef struct { char dummy[2]; } size2_t; - typedef struct { char dummy[3]; } size3_t; - typedef struct { char dummy[4]; } size4_t; - typedef struct { char dummy[5]; } size5_t; - typedef struct { char dummy[6]; } size6_t; - typedef struct { char dummy[7]; } size7_t; - typedef struct { char dummy[8]; } size8_t; - typedef struct { char dummy[9]; } size9_t; - typedef struct { char dummy[10]; } size10_t; - - // the following functions need no implementation - template <typename A, typename B> - static size1_t test_(alternative<A, B> const&); - template <typename A, typename B> - static size2_t test_(sequence<A, B> const&); - template <typename A, typename B> - static size3_t test_(sequential_or<A, B> const&); - template <typename A, typename B> - static size4_t test_(intersection<A, B> const&); - template <typename A, typename B> - static size5_t test_(difference<A, B> const&); - template <typename A, typename B> - static size6_t test_(exclusive_or<A, B> const&); - template <typename S> - static size7_t test_(optional<S> const&); - template <typename S> - static size8_t test_(kleene_star<S> const&); - template <typename S> - static size9_t test_(positive<S> const&); - - static size10_t test_(...); - - BOOST_STATIC_CONSTANT(bool, - is_alternative = (sizeof(size1_t) == sizeof(test_(t()))) ); - BOOST_STATIC_CONSTANT(bool, - is_sequence = (sizeof(size2_t) == sizeof(test_(t()))) ); - BOOST_STATIC_CONSTANT(bool, - is_sequential_or = (sizeof(size3_t) == sizeof(test_(t()))) ); - BOOST_STATIC_CONSTANT(bool, - is_intersection = (sizeof(size4_t) == sizeof(test_(t()))) ); - BOOST_STATIC_CONSTANT(bool, - is_difference = (sizeof(size5_t) == sizeof(test_(t()))) ); - BOOST_STATIC_CONSTANT(bool, - is_exclusive_or = (sizeof(size6_t) == sizeof(test_(t()))) ); - BOOST_STATIC_CONSTANT(bool, - is_optional = (sizeof(size7_t) == sizeof(test_(t()))) ); - BOOST_STATIC_CONSTANT(bool, - is_kleene_star = (sizeof(size8_t) == sizeof(test_(t()))) ); - BOOST_STATIC_CONSTANT(bool, - is_positive = (sizeof(size9_t) == sizeof(test_(t()))) ); - }; - -#else /////////////////////////////////////////////////////////////////////////// struct parser_type_traits_base { @@ -180,7 +106,6 @@ namespace impl BOOST_STATIC_CONSTANT(bool, is_positive = true); }; -#endif // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) } // namespace impl /////////////////////////////////////////////////////////////////////////////// diff --git a/boost/spirit/home/classic/phoenix/special_ops.hpp b/boost/spirit/home/classic/phoenix/special_ops.hpp index 7fc2f6d78d..4a007b23ae 100644 --- a/boost/spirit/home/classic/phoenix/special_ops.hpp +++ b/boost/spirit/home/classic/phoenix/special_ops.hpp @@ -79,31 +79,6 @@ template <typename T> struct rank<PHOENIX_STD::complex<T> > // specializations for std::istream // /////////////////////////////////////////////////////////////////////////////// -#if defined(__GNUC__) && (__GNUC__ < 3) - #if defined(_STLPORT_VERSION) - #define PHOENIX_ISTREAM _IO_istream_withassign - #else - #define PHOENIX_ISTREAM PHOENIX_STD::_IO_istream_withassign - #endif -#else -// #if (defined(__ICL) && defined(_STLPORT_VERSION)) -// #define PHOENIX_ISTREAM istream_withassign -// #else - #define PHOENIX_ISTREAM PHOENIX_STD::istream -// #endif -#endif - -////////////////////////////////// -#if defined(__GNUC__) && (__GNUC__ < 3) -// || (defined(__ICL) && defined(_STLPORT_VERSION)) -template <typename T1> -struct binary_operator<shift_r_op, PHOENIX_ISTREAM, T1> -{ - typedef PHOENIX_STD::istream& result_type; - static result_type eval(PHOENIX_STD::istream& out, T1& rhs) - { return out >> rhs; } -}; -#endif ////////////////////////////////// template <typename T1> @@ -117,45 +92,19 @@ struct binary_operator<shift_r_op, PHOENIX_STD::istream, T1> ////////////////////////////////// template <typename BaseT> inline typename impl::make_binary3 - <shift_r_op, variable<PHOENIX_ISTREAM>, BaseT>::type -operator>>(PHOENIX_ISTREAM& _0, actor<BaseT> const& _1) + <shift_r_op, variable<PHOENIX_STD::istream>, BaseT>::type +operator>>(PHOENIX_STD::istream& _0, actor<BaseT> const& _1) { return impl::make_binary3 - <shift_r_op, variable<PHOENIX_ISTREAM>, BaseT> + <shift_r_op, variable<PHOENIX_STD::istream>, BaseT> ::construct(var(_0), _1); } -#undef PHOENIX_ISTREAM /////////////////////////////////////////////////////////////////////////////// // // specializations for std::ostream // /////////////////////////////////////////////////////////////////////////////// -#if defined(__GNUC__) && (__GNUC__ < 3) - #if defined(_STLPORT_VERSION) - #define PHOENIX_OSTREAM _IO_ostream_withassign - #else - #define PHOENIX_OSTREAM PHOENIX_STD::_IO_ostream_withassign - #endif -#else -// #if (defined(__ICL) && defined(_STLPORT_VERSION)) -// #define PHOENIX_OSTREAM ostream_withassign -// #else - #define PHOENIX_OSTREAM PHOENIX_STD::ostream -// #endif -#endif - -////////////////////////////////// -#if defined(__GNUC__) && (__GNUC__ < 3) -// || (defined(__ICL) && defined(_STLPORT_VERSION)) -template <typename T1> -struct binary_operator<shift_l_op, PHOENIX_OSTREAM, T1> -{ - typedef PHOENIX_STD::ostream& result_type; - static result_type eval(PHOENIX_STD::ostream& out, T1 const& rhs) - { return out << rhs; } -}; -#endif ////////////////////////////////// template <typename T1> @@ -169,16 +118,14 @@ struct binary_operator<shift_l_op, PHOENIX_STD::ostream, T1> ////////////////////////////////// template <typename BaseT> inline typename impl::make_binary3 - <shift_l_op, variable<PHOENIX_OSTREAM>, BaseT>::type -operator<<(PHOENIX_OSTREAM& _0, actor<BaseT> const& _1) + <shift_l_op, variable<PHOENIX_STD::ostream>, BaseT>::type +operator<<(PHOENIX_STD::ostream& _0, actor<BaseT> const& _1) { return impl::make_binary3 - <shift_l_op, variable<PHOENIX_OSTREAM>, BaseT> + <shift_l_op, variable<PHOENIX_STD::ostream>, BaseT> ::construct(var(_0), _1); } -#undef PHOENIX_OSTREAM - /////////////////////////////////////////////////////////////////////////////// // // specializations for std::strstream / stringstream @@ -228,8 +175,6 @@ operator<<(PHOENIX_STD::PHOENIX_SSTREAM& _0, actor<BaseT> const& _1) // I/O manipulator specializations // /////////////////////////////////////////////////////////////////////////////// -#if (!defined(__GNUC__) || (__GNUC__ > 2)) -// && !(defined(__ICL) && defined(_STLPORT_VERSION)) typedef PHOENIX_STD::ios_base& (*iomanip_t)(PHOENIX_STD::ios_base&); typedef PHOENIX_STD::istream& (*imanip_t)(PHOENIX_STD::istream&); @@ -300,7 +245,6 @@ operator<<(actor<BaseT> const& _0, iomanip_t _1) } #endif // __BORLANDC__ -#endif // !defined(__GNUC__) || (__GNUC__ > 2) /////////////////////////////////////////////////////////////////////////////// // diff --git a/boost/spirit/home/classic/phoenix/statements.hpp b/boost/spirit/home/classic/phoenix/statements.hpp index 25e6b1dd45..7726a99d4b 100644 --- a/boost/spirit/home/classic/phoenix/statements.hpp +++ b/boost/spirit/home/classic/phoenix/statements.hpp @@ -86,7 +86,7 @@ operator,(actor<BaseT0> const& _0, actor<BaseT1> const& _1) // is true, the true_statement (again an actor) is executed // otherwise, the false_statement (another actor) is executed. The // result type of this is void. Note the trailing underscore after -// if_ and the the leading dot and the trailing underscore before +// if_ and the leading dot and the trailing underscore before // and after .else_. // /////////////////////////////////////////////////////////////////////////////// diff --git a/boost/spirit/home/classic/phoenix/tuples.hpp b/boost/spirit/home/classic/phoenix/tuples.hpp index 50cec6bf3f..a52b4e1118 100644 --- a/boost/spirit/home/classic/phoenix/tuples.hpp +++ b/boost/spirit/home/classic/phoenix/tuples.hpp @@ -8,10 +8,6 @@ #ifndef PHOENIX_TUPLES_HPP #define PHOENIX_TUPLES_HPP -#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) -#error "Sorry, Phoenix does not support VC6 and VC7. Please upgrade to at least VC7.1" -#endif - /////////////////////////////////////////////////////////////////////////////// // // Phoenix predefined maximum limit. This limit defines the maximum diff --git a/boost/spirit/home/classic/tree/common.hpp b/boost/spirit/home/classic/tree/common.hpp index f25d4915ef..c086ff48d5 100644 --- a/boost/spirit/home/classic/tree/common.hpp +++ b/boost/spirit/home/classic/tree/common.hpp @@ -520,9 +520,6 @@ namespace impl { // as Koenig lookup rules will find only the classname::swap // member function not the global declaration, so use cp_swap // as a forwarding function (JM): -#if __GNUC__ == 2 - using ::std::swap; -#endif template <typename T> inline void cp_swap(T& t1, T& t2) { diff --git a/boost/spirit/home/classic/tree/impl/tree_to_xml.ipp b/boost/spirit/home/classic/tree/impl/tree_to_xml.ipp index 2f0da8bf44..36b7e10192 100644 --- a/boost/spirit/home/classic/tree/impl/tree_to_xml.ipp +++ b/boost/spirit/home/classic/tree/impl/tree_to_xml.ipp @@ -21,6 +21,7 @@ #include <iostream> #include <boost/config.hpp> #include <boost/assert.hpp> +#include <boost/scoped_array.hpp> #ifdef BOOST_NO_STRINGSTREAM #include <strstream> @@ -68,7 +69,7 @@ namespace impl { { using namespace std; // some systems have size_t in ns std size_t len = strlen(source); - std::auto_ptr<wchar_t> result (new wchar_t[len+1]); + boost::scoped_array<wchar_t> result (new wchar_t[len+1]); result.get()[len] = '\0'; // working with wide character streams is supported only if the diff --git a/boost/spirit/home/classic/utility/grammar_def.hpp b/boost/spirit/home/classic/utility/grammar_def.hpp index 6ddfcab647..bc9b11f993 100644 --- a/boost/spirit/home/classic/utility/grammar_def.hpp +++ b/boost/spirit/home/classic/utility/grammar_def.hpp @@ -26,7 +26,7 @@ /////////////////////////////////////////////////////////////////////////////// // // Spirit predefined maximum grammar start parser limit. This limit defines -// the maximum number of of possible different parsers exposed from a +// the maximum number of possible different parsers exposed from a // particular grammar. This number defaults to 3. // The actual maximum is rounded up in multiples of 3. Thus, if this value // is 4, the actual limit is 6. The ultimate maximum limit in this diff --git a/boost/spirit/home/classic/utility/impl/chset.ipp b/boost/spirit/home/classic/utility/impl/chset.ipp index 3017035106..6e2130b222 100644 --- a/boost/spirit/home/classic/utility/impl/chset.ipp +++ b/boost/spirit/home/classic/utility/impl/chset.ipp @@ -71,38 +71,6 @@ namespace utility { namespace impl { } } - ////////////////////////////////// - -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) - - template <typename CharT, typename FakeT> - void chset_negated_set(boost::shared_ptr<basic_chset<CharT> > &ptr, chlit<CharT> const &ch, - FakeT) - { - if(ch.ch != (std::numeric_limits<CharT>::min)()) { - ptr->set((std::numeric_limits<CharT>::min)(), ch.ch - 1); - } - if(ch.ch != (std::numeric_limits<CharT>::max)()) { - ptr->set(ch.ch + 1, (std::numeric_limits<CharT>::max)()); - } - } - - template <typename CharT, typename FakeT> - void chset_negated_set(boost::shared_ptr<basic_chset<CharT> > &ptr, - spirit::range<CharT> const &rng, FakeT) - { - if(rng.first != (std::numeric_limits<CharT>::min)()) { - ptr->set((std::numeric_limits<CharT>::min)(), rng.first - 1); - } - if(rng.last != (std::numeric_limits<CharT>::max)()) { - ptr->set(rng.last + 1, (std::numeric_limits<CharT>::max)()); - } - } - -#endif // BOOST_WORKAROUND(BOOST_MSVC, < 1300) - -////////////////////////////////// - }} // namespace utility::impl template <typename CharT> @@ -142,8 +110,6 @@ inline chset<CharT>::chset(range<CharT> const& arg_) : ptr(new basic_chset<CharT>()) { ptr->set(arg_.first, arg_.last); } -#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) - template <typename CharT> inline chset<CharT>::chset(negated_char_parser<chlit<CharT> > const& arg_) : ptr(new basic_chset<CharT>()) @@ -158,8 +124,6 @@ inline chset<CharT>::chset(negated_char_parser<range<CharT> > const& arg_) set(arg_); } -#endif // !BOOST_WORKAROUND(BOOST_MSVC, < 1300) - template <typename CharT> inline chset<CharT>::~chset() {} @@ -218,8 +182,6 @@ chset<CharT>::operator=(range<CharT> const& rhs) return *this; } -#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) - template <typename CharT> inline chset<CharT>& chset<CharT>::operator=(negated_char_parser<chlit<CharT> > const& rhs) @@ -238,8 +200,6 @@ chset<CharT>::operator=(negated_char_parser<range<CharT> > const& rhs) return *this; } -#endif // !BOOST_WORKAROUND(BOOST_MSVC, < 1300) - template <typename CharT> inline void chset<CharT>::set(range<CharT> const& arg_) @@ -248,8 +208,6 @@ chset<CharT>::set(range<CharT> const& arg_) ptr->set(arg_.first, arg_.last); } -#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) - template <typename CharT> inline void chset<CharT>::set(negated_char_parser<chlit<CharT> > const& arg_) @@ -278,8 +236,6 @@ chset<CharT>::set(negated_char_parser<range<CharT> > const& arg_) } } -#endif // !BOOST_WORKAROUND(BOOST_MSVC, < 1300) - template <typename CharT> inline void chset<CharT>::clear(range<CharT> const& arg_) diff --git a/boost/spirit/home/classic/utility/impl/chset_operators.ipp b/boost/spirit/home/classic/utility/impl/chset_operators.ipp index 4319c9b2a8..842a679d6d 100644 --- a/boost/spirit/home/classic/utility/impl/chset_operators.ipp +++ b/boost/spirit/home/classic/utility/impl/chset_operators.ipp @@ -285,78 +285,6 @@ operator^(chlit<CharT> const& a, chset<CharT> const& b) return chset<CharT>(a.ch) ^ b; } -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) - -/////////////////////////////////////////////////////////////////////////////// -// -// negated_char_parser <--> chset free operators implementation -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CharT, typename ParserT> -inline chset<CharT> -operator|(chset<CharT> const& a, negated_char_parser<ParserT> const& b) -{ - return a | chset<CharT>(b); -} - -////////////////////////////////// -template <typename CharT, typename ParserT> -inline chset<CharT> -operator&(chset<CharT> const& a, negated_char_parser<ParserT> const& b) -{ - return a & chset<CharT>(b); -} - -////////////////////////////////// -template <typename CharT, typename ParserT> -inline chset<CharT> -operator-(chset<CharT> const& a, negated_char_parser<ParserT> const& b) -{ - return a - chset<CharT>(b); -} - -////////////////////////////////// -template <typename CharT, typename ParserT> -inline chset<CharT> -operator^(chset<CharT> const& a, negated_char_parser<ParserT> const& b) -{ - return a ^ chset<CharT>(b); -} - -////////////////////////////////// -template <typename CharT, typename ParserT> -inline chset<CharT> -operator|(negated_char_parser<ParserT> const& a, chset<CharT> const& b) -{ - return chset<CharT>(a) | b; -} - -////////////////////////////////// -template <typename CharT, typename ParserT> -inline chset<CharT> -operator&(negated_char_parser<ParserT> const& a, chset<CharT> const& b) -{ - return chset<CharT>(a) & b; -} - -////////////////////////////////// -template <typename CharT, typename ParserT> -inline chset<CharT> -operator-(negated_char_parser<ParserT> const& a, chset<CharT> const& b) -{ - return chset<CharT>(a) - b; -} - -////////////////////////////////// -template <typename CharT, typename ParserT> -inline chset<CharT> -operator^(negated_char_parser<ParserT> const& a, chset<CharT> const& b) -{ - return chset<CharT>(a) ^ b; -} - -#else // BOOST_WORKAROUND(BOOST_MSVC, < 1300) - /////////////////////////////////////////////////////////////////////////////// // // negated_char_parser<range> <--> chset free operators implementation @@ -493,8 +421,6 @@ operator^(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b) return chset<CharT>(a) ^ b; } -#endif // BOOST_WORKAROUND(BOOST_MSVC, < 1300) - /////////////////////////////////////////////////////////////////////////////// // // anychar_parser <--> chset free operators diff --git a/boost/spirit/home/classic/utility/rule_parser.hpp b/boost/spirit/home/classic/utility/rule_parser.hpp index 9cacb49940..08aba694f5 100644 --- a/boost/spirit/home/classic/utility/rule_parser.hpp +++ b/boost/spirit/home/classic/utility/rule_parser.hpp @@ -16,7 +16,7 @@ // // Using a typeof operator or Boost.Typeof to automatically set the type of // variables (as done in the Spirit example demonstrating typeof) is by far not -// all we can do to tighten up our grammars as there are some significant +// all we can do to tighten up our grammars as there are some significant // drawbacks of this approach: // - the types complexity scales with the complexity of the grammar (sooner or // later hitting the limits of the compiler), @@ -32,242 +32,242 @@ // In practice manually applying this technique leads to rather lengthy code and // overthis requires the user to have a solid understanding of Spirit details. // -// Here is a generalized, macro-based approach to easily create typeof-based +// Here is a generalized, macro-based approach to easily create typeof-based // grammars that can be recursive and arbitrarily complex. // // // Quick manual: // ============ -// +// // 1. Setup -// -// Before the rule parser macro (the protagonist of the facility) can be used -// the the user must define the macro BOOST_SPIRIT__NAMESPACE (note the double +// +// Before the rule parser macro (the protagonist of the facility) can be used +// the user must define the macro BOOST_SPIRIT__NAMESPACE (note the double // underscore characeter) and setup a registration group for Boost.Typeof. -// +// // Examples: -// +// // // should come after regular #includeS // #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() -// +// // // [...] -// +// // #define BOOST_SPIRIT__NAMESPACE (2,(my_project, my_module)) // // | | +- outer +- inner // // ! space ! -+ | namespace namespace // // | // // +--- number of nested namespaces -// +// // namespace my_project { namespace my_module { -// +// // // [...] -// +// // --- -// +// // // should come after regular #includeS // #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() -// +// // // [...] -// +// // #define BOOST_SPIRIT__NAMESPACE (2,(my_project, (anonymous) )) -// +// // namespace my_project { namespace { -// +// // // [...] -// +// // --- -// +// // // should come after regular #includeS // #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() -// +// // // [...] -// -// +// +// // #define BOOST_SPIRIT__NAMESPACE - // // we're working at root namespace -// -// +// +// // Why do I have to do this? -// +// // Boost.Typeof needs to assign a unique ID for each registration. This ID is -// created composed of the line number and the registration group. The +// created composed of the line number and the registration group. The // facility performs Typeof registration and thus requires the source file to // have its own registration group. Further Boost.Typeof requires registration // to happen at root namespace so we have to close and reopen the namespace // we're in. // -// +// // 2. The rule parser macro -// +// // A simple rule parser definition looks like that: -// +// // // we're at namespace scope here -// +// // // Skip parser for C/C++ comments and whitespace -// BOOST_SPIRIT_RULE_PARSER(skipper, -// -,-,-, -// -// +( confix_p("//",*anychar_p,eol_p) +// BOOST_SPIRIT_RULE_PARSER(skipper, +// -,-,-, +// +// +( confix_p("//",*anychar_p,eol_p) // | confix_p("/*",*anychar_p,"*/") -// | space_p +// | space_p // ) // ) -// +// // Now we can use 'skipper' in other Spirit expressions. -// -// The code above creates a parser (template) class 'skpper_t' and (in this -// case, because there are no parameters) a static const instance 'skipper' of +// +// The code above creates a parser (template) class 'skpper_t' and (in this +// case, because there are no parameters) a static const instance 'skipper' of // that class. The class is automatically registered with Boost.Typeof. The type // name our parser is skipper_t here. -// -// +// +// // 2.1. Parametrized rule parsers -// +// // Rule parser definitions can have parameters. -// +// // Parameters are passed to the BOOST_SPIRIT_RULE_PARSER macro as its second -// argument (just pass '-' if there are no parameters) with the following +// argument (just pass '-' if there are no parameters) with the following // format: -// +// // (N,( param1,param2, / ... / paramN )) // +-- number of parameters -// +// // Example of a whole rule parser: -// +// // BOOST_SPIRIT_RULE_PARSER(new_name, // (1,( symbol_table )),-,-, -// +// // lexeme_d[ (alpha_p >> *alnum_p)[ symbol_table.add ] ] // ) -// +// // The expression 'new_name(my_symbols)' parses a string literal and adds it to // the symbol table 'my_symbols'. -// +// // The rule parser macro creates a function template as called 'new_name' that // takes one parameter of deduced reference type and returns a specialization of // 'new_name_t' in this case. -// -// Since parsers that require to be fast and lightweight often also require to -// be reentrant, it's quite common to pass in some semantic controller (the +// +// Since parsers that require to be fast and lightweight often also require to +// be reentrant, it's quite common to pass in some semantic controller (the // symbol table in the example above). -// However, parameters are templated so they can be anything (including parsers +// However, parameters are templated so they can be anything (including parsers // of course) so refactoring tasks can be abstracted with rule parsers as well. -// +// // BOOST_SPIRIT_RULE_PARSER(enumeration_parser, // (2,( element_parser, delimiter_parser )),-,-, -// +// // element_parser >> *(delimiter_parser >> element_parser) -// ) -// -// The expression 'enumeration_parser(int_p[ some_action ], ',')' creates a +// ) +// +// The expression 'enumeration_parser(int_p[ some_action ], ',')' creates a // parser for a comma-separated list of integers. -// -// +// +// // 2.2. Rule parsrs and semantic actions -// +// // While semantic actions can be globally attached to a rule parser or passed -// to a parametrized rule parser as (part of) an argument, even more control is +// to a parametrized rule parser as (part of) an argument, even more control is // possible by using action placeholders. E.g: -// +// // BOOST_SPIRIT_ACTION_PLACEHOLDER(int_action) -// +// // BOOST_SPIRIT_RULE_PARSER(int_list, // -,(1,( int_action )),-, -// +// // int_p[ int_action ] >> *(',' >> int_p[ int_action ]) // ) -// -// The expression 'int_list[ my_action ]' parses a comma separated list of +// +// The expression 'int_list[ my_action ]' parses a comma separated list of // integers and calls 'my_action' for every integer parsed therein. -// -// Of course multiple actions can be attached to one placeholder as usual (in +// +// Of course multiple actions can be attached to one placeholder as usual (in // this case 'int_list[ my_action1 ][ my_action2 ] would call two actions). -// +// // Further there can be multiple action placeholders for a single rule parser: -// +// // BOOST_SPIRIT_ACTION_PLACEHOLDER(feed_int) // BOOST_SPIRIT_ACTION_PLACEHOLDER(next_int) -// +// // BOOST_SPIRIT_RULE_PARSER(int_list, // -,(2,( feed_int, next_int )),-, -// +// // int_p[ feed_int ] >> *(',' >> int_p[ next_int ][ feed_int ]) // ) -// +// // The expression 'int_list[ (feed_int = my_action1), (next_int = my_action2) ]' -// creates a parser for a comma separated list of integers with the actions +// creates a parser for a comma separated list of integers with the actions // attached appropriately. -// +// // int_list[ feed_int = my_action1,my_action2, next_int = my_action3 ] -// -// works too (in this case the action placeholder 'feed_int' has two actions +// +// works too (in this case the action placeholder 'feed_int' has two actions // attached to it). -// -// You can both override and append actions associated with an action +// +// You can both override and append actions associated with an action // placeholder: -// +// // var = int_list[ feed_int = my_action1, next_int = my_action2 ] -// +// // // [...] -// -// ... var[ feed_int = another_action ] +// +// ... var[ feed_int = another_action ] // // 'another_action' overrides the actions previously attached to 'feed_int' -// +// // ... var[ next_int += another_action ] -// // 'another_action' is appended to the list of actions attached to +// // 'another_action' is appended to the list of actions attached to // // 'next_int' -// +// // Action placeholders are not entirely for free -- they add to the size and the -// initialization time of the rule parser. However, the impact on an already +// initialization time of the rule parser. However, the impact on an already // initialized rule parser instance should be quite small. -// -// +// +// // 2.3. Member variables -// -// You can add member variables to the rule parser class using the third +// +// You can add member variables to the rule parser class using the third // parameter of the rule parser macro: -// +// // BOOST_SPIRIT_RULE_PARSER( calc, // -, // -, // (3,( ((subrule<0>),expression,()), // ((subrule<1>),term,()), // ((subrule<2>),factor,() )) ), -// +// // // [...] -// +// // adds three subrules to the rule parser. // Each parameter must have the following type to allow commas to be handled // safely from within the preprocessing code: -// +// // ((type)),name,(constructor argument(s))) -// +// // // 2.4. The opaque rule parser // -// Rule parsers usually are templates. Building large grammars pushes the -// compiler really hard (and eventually to its limits) because of the +// Rule parsers usually are templates. Building large grammars pushes the +// compiler really hard (and eventually to its limits) because of the // metafunction complexity involved. -// If a rule parser without parameters and action placeholders is defined, a +// If a rule parser without parameters and action placeholders is defined, a // non-template class is created. Non-templated rule parsers can also be created -// explicitly by using BOOST_SPIRIT_OPAQUE_RULE_PARSER. +// explicitly by using BOOST_SPIRIT_OPAQUE_RULE_PARSER. // Opaque rule parsers can have parameters and member variables (note: no action -// placeholders are possible). The parameters of an opaque rule parsers are +// placeholders are possible). The parameters of an opaque rule parsers are // strictly typed, e.g: // // BOOST_SPIRIT_OPAQUE_RULE_PARSER(new_identifier, // (1,( ((my_symbol_table_t &),symbol_table) )) // ,-, // (alpha_p >> *alnum_p) [ symbol_table.add ] -// ) +// ) // -// Note it's also possible to have opaque rule parsers accept parameters of +// Note it's also possible to have opaque rule parsers accept parameters of // non-const reference types which is not possible with regular rule parsers. // // // 3. Utilities for by-reference embedding -// -// When using parsers mutiple times or recursively it can be helpful to embed +// +// When using parsers mutiple times or recursively it can be helpful to embed // them by-reference into the final parser expression. // For this purpose the library provides a wrapper template 'parser_reference'. // There is also a function template to create a wrapped parser which can deduce @@ -349,22 +349,22 @@ namespace boost // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // RP_REGISTER_TEMPLATE // -// Boost.Typeof registration from within BOOST_SPIRIT__NAMESPACE +// Boost.Typeof registration from within BOOST_SPIRIT__NAMESPACE # define BOOST_SPIRIT_RP_REGISTER_TEMPLATE(name,params) \ BOOST_SPIRIT_RP_EMIT(NS_CLOSE,BOOST_SPIRIT__NAMESPACE,-) \ BOOST_TYPEOF_REGISTER_TEMPLATE( \ BOOST_SPIRIT_RP_EMIT(NS_QUALIFY,BOOST_SPIRIT__NAMESPACE,-) name, \ params) \ - BOOST_SPIRIT_RP_EMIT(NS_OPEN,BOOST_SPIRIT__NAMESPACE,-) + BOOST_SPIRIT_RP_EMIT(NS_OPEN,BOOST_SPIRIT__NAMESPACE,-) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // RP_REGISTER_TYPE // -// Boost.Typeof registration from within BOOST_SPIRIT__NAMESPACE +// Boost.Typeof registration from within BOOST_SPIRIT__NAMESPACE # define BOOST_SPIRIT_RP_REGISTER_TYPE(name) \ BOOST_SPIRIT_RP_EMIT(NS_CLOSE,BOOST_SPIRIT__NAMESPACE,-) \ BOOST_TYPEOF_REGISTER_TYPE( \ BOOST_SPIRIT_RP_EMIT(NS_QUALIFY,BOOST_SPIRIT__NAMESPACE,-) name ) \ - BOOST_SPIRIT_RP_EMIT(NS_OPEN,BOOST_SPIRIT__NAMESPACE,-) + BOOST_SPIRIT_RP_EMIT(NS_OPEN,BOOST_SPIRIT__NAMESPACE,-) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // RP_AP_IMPL // @@ -385,7 +385,7 @@ namespace boost { return ns :: action_chain< name, ns :: append, Action> (__a); } \ }; \ } \ - __action_placeholder:: name const name = __action_placeholder:: name (); + __action_placeholder:: name const name = __action_placeholder:: name (); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // RP_IMPL_I // @@ -409,7 +409,7 @@ namespace boost \ template< BOOST_SPIRIT_RP_TPL_PARAMS(pars,acts,typename __,1) > \ class name_t \ - : public ::BOOST_SPIRIT_CLASSIC_NS::parser< name_t \ + : public ::BOOST_SPIRIT_CLASSIC_NS::parser< name_t \ < BOOST_SPIRIT_RP_TPL_PARAMS(pars,acts,__,0) > > \ { \ class __rule \ @@ -419,7 +419,7 @@ namespace boost BOOST_SPIRIT_RP_EMIT(MV_STATIC,mbrs,BOOST_PP_IDENTITY(typename)) \ public: \ BOOST_TYPEOF_NESTED_TYPEDEF_TPL(__expr, \ - ::BOOST_SPIRIT_CLASSIC_NS::type_of::depend_on_type<__Dummy>(x) ) \ + ::BOOST_SPIRIT_CLASSIC_NS::type_of::depend_on_type<__Dummy>(x) ) \ }; \ \ public: \ @@ -471,7 +471,7 @@ namespace boost BOOST_PP_IF(np,BOOST_SPIRIT_RP_GEN_FUNC,BOOST_SPIRIT_RP_GLOB_VAR) \ (name,name_t,np,na) \ BOOST_SPIRIT_RP_REGISTER_TEMPLATE \ - (name_t,BOOST_PP_INC(BOOST_PP_ADD(np,na))) + (name_t,BOOST_PP_INC(BOOST_PP_ADD(np,na))) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // RP_OPAQUE_IMPL_I // @@ -536,7 +536,7 @@ namespace boost BOOST_PP_IF(np,BOOST_SPIRIT_RP_GEN_OPAQUE,BOOST_SPIRIT_RP_GLOB_OPAQUE) \ (name,name_t,np,pars) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// RP_AP_HANDLER +// RP_AP_HANDLER // // Part of the rule parser definition for handling action placeholders # define BOOST_SPIRIT_RP_AP_HANDLER(name_t,np,acts,na,ns) \ @@ -590,7 +590,7 @@ namespace boost # define BOOST_SPIRIT_RP_AP_EXTRA_MBRS(np,na) \ private: \ BOOST_PP_REPEAT(np,BOOST_SPIRIT_RP_PM_MBRS,-) \ - BOOST_PP_REPEAT(na,BOOST_SPIRIT_RP_AP_MBRS,-) + BOOST_PP_REPEAT(na,BOOST_SPIRIT_RP_AP_MBRS,-) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // RP_PM_MBRS // @@ -617,7 +617,7 @@ namespace boost // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // RP_TPL_PARAMS // -// Expands to the template parameters or arguments of the rule parser template +// Expands to the template parameters or arguments of the rule parser template # define BOOST_SPIRIT_RP_TPL_PARAMS(pars,acts,prefix,defaults) \ prefix ## Dummy \ BOOST_SPIRIT_RP_EMIT(PM_TEMPLATE_PARAMS,pars,prefix ## T) \ @@ -679,7 +679,7 @@ namespace boost // PM_CTOR_PARAMS # define BOOST_SPIRIT_RP__PM_CTOR_PARAMS(r,data,i,elem) \ BOOST_PP_COMMA_IF(i) \ - typename ::boost::call_traits< data ## i >::param_type elem + typename ::boost::call_traits< data ## i >::param_type elem // PM_CTOR_ARGS # define BOOST_SPIRIT_RP__PM_CTOR_ARGS(r,data,i,elem) \ @@ -777,7 +777,7 @@ namespace boost // AP_REBOUND_TPL_ARGS # define BOOST_SPIRIT_RP__AP_REBOUND_TPL_ARGS(r,data,i,elem) \ , typename ::BOOST_SPIRIT_CLASSIC_NS::type_of::placeholdee< \ - __action_placeholder:: elem , __A ## i, data >::type + __action_placeholder:: elem , __A ## i, data >::type // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // PP_EMIT @@ -787,7 +787,7 @@ namespace boost # define BOOST_SPIRIT_RP_EMIT(op, array, data) \ BOOST_SPIRIT_RP_ARRAY_FOR_EACH_I(BOOST_SPIRIT_RP__ ## op,data,array) // --- --- - - --- - - --- - - - - --- - - - - - - - - - - - - - - - - - - - - - -// RP_ARRAY_FOR_EACH_I +// RP_ARRAY_FOR_EACH_I // // Iterates an optional array. That is you can pass e.g.'-' or 'none' to denote // emptiness. @@ -796,13 +796,13 @@ namespace boost BOOST_SPIRIT_RP_ARRAY_FOR_EACH_I_IMPL, \ BOOST_PP_TUPLE_EAT(3))(macro,data,optional_array) -// RP_ARRAY_FOR_EACH_I_IMPL +// RP_ARRAY_FOR_EACH_I_IMPL # define BOOST_SPIRIT_RP_ARRAY_FOR_EACH_I_IMPL(macro,data,array) \ BOOST_SPIRIT_RP_IF(BOOST_PP_ARRAY_SIZE(array),PP_SEQ_FOR_EACH_I,3) \ (macro,data, BOOST_SPIRIT_RP_IF(BOOST_PP_ARRAY_SIZE(array), \ PP_TUPLE_TO_SEQ,2) array) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// RP_ARRAY_SIZE +// RP_ARRAY_SIZE // // Expands to the size of an "optional array". // @@ -818,7 +818,7 @@ namespace boost BOOST_PP_ARRAY_SIZE, 0 BOOST_PP_TUPLE_EAT(1))(optional_array) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // RP_OPTIONAL -// +// // Expands to nothing if the argument is parenthesized. // // Examples: @@ -827,7 +827,7 @@ namespace boost // BOOST_SPIRIT_RP_OPTIONAL( (none) ) // evaluates to nothing // # define BOOST_SPIRIT_RP_OPTIONAL(elem) \ - BOOST_PP_EXPR_IIF(BOOST_PP_COMPL(BOOST_PP_IS_UNARY(elem)),elem) + BOOST_PP_EXPR_IIF(BOOST_PP_COMPL(BOOST_PP_IS_UNARY(elem)),elem) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // RP_COMMA_IF_OR // @@ -851,13 +851,13 @@ namespace boost // Wrapper and gernator function to embed a parser by reference //------------------------------------------------------------------------------ -namespace boost { namespace spirit { +namespace boost { namespace spirit { BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN // Wrapper to embed a parser by reference - template<class P> class parser_reference + template<class P> class parser_reference : public parser< parser_reference<P> > { P const & ref_that; @@ -868,19 +868,19 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN { } typedef parser_reference<P> self_t; - typedef self_t const & embed_t; + typedef self_t const & embed_t; typedef typename P::parser_category_t parser_category_t; - template<typename ScannerT> struct result + template<typename ScannerT> struct result { typedef typename P::BOOST_NESTED_TEMPLATE result<ScannerT>::type type; }; - template<typename ScannerT> + template<typename ScannerT> typename result<ScannerT>::type parse(ScannerT const & scan) const { return this->ref_that.parse(scan); } }; - template<class P> parser_reference<P> + template<class P> parser_reference<P> embed_by_reference(::BOOST_SPIRIT_CLASSIC_NS::parser<P> & p) { return p; } @@ -894,18 +894,18 @@ BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::parser_reference, 1) // Expression templates for action placeholders. //------------------------------------------------------------------------------ -namespace boost { namespace spirit { +namespace boost { namespace spirit { BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN -namespace type_of { +namespace type_of { // No-operation functor - struct nop_functor + struct nop_functor { template<typename T> - bool operator()(T const &) const + bool operator()(T const &) const { return false; } template<typename T, typename U> bool operator()(T const &, U const &) const @@ -949,26 +949,26 @@ namespace type_of { { typedef Action type; - static type concatenate(nop_functor const &, Action const & a) + static type concatenate(nop_functor const &, Action const & a) { return a; } }; template<typename Action> struct action_concatenator<Action, nop_functor> { typedef Action type; - static type concatenate(Action const & a, nop_functor const &) + static type concatenate(Action const & a, nop_functor const &) { return a; } }; template<> struct action_concatenator<nop_functor, nop_functor> { typedef nop_functor type; - static type concatenate(nop_functor const &, nop_functor const &) + static type concatenate(nop_functor const &, nop_functor const &) { return nop_functor(); } }; template<typename Action1, typename Action2> - typename action_concatenator<Action1,Action2>::type + typename action_concatenator<Action1,Action2>::type concatenate_actions(Action1 const & a1, Action2 const & a2) { return action_concatenator<Action1,Action2>::concatenate(a1,a2); @@ -1017,17 +1017,17 @@ namespace type_of { head_type const & head() const { return obj_head; } tail_type const & tail() const { return obj_tail; } - }; + }; // Action chain concatenation template<class Head, class Tail> action_chains<Head,Tail> make_chain(Head const & h, Tail const & t) { return action_chains<Head,Tail>(h,t); } - template<class PH1, action_chain_mode M1, typename A1, + template<class PH1, action_chain_mode M1, typename A1, class PH2, action_chain_mode M2, typename A2> action_chains< action_chain<PH1,M1,A1>, action_chain<PH2,M2,A2> > - operator, (action_chain<PH1,M1,A1> const & h, + operator, (action_chain<PH1,M1,A1> const & h, action_chain<PH2,M2,A2> const & t) { return make_chain(h,t); } @@ -1037,12 +1037,12 @@ namespace type_of { { return make_chain(h,t); } - // Extract the (maybe composite) action associated with an action + // Extract the (maybe composite) action associated with an action // placeholders from the chains with a fold algorithm. template<class Placeholder, typename StartAction, class NewChainOrChains> struct placeholdee { - typedef StartAction type; + typedef StartAction type; static type get(StartAction const & a, NewChainOrChains const &) { return a; } @@ -1054,7 +1054,7 @@ namespace type_of { get_placeholdee(StartAction const & a, NewChainOrChains const & c) { return placeholdee<Placeholder,StartAction,NewChainOrChains>::get(a,c); } - template<class Placeholder, typename StartAction, class Head, class Tail> + template<class Placeholder, typename StartAction, class Head, class Tail> struct placeholdee < Placeholder, StartAction, action_chains<Head,Tail> > { @@ -1075,7 +1075,7 @@ namespace type_of { { typedef A type; - static type get(StartAction const &, + static type get(StartAction const &, action_chain<Placeholder,replace,A> const & c) { return c.action(); } }; @@ -1086,12 +1086,12 @@ namespace type_of { { typedef typename action_concatenator<StartAction,A>::type type; - static type get(StartAction const & a, + static type get(StartAction const & a, action_chain<Placeholder,append,A> const & c) { return concatenate_actions(a,c.action()); } }; -} +} BOOST_SPIRIT_CLASSIC_NAMESPACE_END @@ -1104,7 +1104,7 @@ BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::type_of::composite_actio // Misc.utilities //------------------------------------------------------------------------------ -namespace boost { namespace spirit { +namespace boost { namespace spirit { BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN @@ -1113,7 +1113,7 @@ namespace type_of { // Utility function to create a dependency to a template argument. template<typename T, typename X> - X const & depend_on_type(X const & x) + X const & depend_on_type(X const & x) { return x; } // Utility to allow use parenthesized type expressions with commas inside @@ -1130,13 +1130,13 @@ namespace type_of { template<typename T> struct remove_special_fptr< special_result & (*)(T) > { typedef T type; }; -} +} BOOST_SPIRIT_CLASSIC_NAMESPACE_END } } // namespace ::BOOST_SPIRIT_CLASSIC_NS::type_of //------------------------------------------------------------------------------ -#endif +#endif //------------------------------------------------------------------------------ |