| #include <iostream> |
| #include <fstream> |
| #include <vector> |
| #include <utility> |
| #include <typeinfo> |
| #include <memory> |
| #include <algorithm> |
| #include <limits> |
| #include <string.h> |
| namespace boost { namespace spirit |
| { |
| struct nil_t {}; |
| }} |
| namespace boost { |
| namespace mpl { |
| namespace aux { |
| template< typename F > struct template_arity; |
| } |
| } |
| } |
| namespace boost { namespace mpl { |
| template< bool C_ > struct bool_; |
| typedef bool_<true> true_; |
| typedef bool_<false> false_; |
| }} |
| namespace boost { namespace mpl { |
| template< bool C_ > struct bool_ |
| { |
| static const bool value = C_; |
| typedef bool_ type; |
| typedef bool value_type; |
| operator bool() const { return this->value; } |
| }; |
| template< bool C_ > |
| bool const bool_<C_>::value; |
| }} |
| namespace boost { |
| template< typename T > struct is_integral : mpl::bool_< false > { }; |
| template<> struct is_integral< unsigned char > : mpl::bool_< true > { }; template<> struct is_integral< unsigned char const > : mpl::bool_< true > { }; template<> struct is_integral< unsigned char volatile > : mpl::bool_< true > { }; template<> struct is_integral< unsigned char const volatile > : mpl::bool_< true > { }; |
| template<> struct is_integral< unsigned short > : mpl::bool_< true > { }; template<> struct is_integral< unsigned short const > : mpl::bool_< true > { }; template<> struct is_integral< unsigned short volatile > : mpl::bool_< true > { }; template<> struct is_integral< unsigned short const volatile > : mpl::bool_< true > { }; |
| template<> struct is_integral< unsigned int > : mpl::bool_< true > { }; template<> struct is_integral< unsigned int const > : mpl::bool_< true > { }; template<> struct is_integral< unsigned int volatile > : mpl::bool_< true > { }; template<> struct is_integral< unsigned int const volatile > : mpl::bool_< true > { }; |
| template<> struct is_integral< unsigned long > : mpl::bool_< true > { }; template<> struct is_integral< unsigned long const > : mpl::bool_< true > { }; template<> struct is_integral< unsigned long volatile > : mpl::bool_< true > { }; template<> struct is_integral< unsigned long const volatile > : mpl::bool_< true > { }; |
| template<> struct is_integral< signed char > : mpl::bool_< true > { }; template<> struct is_integral< signed char const > : mpl::bool_< true > { }; template<> struct is_integral< signed char volatile > : mpl::bool_< true > { }; template<> struct is_integral< signed char const volatile > : mpl::bool_< true > { }; |
| template<> struct is_integral< signed short > : mpl::bool_< true > { }; template<> struct is_integral< signed short const > : mpl::bool_< true > { }; template<> struct is_integral< signed short volatile > : mpl::bool_< true > { }; template<> struct is_integral< signed short const volatile > : mpl::bool_< true > { }; |
| template<> struct is_integral< signed int > : mpl::bool_< true > { }; template<> struct is_integral< signed int const > : mpl::bool_< true > { }; template<> struct is_integral< signed int volatile > : mpl::bool_< true > { }; template<> struct is_integral< signed int const volatile > : mpl::bool_< true > { }; |
| template<> struct is_integral< signed long > : mpl::bool_< true > { }; template<> struct is_integral< signed long const > : mpl::bool_< true > { }; template<> struct is_integral< signed long volatile > : mpl::bool_< true > { }; template<> struct is_integral< signed long const volatile > : mpl::bool_< true > { }; |
| template<> struct is_integral< bool > : mpl::bool_< true > { }; template<> struct is_integral< bool const > : mpl::bool_< true > { }; template<> struct is_integral< bool volatile > : mpl::bool_< true > { }; template<> struct is_integral< bool const volatile > : mpl::bool_< true > { }; |
| template<> struct is_integral< char > : mpl::bool_< true > { }; template<> struct is_integral< char const > : mpl::bool_< true > { }; template<> struct is_integral< char volatile > : mpl::bool_< true > { }; template<> struct is_integral< char const volatile > : mpl::bool_< true > { }; |
| template<> struct is_integral< wchar_t > : mpl::bool_< true > { }; template<> struct is_integral< wchar_t const > : mpl::bool_< true > { }; template<> struct is_integral< wchar_t volatile > : mpl::bool_< true > { }; template<> struct is_integral< wchar_t const volatile > : mpl::bool_< true > { }; |
| template<> struct is_integral< unsigned long long > : mpl::bool_< true > { }; template<> struct is_integral< unsigned long long const > : mpl::bool_< true > { }; template<> struct is_integral< unsigned long long volatile > : mpl::bool_< true > { }; template<> struct is_integral< unsigned long long const volatile > : mpl::bool_< true > { }; |
| template<> struct is_integral< long long > : mpl::bool_< true > { }; template<> struct is_integral< long long const > : mpl::bool_< true > { }; template<> struct is_integral< long long volatile > : mpl::bool_< true > { }; template<> struct is_integral< long long const volatile > : mpl::bool_< true > { }; |
| } |
| namespace boost { |
| template< typename T > struct is_float : mpl::bool_< false > { }; |
| template<> struct is_float< float > : mpl::bool_< true > { }; template<> struct is_float< float const > : mpl::bool_< true > { }; template<> struct is_float< float volatile > : mpl::bool_< true > { }; template<> struct is_float< float const volatile > : mpl::bool_< true > { }; |
| template<> struct is_float< double > : mpl::bool_< true > { }; template<> struct is_float< double const > : mpl::bool_< true > { }; template<> struct is_float< double volatile > : mpl::bool_< true > { }; template<> struct is_float< double const volatile > : mpl::bool_< true > { }; |
| template<> struct is_float< long double > : mpl::bool_< true > { }; template<> struct is_float< long double const > : mpl::bool_< true > { }; template<> struct is_float< long double volatile > : mpl::bool_< true > { }; template<> struct is_float< long double const volatile > : mpl::bool_< true > { }; |
| } |
| namespace boost { |
| namespace type_traits { |
| template <bool b1, bool b2, bool b3 = false, bool b4 = false, bool b5 = false, bool b6 = false, bool b7 = false> |
| struct ice_or; |
| template <bool b1, bool b2, bool b3, bool b4, bool b5, bool b6, bool b7> |
| struct ice_or |
| { |
| static const bool value = true; |
| }; |
| template <> |
| struct ice_or<false, false, false, false, false, false, false> |
| { |
| static const bool value = false; |
| }; |
| } |
| } |
| namespace boost { |
| namespace detail { |
| template< typename T > |
| struct is_arithmetic_impl |
| { |
| static const bool value = (::boost::type_traits::ice_or< ::boost::is_integral<T>::value, ::boost::is_float<T>::value >::value); |
| }; |
| } |
| template< typename T > struct is_arithmetic : mpl::bool_< ::boost::detail::is_arithmetic_impl<T>::value > { }; |
| } |
| namespace boost { |
| template< typename T > struct is_void : mpl::bool_< false > { }; |
| template<> struct is_void< void > : mpl::bool_< true > { }; |
| template<> struct is_void< void const > : mpl::bool_< true > { }; |
| template<> struct is_void< void volatile > : mpl::bool_< true > { }; |
| template<> struct is_void< void const volatile > : mpl::bool_< true > { }; |
| } |
| namespace boost { |
| namespace detail { |
| template <typename T> |
| struct is_fundamental_impl |
| : ::boost::type_traits::ice_or< |
| ::boost::is_arithmetic<T>::value |
| , ::boost::is_void<T>::value |
| > |
| { |
| }; |
| } |
| template< typename T > struct is_fundamental : mpl::bool_< ::boost::detail::is_fundamental_impl<T>::value > { }; |
| } |
| namespace boost { |
| template< typename T > struct is_array : mpl::bool_< false > { }; |
| template< typename T, std::size_t N > struct is_array< T[N] > : mpl::bool_< true > { }; |
| template< typename T, std::size_t N > struct is_array< T const[N] > : mpl::bool_< true > { }; |
| template< typename T, std::size_t N > struct is_array< T volatile[N] > : mpl::bool_< true > { }; |
| template< typename T, std::size_t N > struct is_array< T const volatile[N] > : mpl::bool_< true > { }; |
| } |
| namespace boost { |
| template< typename T > struct is_reference : mpl::bool_< false > { }; |
| template< typename T > struct is_reference< T& > : mpl::bool_< true > { }; |
| } |
| namespace boost { |
| namespace detail { |
| template <typename T> |
| struct add_reference_impl |
| { |
| typedef T& type; |
| }; |
| template< typename T > struct add_reference_impl<T&> { typedef T& type; }; |
| template<> struct add_reference_impl<void> { typedef void type; }; |
| template<> struct add_reference_impl<void const> { typedef void const type; }; |
| template<> struct add_reference_impl<void volatile> { typedef void volatile type; }; |
| template<> struct add_reference_impl<void const volatile> { typedef void const volatile type; }; |
| } |
| template< typename T > struct add_reference { typedef typename detail::add_reference_impl<T>::type type; }; |
| } |
| namespace boost { |
| namespace type_traits { |
| typedef char yes_type; |
| struct no_type |
| { |
| char padding[8]; |
| }; |
| } |
| } |
| namespace boost { |
| namespace type_traits { |
| template <bool b1, bool b2, bool b3 = true, bool b4 = true, bool b5 = true, bool b6 = true, bool b7 = true> |
| struct ice_and; |
| template <bool b1, bool b2, bool b3, bool b4, bool b5, bool b6, bool b7> |
| struct ice_and |
| { |
| static const bool value = false; |
| }; |
| template <> |
| struct ice_and<true, true, true, true, true, true, true> |
| { |
| static const bool value = true; |
| }; |
| } |
| } |
| namespace boost { |
| namespace type_traits { |
| template <bool b> |
| struct ice_not |
| { |
| static const bool value = true; |
| }; |
| template <> |
| struct ice_not<true> |
| { |
| static const bool value = false; |
| }; |
| } |
| } |
| namespace boost { |
| namespace type_traits { |
| template <int b1, int b2> |
| struct ice_eq |
| { |
| static const bool value = (b1 == b2); |
| }; |
| template <int b1, int b2> |
| struct ice_ne |
| { |
| static const bool value = (b1 != b2); |
| }; |
| template <int b1, int b2> bool const ice_eq<b1,b2>::value; |
| template <int b1, int b2> bool const ice_ne<b1,b2>::value; |
| } |
| } |
| namespace boost { |
| namespace detail { |
| struct any_conversion |
| { |
| template <typename T> any_conversion(const volatile T&); |
| template <typename T> any_conversion(T&); |
| }; |
| template <typename T> struct checker |
| { |
| static boost::type_traits::no_type _m_check(any_conversion ...); |
| static boost::type_traits::yes_type _m_check(T, int); |
| }; |
| template <typename From, typename To> |
| struct is_convertible_basic_impl |
| { |
| static From _m_from; |
| static bool const value = sizeof( detail::checker<To>::_m_check(_m_from, 0) ) |
| == sizeof(::boost::type_traits::yes_type); |
| }; |
| template <typename From, typename To> |
| struct is_convertible_impl |
| { |
| typedef typename add_reference<From>::type ref_type; |
| static const bool value = (::boost::type_traits::ice_and< ::boost::detail::is_convertible_basic_impl<ref_type,To>::value, ::boost::type_traits::ice_not< ::boost::is_array<To>::value >::value >::value); |
| }; |
| template<> struct is_convertible_impl< void,void > { static const bool value = (true); }; template<> struct is_convertible_impl< void,void const > { static const bool value = (true); }; template<> struct is_convertible_impl< void,void volatile > { static const bool value = (true); }; template<> struct is_convertible_impl< void,void const volatile > { static const bool value = (true); }; template<> struct is_convertible_impl< void const,void > { static const bool value = (true); }; template<> struct is_convertible_impl< void const,void const > { static const bool value = (true); }; template<> struct is_convertible_impl< void const,void volatile > { static const bool value = (true); }; template<> struct is_convertible_impl< void const,void const volatile > { static const bool value = (true); }; template<> struct is_convertible_impl< void volatile,void > { static const bool value = (true); }; template<> struct is_convertible_impl< void volatile,void const > { static const bool value = (true); }; template<> struct is_convertible_impl< void volatile,void volatile > { static const bool value = (true); }; template<> struct is_convertible_impl< void volatile,void const volatile > { static const bool value = (true); }; template<> struct is_convertible_impl< void const volatile,void > { static const bool value = (true); }; template<> struct is_convertible_impl< void const volatile,void const > { static const bool value = (true); }; template<> struct is_convertible_impl< void const volatile,void volatile > { static const bool value = (true); }; template<> struct is_convertible_impl< void const volatile,void const volatile > { static const bool value = (true); }; |
| template< typename To > struct is_convertible_impl< void,To > { static const bool value = (false); }; |
| template< typename From > struct is_convertible_impl< From,void > { static const bool value = (false); }; |
| template< typename To > struct is_convertible_impl< void const,To > { static const bool value = (false); }; |
| template< typename To > struct is_convertible_impl< void volatile,To > { static const bool value = (false); }; |
| template< typename To > struct is_convertible_impl< void const volatile,To > { static const bool value = (false); }; |
| template< typename From > struct is_convertible_impl< From,void const > { static const bool value = (false); }; |
| template< typename From > struct is_convertible_impl< From,void volatile > { static const bool value = (false); }; |
| template< typename From > struct is_convertible_impl< From,void const volatile > { static const bool value = (false); }; |
| } |
| template< typename From, typename To > struct is_convertible : mpl::bool_< (::boost::detail::is_convertible_impl<From,To>::value) > { }; |
| template<> struct is_convertible< float,char > : mpl::bool_< true > { }; template<> struct is_convertible< float,signed char > : mpl::bool_< true > { }; template<> struct is_convertible< float,unsigned char > : mpl::bool_< true > { }; template<> struct is_convertible< float,signed short > : mpl::bool_< true > { }; template<> struct is_convertible< float,unsigned short > : mpl::bool_< true > { }; template<> struct is_convertible< float,signed int > : mpl::bool_< true > { }; template<> struct is_convertible< float,unsigned int > : mpl::bool_< true > { }; template<> struct is_convertible< float,signed long > : mpl::bool_< true > { }; template<> struct is_convertible< float,unsigned long > : mpl::bool_< true > { }; template<> struct is_convertible< float,signed long long > : mpl::bool_< true > { }; template<> struct is_convertible< float,unsigned long long > : mpl::bool_< true > { }; template<> struct is_convertible< float const,char > : mpl::bool_< true > { }; template<> struct is_convertible< float const,signed char > : mpl::bool_< true > { }; template<> struct is_convertible< float const,unsigned char > : mpl::bool_< true > { }; template<> struct is_convertible< float const,signed short > : mpl::bool_< true > { }; template<> struct is_convertible< float const,unsigned short > : mpl::bool_< true > { }; template<> struct is_convertible< float const,signed int > : mpl::bool_< true > { }; template<> struct is_convertible< float const,unsigned int > : mpl::bool_< true > { }; template<> struct is_convertible< float const,signed long > : mpl::bool_< true > { }; template<> struct is_convertible< float const,unsigned long > : mpl::bool_< true > { }; template<> struct is_convertible< float const,signed long long > : mpl::bool_< true > { }; template<> struct is_convertible< float const,unsigned long long > : mpl::bool_< true > { }; template<> struct is_convertible< float volatile,char > : mpl::bool_< true > { }; template<> struct is_convertible< float volatile,signed char > : mpl::bool_< true > { }; template<> struct is_convertible< float volatile,unsigned char > : mpl::bool_< true > { }; template<> struct is_convertible< float volatile,signed short > : mpl::bool_< true > { }; template<> struct is_convertible< float volatile,unsigned short > : mpl::bool_< true > { }; template<> struct is_convertible< float volatile,signed int > : mpl::bool_< true > { }; template<> struct is_convertible< float volatile,unsigned int > : mpl::bool_< true > { }; template<> struct is_convertible< float volatile,signed long > : mpl::bool_< true > { }; template<> struct is_convertible< float volatile,unsigned long > : mpl::bool_< true > { }; template<> struct is_convertible< float volatile,signed long long > : mpl::bool_< true > { }; template<> struct is_convertible< float volatile,unsigned long long > : mpl::bool_< true > { }; template<> struct is_convertible< float const volatile,char > : mpl::bool_< true > { }; template<> struct is_convertible< float const volatile,signed char > : mpl::bool_< true > { }; template<> struct is_convertible< float const volatile,unsigned char > : mpl::bool_< true > { }; template<> struct is_convertible< float const volatile,signed short > : mpl::bool_< true > { }; template<> struct is_convertible< float const volatile,unsigned short > : mpl::bool_< true > { }; template<> struct is_convertible< float const volatile,signed int > : mpl::bool_< true > { }; template<> struct is_convertible< float const volatile,unsigned int > : mpl::bool_< true > { }; template<> struct is_convertible< float const volatile,signed long > : mpl::bool_< true > { }; template<> struct is_convertible< float const volatile,unsigned long > : mpl::bool_< true > { }; template<> struct is_convertible< float const volatile,signed long long > : mpl::bool_< true > { }; template<> struct is_convertible< float const volatile,unsigned long long > : mpl::bool_< true > { }; |
| template<> struct is_convertible< double,char > : mpl::bool_< true > { }; template<> struct is_convertible< double,signed char > : mpl::bool_< true > { }; template<> struct is_convertible< double,unsigned char > : mpl::bool_< true > { }; template<> struct is_convertible< double,signed short > : mpl::bool_< true > { }; template<> struct is_convertible< double,unsigned short > : mpl::bool_< true > { }; template<> struct is_convertible< double,signed int > : mpl::bool_< true > { }; template<> struct is_convertible< double,unsigned int > : mpl::bool_< true > { }; template<> struct is_convertible< double,signed long > : mpl::bool_< true > { }; template<> struct is_convertible< double,unsigned long > : mpl::bool_< true > { }; template<> struct is_convertible< double,signed long long > : mpl::bool_< true > { }; template<> struct is_convertible< double,unsigned long long > : mpl::bool_< true > { }; template<> struct is_convertible< double const,char > : mpl::bool_< true > { }; template<> struct is_convertible< double const,signed char > : mpl::bool_< true > { }; template<> struct is_convertible< double const,unsigned char > : mpl::bool_< true > { }; template<> struct is_convertible< double const,signed short > : mpl::bool_< true > { }; template<> struct is_convertible< double const,unsigned short > : mpl::bool_< true > { }; template<> struct is_convertible< double const,signed int > : mpl::bool_< true > { }; template<> struct is_convertible< double const,unsigned int > : mpl::bool_< true > { }; template<> struct is_convertible< double const,signed long > : mpl::bool_< true > { }; template<> struct is_convertible< double const,unsigned long > : mpl::bool_< true > { }; template<> struct is_convertible< double const,signed long long > : mpl::bool_< true > { }; template<> struct is_convertible< double const,unsigned long long > : mpl::bool_< true > { }; template<> struct is_convertible< double volatile,char > : mpl::bool_< true > { }; template<> struct is_convertible< double volatile,signed char > : mpl::bool_< true > { }; template<> struct is_convertible< double volatile,unsigned char > : mpl::bool_< true > { }; template<> struct is_convertible< double volatile,signed short > : mpl::bool_< true > { }; template<> struct is_convertible< double volatile,unsigned short > : mpl::bool_< true > { }; template<> struct is_convertible< double volatile,signed int > : mpl::bool_< true > { }; template<> struct is_convertible< double volatile,unsigned int > : mpl::bool_< true > { }; template<> struct is_convertible< double volatile,signed long > : mpl::bool_< true > { }; template<> struct is_convertible< double volatile,unsigned long > : mpl::bool_< true > { }; template<> struct is_convertible< double volatile,signed long long > : mpl::bool_< true > { }; template<> struct is_convertible< double volatile,unsigned long long > : mpl::bool_< true > { }; template<> struct is_convertible< double const volatile,char > : mpl::bool_< true > { }; template<> struct is_convertible< double const volatile,signed char > : mpl::bool_< true > { }; template<> struct is_convertible< double const volatile,unsigned char > : mpl::bool_< true > { }; template<> struct is_convertible< double const volatile,signed short > : mpl::bool_< true > { }; template<> struct is_convertible< double const volatile,unsigned short > : mpl::bool_< true > { }; template<> struct is_convertible< double const volatile,signed int > : mpl::bool_< true > { }; template<> struct is_convertible< double const volatile,unsigned int > : mpl::bool_< true > { }; template<> struct is_convertible< double const volatile,signed long > : mpl::bool_< true > { }; template<> struct is_convertible< double const volatile,unsigned long > : mpl::bool_< true > { }; template<> struct is_convertible< double const volatile,signed long long > : mpl::bool_< true > { }; template<> struct is_convertible< double const volatile,unsigned long long > : mpl::bool_< true > { }; |
| template<> struct is_convertible< long double,char > : mpl::bool_< true > { }; template<> struct is_convertible< long double,signed char > : mpl::bool_< true > { }; template<> struct is_convertible< long double,unsigned char > : mpl::bool_< true > { }; template<> struct is_convertible< long double,signed short > : mpl::bool_< true > { }; template<> struct is_convertible< long double,unsigned short > : mpl::bool_< true > { }; template<> struct is_convertible< long double,signed int > : mpl::bool_< true > { }; template<> struct is_convertible< long double,unsigned int > : mpl::bool_< true > { }; template<> struct is_convertible< long double,signed long > : mpl::bool_< true > { }; template<> struct is_convertible< long double,unsigned long > : mpl::bool_< true > { }; template<> struct is_convertible< long double,signed long long > : mpl::bool_< true > { }; template<> struct is_convertible< long double,unsigned long long > : mpl::bool_< true > { }; template<> struct is_convertible< long double const,char > : mpl::bool_< true > { }; template<> struct is_convertible< long double const,signed char > : mpl::bool_< true > { }; template<> struct is_convertible< long double const,unsigned char > : mpl::bool_< true > { }; template<> struct is_convertible< long double const,signed short > : mpl::bool_< true > { }; template<> struct is_convertible< long double const,unsigned short > : mpl::bool_< true > { }; template<> struct is_convertible< long double const,signed int > : mpl::bool_< true > { }; template<> struct is_convertible< long double const,unsigned int > : mpl::bool_< true > { }; template<> struct is_convertible< long double const,signed long > : mpl::bool_< true > { }; template<> struct is_convertible< long double const,unsigned long > : mpl::bool_< true > { }; template<> struct is_convertible< long double const,signed long long > : mpl::bool_< true > { }; template<> struct is_convertible< long double const,unsigned long long > : mpl::bool_< true > { }; template<> struct is_convertible< long double volatile,char > : mpl::bool_< true > { }; template<> struct is_convertible< long double volatile,signed char > : mpl::bool_< true > { }; template<> struct is_convertible< long double volatile,unsigned char > : mpl::bool_< true > { }; template<> struct is_convertible< long double volatile,signed short > : mpl::bool_< true > { }; template<> struct is_convertible< long double volatile,unsigned short > : mpl::bool_< true > { }; template<> struct is_convertible< long double volatile,signed int > : mpl::bool_< true > { }; template<> struct is_convertible< long double volatile,unsigned int > : mpl::bool_< true > { }; template<> struct is_convertible< long double volatile,signed long > : mpl::bool_< true > { }; template<> struct is_convertible< long double volatile,unsigned long > : mpl::bool_< true > { }; template<> struct is_convertible< long double volatile,signed long long > : mpl::bool_< true > { }; template<> struct is_convertible< long double volatile,unsigned long long > : mpl::bool_< true > { }; template<> struct is_convertible< long double const volatile,char > : mpl::bool_< true > { }; template<> struct is_convertible< long double const volatile,signed char > : mpl::bool_< true > { }; template<> struct is_convertible< long double const volatile,unsigned char > : mpl::bool_< true > { }; template<> struct is_convertible< long double const volatile,signed short > : mpl::bool_< true > { }; template<> struct is_convertible< long double const volatile,unsigned short > : mpl::bool_< true > { }; template<> struct is_convertible< long double const volatile,signed int > : mpl::bool_< true > { }; template<> struct is_convertible< long double const volatile,unsigned int > : mpl::bool_< true > { }; template<> struct is_convertible< long double const volatile,signed long > : mpl::bool_< true > { }; template<> struct is_convertible< long double const volatile,unsigned long > : mpl::bool_< true > { }; template<> struct is_convertible< long double const volatile,signed long long > : mpl::bool_< true > { }; template<> struct is_convertible< long double const volatile,unsigned long long > : mpl::bool_< true > { }; |
| } |
| namespace boost { |
| namespace type_traits { |
| struct false_result |
| { |
| template <typename T> struct result_ |
| { |
| static const bool value = false; |
| }; |
| }; |
| }} |
| namespace boost { |
| namespace type_traits { |
| template <class R> |
| struct is_function_ptr_helper |
| { |
| static const bool value = false; |
| }; |
| template <class R> |
| struct is_function_ptr_helper<R (*)()> { static const bool value = true; }; |
| template <class R,class T0> |
| struct is_function_ptr_helper<R (*)(T0)> { static const bool value = true; }; |
| template <class R,class T0,class T1> |
| struct is_function_ptr_helper<R (*)(T0,T1)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2,class T3> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2,T3)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2,class T3,class T4> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2,class T3,class T4,class T5> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20,class T21> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20,class T21,class T22> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20,class T21,class T22,class T23> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23)> { static const bool value = true; }; |
| template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20,class T21,class T22,class T23,class T24> |
| struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24)> { static const bool value = true; }; |
| } |
| } |
| namespace boost { |
| namespace detail { |
| template<bool is_ref = true> |
| struct is_function_chooser |
| : ::boost::type_traits::false_result |
| { |
| }; |
| template <> |
| struct is_function_chooser<false> |
| { |
| template< typename T > struct result_ |
| : ::boost::type_traits::is_function_ptr_helper<T*> |
| { |
| }; |
| }; |
| template <typename T> |
| struct is_function_impl |
| : is_function_chooser< ::boost::is_reference<T>::value > |
| ::template result_<T> |
| { |
| }; |
| } |
| template< typename T > struct is_function : mpl::bool_< ::boost::detail::is_function_impl<T>::value > { }; |
| } |
| namespace boost { |
| namespace detail { |
| template <typename T> struct cv_traits_imp {}; |
| template <typename T> |
| struct cv_traits_imp<T*> |
| { |
| static const bool is_const = false; |
| static const bool is_volatile = false; |
| typedef T unqualified_type; |
| }; |
| template <typename T> |
| struct cv_traits_imp<const T*> |
| { |
| static const bool is_const = true; |
| static const bool is_volatile = false; |
| typedef T unqualified_type; |
| }; |
| template <typename T> |
| struct cv_traits_imp<volatile T*> |
| { |
| static const bool is_const = false; |
| static const bool is_volatile = true; |
| typedef T unqualified_type; |
| }; |
| template <typename T> |
| struct cv_traits_imp<const volatile T*> |
| { |
| static const bool is_const = true; |
| static const bool is_volatile = true; |
| typedef T unqualified_type; |
| }; |
| } |
| } |
| namespace boost { |
| template< typename T > struct remove_cv { typedef typename detail::cv_traits_imp<T*>::unqualified_type type; }; |
| template< typename T > struct remove_cv<T&> { typedef T& type; }; |
| template< typename T, std::size_t N > struct remove_cv<T const[N]> { typedef T type[N]; }; |
| template< typename T, std::size_t N > struct remove_cv<T volatile[N]> { typedef T type[N]; }; |
| template< typename T, std::size_t N > struct remove_cv<T const volatile[N]> { typedef T type[N]; }; |
| } |
| namespace boost { |
| namespace detail { |
| template <typename T> struct is_union_impl |
| { |
| static const bool value = false; |
| }; |
| } |
| template< typename T > struct is_union : mpl::bool_< ::boost::detail::is_union_impl<T>::value > { }; |
| } |
| namespace boost { |
| namespace detail { |
| template <class U> ::boost::type_traits::yes_type is_class_tester(void(U::*)(void)); |
| template <class U> ::boost::type_traits::no_type is_class_tester(...); |
| template <typename T> |
| struct is_class_impl |
| { |
| static const bool value = (::boost::type_traits::ice_and< sizeof(is_class_tester<T>(0)) == sizeof(::boost::type_traits::yes_type), ::boost::type_traits::ice_not< ::boost::is_union<T>::value >::value >::value); |
| }; |
| } |
| template< typename T > struct is_class : mpl::bool_< ::boost::detail::is_class_impl<T>::value > { }; |
| } |
| namespace boost { |
| namespace detail { |
| template <typename T> |
| struct is_class_or_union |
| { |
| static const bool value = (::boost::type_traits::ice_or< ::boost::is_class<T>::value , ::boost::is_union<T>::value >::value); |
| }; |
| struct int_convertible |
| { |
| int_convertible(int); |
| }; |
| template <bool is_typename_arithmetic_or_reference = true> |
| struct is_enum_helper |
| { |
| template <typename T> struct type |
| { |
| static const bool value = false; |
| }; |
| }; |
| template <> |
| struct is_enum_helper<false> |
| { |
| template <typename T> struct type |
| : ::boost::is_convertible<T,::boost::detail::int_convertible> |
| { |
| }; |
| }; |
| template <typename T> struct is_enum_impl |
| { |
| typedef ::boost::add_reference<T> ar_t; |
| typedef typename ar_t::type r_type; |
| static const bool selector = (::boost::type_traits::ice_or< ::boost::is_arithmetic<T>::value , ::boost::is_reference<T>::value , ::boost::is_function<T>::value , is_class_or_union<T>::value >::value); |
| typedef ::boost::detail::is_enum_helper<selector> se_t; |
| typedef typename se_t::template type<r_type> helper; |
| static const bool value = helper::value; |
| }; |
| template<> struct is_enum_impl< void > { static const bool value = (false); }; |
| template<> struct is_enum_impl< void const > { static const bool value = (false); }; |
| template<> struct is_enum_impl< void volatile > { static const bool value = (false); }; |
| template<> struct is_enum_impl< void const volatile > { static const bool value = (false); }; |
| } |
| template< typename T > struct is_enum : mpl::bool_< ::boost::detail::is_enum_impl<T>::value > { }; |
| } |
| namespace boost { |
| namespace type_traits { |
| template <typename T> |
| struct is_mem_fun_pointer_impl |
| { |
| static const bool value = false; |
| }; |
| template <class R, class T > |
| struct is_mem_fun_pointer_impl<R (T::*)() > { static const bool value = true; }; |
| template <class R, class T > |
| struct is_mem_fun_pointer_impl<R (T::*)() const > { static const bool value = true; }; |
| template <class R, class T > |
| struct is_mem_fun_pointer_impl<R (T::*)() volatile > { static const bool value = true; }; |
| template <class R, class T > |
| struct is_mem_fun_pointer_impl<R (T::*)() const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0) > { static const bool value = true; }; |
| template <class R, class T , class T0> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0) const > { static const bool value = true; }; |
| template <class R, class T , class T0> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23) const volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24) > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24) const > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24) volatile > { static const bool value = true; }; |
| template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24> |
| struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24) const volatile > { static const bool value = true; }; |
| } |
| } |
| namespace boost { |
| template< typename T > struct is_member_function_pointer : mpl::bool_< ::boost::type_traits::is_mem_fun_pointer_impl<T>::value > { }; |
| } |
| namespace boost { |
| template< typename T > struct is_member_pointer : mpl::bool_< ::boost::is_member_function_pointer<T>::value > { }; |
| template< typename T, typename U > struct is_member_pointer< U T::* > : mpl::bool_< true > { }; |
| } |
| namespace boost { |
| namespace detail { |
| template< typename T > struct is_pointer_helper |
| { |
| static const bool value = false; |
| }; |
| template< typename T > struct is_pointer_helper<T*> { static const bool value = true; }; |
| template< typename T > struct is_pointer_helper<T* const> { static const bool value = true; }; |
| template< typename T > struct is_pointer_helper<T* volatile> { static const bool value = true; }; |
| template< typename T > struct is_pointer_helper<T* const volatile> { static const bool value = true; }; |
| template< typename T > |
| struct is_pointer_impl |
| { |
| static const bool value = (::boost::type_traits::ice_and< ::boost::detail::is_pointer_helper<T>::value , ::boost::type_traits::ice_not< ::boost::is_member_pointer<T>::value >::value >::value); |
| }; |
| } |
| template< typename T > struct is_pointer : mpl::bool_< ::boost::detail::is_pointer_impl<T>::value > { }; |
| } |
| namespace boost{ |
| namespace detail{ |
| template <typename T, bool small_> |
| struct ct_imp2 |
| { |
| typedef const T& param_type; |
| }; |
| template <typename T> |
| struct ct_imp2<T, true> |
| { |
| typedef const T param_type; |
| }; |
| template <typename T, bool isp, bool b1> |
| struct ct_imp |
| { |
| typedef const T& param_type; |
| }; |
| template <typename T, bool isp> |
| struct ct_imp<T, isp, true> |
| { |
| typedef typename ct_imp2<T, sizeof(T) <= sizeof(void*)>::param_type param_type; |
| }; |
| template <typename T, bool b1> |
| struct ct_imp<T, true, b1> |
| { |
| typedef T const param_type; |
| }; |
| } |
| template <typename T> |
| struct call_traits |
| { |
| public: |
| typedef T value_type; |
| typedef T& reference; |
| typedef const T& const_reference; |
| typedef typename detail::ct_imp< |
| T, |
| ::boost::is_pointer<T>::value, |
| ::boost::is_arithmetic<T>::value |
| >::param_type param_type; |
| }; |
| template <typename T> |
| struct call_traits<T&> |
| { |
| typedef T& value_type; |
| typedef T& reference; |
| typedef const T& const_reference; |
| typedef T& param_type; |
| }; |
| template <typename T, std::size_t N> |
| struct call_traits<T [N]> |
| { |
| private: |
| typedef T array_type[N]; |
| public: |
| typedef const T* value_type; |
| typedef array_type& reference; |
| typedef const array_type& const_reference; |
| typedef const T* const param_type; |
| }; |
| template <typename T, std::size_t N> |
| struct call_traits<const T [N]> |
| { |
| private: |
| typedef const T array_type[N]; |
| public: |
| typedef const T* value_type; |
| typedef array_type& reference; |
| typedef const array_type& const_reference; |
| typedef const T* const param_type; |
| }; |
| } |
| #include <assert.h> |
| namespace boost { |
| template <class T> |
| struct type {}; |
| } |
| namespace boost { namespace mpl { |
| template< std::size_t N > struct size_t; |
| }} |
| namespace boost { namespace mpl { |
| template< std::size_t N > |
| struct size_t |
| { |
| static const std::size_t value = N; |
| typedef size_t type; |
| typedef std::size_t value_type; |
| typedef mpl::size_t< static_cast<std::size_t>((value + 1)) > next; |
| typedef mpl::size_t< static_cast<std::size_t>((value - 1)) > prior; |
| operator std::size_t() const { return static_cast<std::size_t>(this->value); } |
| }; |
| template< std::size_t N > |
| std::size_t const mpl::size_t< N >::value; |
| }} |
| namespace boost { |
| template <typename T> struct alignment_of; |
| namespace detail { |
| template <typename T> |
| struct alignment_of_hack |
| { |
| char c; |
| T t; |
| alignment_of_hack(); |
| }; |
| template <unsigned A, unsigned S> |
| struct alignment_logic |
| { |
| static const std::size_t value = A < S ? A : S; |
| }; |
| template< typename T > |
| struct alignment_of_impl |
| { |
| static const std::size_t value = (::boost::detail::alignment_logic< sizeof(detail::alignment_of_hack<T>) - sizeof(T), sizeof(T) >::value); |
| }; |
| } |
| template< typename T > struct alignment_of : mpl::size_t< ::boost::detail::alignment_of_impl<T>::value > { }; |
| template <typename T> |
| struct alignment_of<T&> |
| : alignment_of<T*> |
| { |
| }; |
| template<> struct alignment_of<void> : mpl::size_t< 0 > { }; |
| template<> struct alignment_of<void const> : mpl::size_t< 0 > { }; |
| template<> struct alignment_of<void volatile> : mpl::size_t< 0 > { }; |
| template<> struct alignment_of<void const volatile> : mpl::size_t< 0 > { }; |
| } |
| namespace boost { |
| namespace mpl { |
| struct void_; |
| } |
| } |
| namespace boost { |
| namespace mpl { |
| struct void_ { typedef void_ type; }; |
| template< typename T > |
| struct is_void_ |
| : false_ |
| { |
| }; |
| template<> |
| struct is_void_<void_> |
| : true_ |
| { |
| }; |
| } |
| } |
| namespace boost { |
| namespace mpl { |
| template< |
| typename T |
| , typename Tag |
| , typename Arity |
| > |
| struct lambda; |
| } |
| } |
| namespace boost { namespace mpl { |
| template< int N > struct int_; |
| }} |
| namespace boost { |
| namespace mpl { |
| template< int N > struct arg; |
| } |
| } |
| namespace boost { |
| namespace mpl { |
| namespace algo_ { |
| template< |
| bool C |
| , typename T1 |
| , typename T2 |
| > |
| struct if_c |
| { |
| typedef T1 type; |
| }; |
| template< |
| typename T1 |
| , typename T2 |
| > |
| struct if_c<false,T1,T2> |
| { |
| typedef T2 type; |
| }; |
| template< |
| typename C = void_ |
| , typename T1 = void_ |
| , typename T2 = void_ |
| > |
| struct if_ |
| { |
| private: |
| typedef if_c< |
| static_cast<bool>(C::value) |
| , T1 |
| , T2 |
| > almost_type_; |
| public: |
| typedef typename almost_type_::type type; |
| |
| }; |
| } using namespace algo_; |
| namespace algo_ { template<> struct if_< void_,void_,void_ > { template< typename T1,typename T2,typename T3 , typename T4 =void_ ,typename T5 =void_ > struct apply : if_< T1,T2,T3 > { }; }; } using namespace algo_; template<> struct lambda< algo_:: if_< void_,void_,void_ > , void_ , int_<-1> > { typedef algo_:: if_< void_,void_,void_ > type; }; namespace aux { template< typename T1,typename T2,typename T3 > struct template_arity< algo_:: if_< T1,T2,T3 > > { static const int value = 3; }; template<> struct template_arity< algo_:: if_< void_,void_,void_ > > { static const int value = -1; }; } |
| template <class T1, class T2, class T3, class T4> struct bind3; |
| template <template <class T1, class T2, class T3> class F, class tag> struct quote3; |
| namespace aux |
| { |
| template < |
| typename T |
| , typename U1,typename U2,typename U3,typename U4,typename U5 |
| > struct resolve_bind_arg; |
| template< |
| typename T |
| , typename Arg |
| > |
| struct replace_unnamed_arg; |
| } |
| template< |
| typename T1, typename T2, typename T3 |
| > |
| struct bind3<quote3<if_, void_>, T1, T2, T3> |
| { |
| template< |
| typename U1 = void_, typename U2 = void_, typename U3 = void_ |
| , typename U4 = void_, typename U5 = void_ |
| > |
| struct apply |
| { |
| private: |
| typedef quote3<if_, void_> a0; |
| typedef mpl::arg< 1> n1; |
| typedef aux::replace_unnamed_arg< T1,n1 > r1; |
| typedef typename r1::type a1; |
| typedef typename r1::next_arg n2; |
| typedef typename aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 >::type t1; |
| typedef aux::replace_unnamed_arg< T2,n2 > r2; |
| typedef typename r2::type a2; |
| typedef typename r2::next_arg n3; |
| typedef typename aux::resolve_bind_arg< a2,U1,U2,U3,U4,U5 > f2; |
| typedef aux::replace_unnamed_arg< T3,n3 > r3; |
| typedef typename r3::type a3; |
| typedef typename r3::next_arg n4; |
| typedef typename aux::resolve_bind_arg< a3,U1,U2,U3,U4,U5 > f3; |
| typedef typename if_<t1,f2,f3>::type f_; |
| public: |
| typedef typename f_::type type; |
| }; |
| }; |
| } |
| } |
| namespace boost { |
| namespace detail { |
| template <typename T> |
| struct is_scalar_impl |
| { |
| static const bool value = (::boost::type_traits::ice_or< ::boost::is_arithmetic<T>::value, ::boost::is_enum<T>::value, ::boost::is_pointer<T>::value, ::boost::is_member_pointer<T>::value >::value); |
| }; |
| template <> struct is_scalar_impl<void>{ static const bool value = false; }; |
| template <> struct is_scalar_impl<void const>{ static const bool value = false; }; |
| template <> struct is_scalar_impl<void volatile>{ static const bool value = false; }; |
| template <> struct is_scalar_impl<void const volatile>{ static const bool value = false; }; |
| } |
| template< typename T > struct is_scalar : mpl::bool_< ::boost::detail::is_scalar_impl<T>::value > { }; |
| } |
| namespace boost { |
| template< typename T > struct is_POD; |
| namespace detail { |
| template <typename T> struct is_pod_impl |
| { |
| static const bool value = (::boost::type_traits::ice_or< ::boost::is_scalar<T>::value, ::boost::is_void<T>::value, false >::value); |
| }; |
| template <typename T, std::size_t sz> |
| struct is_pod_impl<T[sz]> |
| : is_pod_impl<T> |
| { |
| }; |
| template<> struct is_pod_impl< void > { static const bool value = (true); }; |
| template<> struct is_pod_impl< void const > { static const bool value = (true); }; |
| template<> struct is_pod_impl< void volatile > { static const bool value = (true); }; |
| template<> struct is_pod_impl< void const volatile > { static const bool value = (true); }; |
| } |
| template< typename T > struct is_POD : mpl::bool_< ::boost::detail::is_pod_impl<T>::value > { }; |
| template< typename T > struct is_pod : mpl::bool_< ::boost::detail::is_pod_impl<T>::value > { }; |
| } |
| namespace boost{ |
| template <bool x> struct STATIC_ASSERTION_FAILURE; |
| template <> struct STATIC_ASSERTION_FAILURE<true> { enum { value = 1 }; }; |
| template<int x> struct static_assert_test{}; |
| } |
| namespace boost { |
| namespace detail { |
| class alignment_dummy; |
| typedef void (*function_ptr)(); |
| typedef int (alignment_dummy::*member_ptr); |
| typedef int (alignment_dummy::*member_function_ptr)(); |
| template <bool found, std::size_t target, class TestType> |
| struct lower_alignment_helper |
| { |
| typedef char type; |
| enum { value = true }; |
| }; |
| template <std::size_t target, class TestType> |
| struct lower_alignment_helper<false,target,TestType> |
| { |
| enum { value = (alignment_of<TestType>::value == target) }; |
| typedef typename mpl::if_c<value, TestType, char>::type type; |
| }; |
| template <typename T> |
| struct has_one_T |
| { |
| T data; |
| }; |
| template <std::size_t target> |
| union lower_alignment |
| { |
| enum { found0 = false }; |
| typename lower_alignment_helper< found0,target,char >::type t0; enum { found1 = lower_alignment_helper<found0,target,char >::value }; typename lower_alignment_helper< found1,target,short >::type t1; enum { found2 = lower_alignment_helper<found1,target,short >::value }; typename lower_alignment_helper< found2,target,int >::type t2; enum { found3 = lower_alignment_helper<found2,target,int >::value }; typename lower_alignment_helper< found3,target,long >::type t3; enum { found4 = lower_alignment_helper<found3,target,long >::value }; typename lower_alignment_helper< found4,target,float >::type t4; enum { found5 = lower_alignment_helper<found4,target,float >::value }; typename lower_alignment_helper< found5,target,double >::type t5; enum { found6 = lower_alignment_helper<found5,target,double >::value }; typename lower_alignment_helper< found6,target,long double >::type t6; enum { found7 = lower_alignment_helper<found6,target,long double >::value }; typename lower_alignment_helper< found7,target,void* >::type t7; enum { found8 = lower_alignment_helper<found7,target,void* >::value }; typename lower_alignment_helper< found8,target,function_ptr >::type t8; enum { found9 = lower_alignment_helper<found8,target,function_ptr >::value }; typename lower_alignment_helper< found9,target,member_ptr >::type t9; enum { found10 = lower_alignment_helper<found9,target,member_ptr >::value }; typename lower_alignment_helper< found10,target,member_function_ptr >::type t10; enum { found11 = lower_alignment_helper<found10,target,member_function_ptr >::value }; typename lower_alignment_helper< found11,target,boost::detail::has_one_T<char> >::type t11; enum { found12 = lower_alignment_helper<found11,target,boost::detail::has_one_T<char> >::value }; typename lower_alignment_helper< found12,target,boost::detail::has_one_T<short> >::type t12; enum { found13 = lower_alignment_helper<found12,target,boost::detail::has_one_T<short> >::value }; typename lower_alignment_helper< found13,target,boost::detail::has_one_T<int> >::type t13; enum { found14 = lower_alignment_helper<found13,target,boost::detail::has_one_T<int> >::value }; typename lower_alignment_helper< found14,target,boost::detail::has_one_T<long> >::type t14; enum { found15 = lower_alignment_helper<found14,target,boost::detail::has_one_T<long> >::value }; typename lower_alignment_helper< found15,target,boost::detail::has_one_T<float> >::type t15; enum { found16 = lower_alignment_helper<found15,target,boost::detail::has_one_T<float> >::value }; typename lower_alignment_helper< found16,target,boost::detail::has_one_T<double> >::type t16; enum { found17 = lower_alignment_helper<found16,target,boost::detail::has_one_T<double> >::value }; typename lower_alignment_helper< found17,target,boost::detail::has_one_T<long double> >::type t17; enum { found18 = lower_alignment_helper<found17,target,boost::detail::has_one_T<long double> >::value }; typename lower_alignment_helper< found18,target,boost::detail::has_one_T<void*> >::type t18; enum { found19 = lower_alignment_helper<found18,target,boost::detail::has_one_T<void*> >::value }; typename lower_alignment_helper< found19,target,boost::detail::has_one_T<function_ptr> >::type t19; enum { found20 = lower_alignment_helper<found19,target,boost::detail::has_one_T<function_ptr> >::value }; typename lower_alignment_helper< found20,target,boost::detail::has_one_T<member_ptr> >::type t20; enum { found21 = lower_alignment_helper<found20,target,boost::detail::has_one_T<member_ptr> >::value }; typename lower_alignment_helper< found21,target,boost::detail::has_one_T<member_function_ptr> >::type t21; enum { found22 = lower_alignment_helper<found21,target,boost::detail::has_one_T<member_function_ptr> >::value }; |
| }; |
| union max_align |
| { |
| char t0; short t1; int t2; long t3; float t4; double t5; long double t6; void* t7; function_ptr t8; member_ptr t9; member_function_ptr t10; boost::detail::has_one_T<char> t11; boost::detail::has_one_T<short> t12; boost::detail::has_one_T<int> t13; boost::detail::has_one_T<long> t14; boost::detail::has_one_T<float> t15; boost::detail::has_one_T<double> t16; boost::detail::has_one_T<long double> t17; boost::detail::has_one_T<void*> t18; boost::detail::has_one_T<function_ptr> t19; boost::detail::has_one_T<member_ptr> t20; boost::detail::has_one_T<member_function_ptr> t21; |
| }; |
| template<int TAlign, int Align> |
| struct is_aligned |
| { |
| static const bool value = (TAlign >= Align) & (TAlign % Align == 0); |
| }; |
| } |
| template<std::size_t Align> |
| struct is_pod< ::boost::detail::lower_alignment<Align> > |
| { |
| static const std::size_t value = true; |
| }; |
| template <int Align> |
| class type_with_alignment |
| { |
| typedef detail::lower_alignment<Align> t1; |
| typedef typename mpl::if_c< |
| ::boost::detail::is_aligned< ::boost::alignment_of<t1>::value,Align >::value |
| , t1 |
| , detail::max_align |
| >::type align_t; |
| static const std::size_t found = alignment_of<align_t>::value; |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( found >= Align ) >)> boost_static_assert_typedef_197; |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( found % Align == 0 ) >)> boost_static_assert_typedef_198; |
| public: |
| typedef align_t type; |
| }; |
| namespace align { |
| struct __attribute__((__aligned__(2))) a2 {}; |
| struct __attribute__((__aligned__(4))) a4 {}; |
| struct __attribute__((__aligned__(8))) a8 {}; |
| struct __attribute__((__aligned__(16))) a16 {}; |
| struct __attribute__((__aligned__(32))) a32 {}; |
| } |
| template<> class type_with_alignment<1> { public: typedef char type; }; |
| template<> class type_with_alignment<2> { public: typedef align::a2 type; }; |
| template<> class type_with_alignment<4> { public: typedef align::a4 type; }; |
| template<> class type_with_alignment<8> { public: typedef align::a8 type; }; |
| template<> class type_with_alignment<16> { public: typedef align::a16 type; }; |
| template<> class type_with_alignment<32> { public: typedef align::a32 type; }; |
| namespace detail { |
| template<> struct is_pod_impl< ::boost::align::a2 > { static const bool value = (true); }; |
| template<> struct is_pod_impl< ::boost::align::a4 > { static const bool value = (true); }; |
| template<> struct is_pod_impl< ::boost::align::a8 > { static const bool value = (true); }; |
| template<> struct is_pod_impl< ::boost::align::a16 > { static const bool value = (true); }; |
| template<> struct is_pod_impl< ::boost::align::a32 > { static const bool value = (true); }; |
| } |
| } |
| namespace boost { |
| template< typename T > struct remove_reference { typedef T type; }; |
| template< typename T > struct remove_reference<T&> { typedef T type; }; |
| } |
| namespace boost { namespace mpl { namespace aux { |
| template< typename T > |
| struct nested_type_wknd |
| : T::type |
| { |
| }; |
| }}} |
| namespace boost { |
| namespace mpl { |
| namespace aux { |
| template< long C_ > |
| struct not_impl |
| : bool_<!C_> |
| { |
| }; |
| } |
| template< |
| typename T = void_ |
| > |
| struct not_ |
| : aux::not_impl< |
| ::boost::mpl::aux::nested_type_wknd<T>::value |
| > |
| { |
| |
| }; |
| template<> struct not_< void_ > { template< typename T1 , typename T2 =void_ ,typename T3 =void_ ,typename T4 =void_ ,typename T5 =void_ > struct apply : not_< T1 > { }; }; template<> struct lambda< not_< void_ > , void_ , int_<-1> > { typedef not_< void_ > type; }; namespace aux { template< typename T1 > struct template_arity< not_< T1 > > { static const int value = 1; }; template<> struct template_arity< not_< void_ > > { static const int value = -1; }; } |
| } |
| } |
| namespace boost { |
| template< typename T > struct is_volatile : mpl::bool_< ::boost::detail::cv_traits_imp<T*>::is_volatile > { }; |
| template< typename T > struct is_volatile< T& > : mpl::bool_< false > { }; |
| } |
| namespace boost { |
| namespace detail { |
| template <typename T> |
| struct has_trivial_copy_impl |
| { |
| static const bool value = (::boost::type_traits::ice_and< ::boost::type_traits::ice_or< ::boost::is_pod<T>::value, false >::value, ::boost::type_traits::ice_not< ::boost::is_volatile<T>::value >::value >::value); |
| }; |
| } |
| template< typename T > struct has_trivial_copy : mpl::bool_< ::boost::detail::has_trivial_copy_impl<T>::value > { }; |
| } |
| namespace boost { |
| template< typename T > struct has_nothrow_copy : mpl::bool_< ::boost::has_trivial_copy<T>::value > { }; |
| } |
| namespace boost { |
| namespace detail { |
| template <typename RefT> |
| class reference_content |
| { |
| private: |
| RefT content_; |
| public: |
| ~reference_content() |
| { |
| } |
| reference_content(RefT r) |
| : content_( r ) |
| { |
| } |
| reference_content(const reference_content& operand) |
| : content_( operand.content_ ) |
| { |
| } |
| private: |
| reference_content& operator=(const reference_content&); |
| public: |
| RefT get() const |
| { |
| return content_; |
| } |
| }; |
| template <typename T = mpl::void_> struct make_reference_content; |
| template <typename T> |
| struct make_reference_content |
| { |
| typedef T type; |
| }; |
| template <typename T> |
| struct make_reference_content< T& > |
| { |
| typedef reference_content<T&> type; |
| }; |
| template <> |
| struct make_reference_content< mpl::void_ > |
| { |
| template <typename T> |
| struct apply |
| : make_reference_content<T> |
| { |
| }; |
| typedef mpl::void_ type; |
| }; |
| } |
| template <typename T> |
| struct has_nothrow_copy< |
| ::boost::detail::reference_content< T& > |
| > |
| : mpl::true_ |
| { |
| }; |
| } |
| namespace boost { |
| namespace detail { |
| struct none_helper{}; |
| typedef int none_helper::*none_t ; |
| } |
| } |
| #include <functional> |
| namespace boost { |
| template<class OptionalPointee> |
| inline |
| bool equal_pointees ( OptionalPointee const& x, OptionalPointee const& y ) |
| { |
| return (!x) != (!y) ? false : ( !x ? true : (*x) == (*y) ) ; |
| } |
| template<class OptionalPointee> |
| struct equal_pointees_t : std::binary_function<OptionalPointee,OptionalPointee,bool> |
| { |
| bool operator() ( OptionalPointee const& x, OptionalPointee const& y ) const |
| { return equal_pointees(x,y) ; } |
| } ; |
| template<class OptionalPointee> |
| inline |
| bool less_pointees ( OptionalPointee const& x, OptionalPointee const& y ) |
| { |
| return !y ? false : ( !x ? true : (*x) < (*y) ) ; |
| } |
| template<class OptionalPointee> |
| struct less_pointees_t : std::binary_function<OptionalPointee,OptionalPointee,bool> |
| { |
| bool operator() ( OptionalPointee const& x, OptionalPointee const& y ) const |
| { return less_pointees(x,y) ; } |
| } ; |
| } |
| namespace boost { |
| class InPlaceFactoryBase ; |
| class TypedInPlaceFactoryBase ; |
| namespace optional_detail { |
| template <class T> |
| class aligned_storage |
| { |
| union dummy_u |
| { |
| char data[ sizeof(T) ]; |
| typename type_with_alignment< |
| ::boost::alignment_of<T>::value >::type aligner_; |
| } dummy_ ; |
| public: |
| void const* address() const { return &dummy_.data[0]; } |
| void * address() { return &dummy_.data[0]; } |
| } ; |
| template<class T> |
| struct types_when_isnt_ref |
| { |
| typedef T const& reference_const_type ; |
| typedef T & reference_type ; |
| typedef T const* pointer_const_type ; |
| typedef T * pointer_type ; |
| typedef T const& argument_type ; |
| } ; |
| template<class T> |
| struct types_when_is_ref |
| { |
| typedef typename remove_reference<T>::type raw_type ; |
| typedef raw_type& reference_const_type ; |
| typedef raw_type& reference_type ; |
| typedef raw_type* pointer_const_type ; |
| typedef raw_type* pointer_type ; |
| typedef raw_type& argument_type ; |
| } ; |
| struct optional_tag {} ; |
| template<class T> |
| class optional_base : public optional_tag |
| { |
| private : |
| typedef typename detail::make_reference_content<T>::type internal_type ; |
| typedef aligned_storage<internal_type> storage_type ; |
| typedef types_when_isnt_ref<T> types_when_not_ref ; |
| typedef types_when_is_ref<T> types_when_ref ; |
| typedef optional_base<T> this_type ; |
| protected : |
| typedef T value_type ; |
| typedef mpl::true_ is_reference_tag ; |
| typedef mpl::false_ is_not_reference_tag ; |
| typedef typename is_reference<T>::type is_reference_predicate ; |
| typedef typename mpl::if_<is_reference_predicate,types_when_ref,types_when_not_ref>::type types ; |
| typedef bool (this_type::*unspecified_bool_type)() const; |
| typedef typename types::reference_type reference_type ; |
| typedef typename types::reference_const_type reference_const_type ; |
| typedef typename types::pointer_type pointer_type ; |
| typedef typename types::pointer_const_type pointer_const_type ; |
| typedef typename types::argument_type argument_type ; |
| optional_base() |
| : |
| m_initialized(false) {} |
| optional_base ( detail::none_t const& ) |
| : |
| m_initialized(false) {} |
| optional_base ( argument_type val ) |
| : |
| m_initialized(false) |
| { |
| construct(val); |
| } |
| optional_base ( optional_base const& rhs ) |
| : |
| m_initialized(false) |
| { |
| if ( rhs.is_initialized() ) |
| construct(rhs.get_impl()); |
| } |
| template<class Expr> |
| explicit optional_base ( Expr const& expr, Expr const* tag ) |
| : |
| m_initialized(false) |
| { |
| construct(expr,tag); |
| } |
| ~optional_base() { destroy() ; } |
| void assign ( optional_base const& rhs ) |
| { |
| destroy(); |
| if ( rhs.is_initialized() ) |
| construct(rhs.get_impl()); |
| } |
| void assign ( argument_type val ) |
| { |
| destroy(); |
| construct(val); |
| } |
| void assign ( detail::none_t const& ) { destroy(); } |
| template<class Expr> |
| void assign_expr ( Expr const& expr, Expr const* tag ) |
| { |
| destroy(); |
| construct(expr,tag); |
| } |
| public : |
| void reset() { destroy(); } |
| void reset ( argument_type val ) { assign(val); } |
| pointer_const_type get_ptr() const { return m_initialized ? get_ptr_impl() : 0 ; } |
| pointer_type get_ptr() { return m_initialized ? get_ptr_impl() : 0 ; } |
| bool is_initialized() const { return m_initialized ; } |
| protected : |
| void construct ( argument_type val ) |
| { |
| new (m_storage.address()) internal_type(val) ; |
| m_initialized = true ; |
| } |
| template<class Expr> |
| void construct ( Expr const& factory, InPlaceFactoryBase const* ) |
| { |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( ::boost::mpl::not_<is_reference_predicate>::value ) >)> boost_static_assert_typedef_268 ; |
| factory.template apply<value_type>(m_storage.address()) ; |
| m_initialized = true ; |
| } |
| template<class Expr> |
| void construct ( Expr const& factory, TypedInPlaceFactoryBase const* ) |
| { |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( ::boost::mpl::not_<is_reference_predicate>::value ) >)> boost_static_assert_typedef_277 ; |
| factory.apply(m_storage.address()) ; |
| m_initialized = true ; |
| } |
| template<class Expr> |
| void construct ( Expr const& expr, void const* ) |
| { |
| new (m_storage.address()) internal_type(expr) ; |
| m_initialized = true ; |
| } |
| void destroy() |
| { |
| if ( m_initialized ) |
| destroy_impl(is_reference_predicate()) ; |
| } |
| unspecified_bool_type safe_bool() const { return m_initialized ? &this_type::is_initialized : 0 ; } |
| reference_const_type get_impl() const { return dereference(get_object(), is_reference_predicate() ) ; } |
| reference_type get_impl() { return dereference(get_object(), is_reference_predicate() ) ; } |
| pointer_const_type get_ptr_impl() const { return cast_ptr(get_object(), is_reference_predicate() ) ; } |
| pointer_type get_ptr_impl() { return cast_ptr(get_object(), is_reference_predicate() ) ; } |
| private : |
| internal_type const* get_object() const { return static_cast<internal_type const*>(m_storage.address()); } |
| internal_type * get_object() { return static_cast<internal_type *> (m_storage.address()); } |
| reference_const_type dereference( internal_type const* p, is_not_reference_tag ) const { return *p ; } |
| reference_type dereference( internal_type* p, is_not_reference_tag ) { return *p ; } |
| reference_const_type dereference( internal_type const* p, is_reference_tag ) const { return p->get() ; } |
| reference_type dereference( internal_type* p, is_reference_tag ) { return p->get() ; } |
| void destroy_impl ( is_not_reference_tag ) { get_impl().~T() ; m_initialized = false ; } |
| void destroy_impl ( is_reference_tag ) { m_initialized = false ; } |
| pointer_const_type cast_ptr( internal_type const* p, is_not_reference_tag ) const { return p ; } |
| pointer_type cast_ptr( internal_type * p, is_not_reference_tag ) { return p ; } |
| bool m_initialized ; |
| storage_type m_storage ; |
| } ; |
| } |
| template<class T> |
| class optional : public optional_detail::optional_base<T> |
| { |
| typedef optional_detail::optional_base<T> base ; |
| typedef typename base::unspecified_bool_type unspecified_bool_type ; |
| public : |
| typedef optional<T> this_type ; |
| typedef typename base::value_type value_type ; |
| typedef typename base::reference_type reference_type ; |
| typedef typename base::reference_const_type reference_const_type ; |
| typedef typename base::pointer_type pointer_type ; |
| typedef typename base::pointer_const_type pointer_const_type ; |
| typedef typename base::argument_type argument_type ; |
| optional() : base() {} |
| optional( detail::none_t const& none_ ) : base(none_) {} |
| optional ( argument_type val ) : base(val) {} |
| template<class U> |
| explicit optional ( optional<U> const& rhs ) |
| : |
| base() |
| { |
| if ( rhs.is_initialized() ) |
| this->construct(rhs.get()); |
| } |
| template<class Expr> |
| explicit optional ( Expr const& expr ) : base(expr,&expr) {} |
| optional ( optional const& rhs ) : base(rhs) {} |
| ~optional() {} |
| template<class Expr> |
| optional& operator= ( Expr expr ) |
| { |
| this->assign_expr(expr,&expr); |
| return *this ; |
| } |
| template<class U> |
| optional& operator= ( optional<U> const& rhs ) |
| { |
| this->destroy(); |
| if ( rhs.is_initialized() ) |
| { |
| this->assign(rhs.get()); |
| } |
| return *this ; |
| } |
| optional& operator= ( optional const& rhs ) |
| { |
| this->assign( rhs ) ; |
| return *this ; |
| } |
| optional& operator= ( argument_type val ) |
| { |
| this->assign( val ) ; |
| return *this ; |
| } |
| optional& operator= ( detail::none_t const& none_ ) |
| { |
| this->assign( none_ ) ; |
| return *this ; |
| } |
| reference_const_type get() const { ((void)0) ; return this->get_impl(); } |
| reference_type get() { ((void)0) ; return this->get_impl(); } |
| pointer_const_type operator->() const { ((void)0) ; return this->get_ptr_impl() ; } |
| pointer_type operator->() { ((void)0) ; return this->get_ptr_impl() ; } |
| reference_const_type operator *() const { return this->get() ; } |
| reference_type operator *() { return this->get() ; } |
| operator unspecified_bool_type() const { return this->safe_bool() ; } |
| bool operator!() const { return !this->is_initialized() ; } |
| } ; |
| template<class T> |
| inline |
| typename optional<T>::reference_const_type |
| get ( optional<T> const& opt ) |
| { |
| return opt.get() ; |
| } |
| template<class T> |
| inline |
| typename optional<T>::reference_type |
| get ( optional<T>& opt ) |
| { |
| return opt.get() ; |
| } |
| template<class T> |
| inline |
| typename optional<T>::pointer_const_type |
| get ( optional<T> const* opt ) |
| { |
| return opt->get_ptr() ; |
| } |
| template<class T> |
| inline |
| typename optional<T>::pointer_type |
| get ( optional<T>* opt ) |
| { |
| return opt->get_ptr() ; |
| } |
| template<class T> |
| inline |
| typename optional<T>::pointer_const_type |
| get_pointer ( optional<T> const& opt ) |
| { |
| return opt.get_ptr() ; |
| } |
| template<class T> |
| inline |
| typename optional<T>::pointer_type |
| get_pointer ( optional<T>& opt ) |
| { |
| return opt.get_ptr() ; |
| } |
| template<class T> |
| inline |
| bool operator == ( optional<T> const& x, optional<T> const& y ) |
| { return equal_pointees(x,y); } |
| template<class T> |
| inline |
| bool operator < ( optional<T> const& x, optional<T> const& y ) |
| { return less_pointees(x,y); } |
| template<class T> |
| inline |
| bool operator != ( optional<T> const& x, optional<T> const& y ) |
| { return !( x == y ) ; } |
| template<class T> |
| inline |
| bool operator > ( optional<T> const& x, optional<T> const& y ) |
| { return y < x ; } |
| template<class T> |
| inline |
| bool operator <= ( optional<T> const& x, optional<T> const& y ) |
| { return !( y < x ) ; } |
| template<class T> |
| inline |
| bool operator >= ( optional<T> const& x, optional<T> const& y ) |
| { return !( x < y ) ; } |
| template<class T> |
| inline |
| bool operator == ( optional<T> const& x, detail::none_t const& ) |
| { return equal_pointees(x, optional<T>() ); } |
| template<class T> |
| inline |
| bool operator < ( optional<T> const& x, detail::none_t const& ) |
| { return less_pointees(x,optional<T>() ); } |
| template<class T> |
| inline |
| bool operator != ( optional<T> const& x, detail::none_t const& y ) |
| { return !( x == y ) ; } |
| template<class T> |
| inline |
| bool operator > ( optional<T> const& x, detail::none_t const& y ) |
| { return y < x ; } |
| template<class T> |
| inline |
| bool operator <= ( optional<T> const& x, detail::none_t const& y ) |
| { return !( y < x ) ; } |
| template<class T> |
| inline |
| bool operator >= ( optional<T> const& x, detail::none_t const& y ) |
| { return !( x < y ) ; } |
| template<class T> |
| inline |
| bool operator == ( detail::none_t const& x, optional<T> const& y ) |
| { return equal_pointees(optional<T>() ,y); } |
| template<class T> |
| inline |
| bool operator < ( detail::none_t const& x, optional<T> const& y ) |
| { return less_pointees(optional<T>() ,y); } |
| template<class T> |
| inline |
| bool operator != ( detail::none_t const& x, optional<T> const& y ) |
| { return !( x == y ) ; } |
| template<class T> |
| inline |
| bool operator > ( detail::none_t const& x, optional<T> const& y ) |
| { return y < x ; } |
| template<class T> |
| inline |
| bool operator <= ( detail::none_t const& x, optional<T> const& y ) |
| { return !( y < x ) ; } |
| template<class T> |
| inline |
| bool operator >= ( detail::none_t const& x, optional<T> const& y ) |
| { return !( x < y ) ; } |
| namespace optional_detail { |
| template<class T> |
| inline |
| void optional_swap ( optional<T>& x, optional<T>& y ) |
| { |
| if ( !x && !!y ) |
| { |
| x.reset(*y); |
| y.reset(); |
| } |
| else if ( !!x && !y ) |
| { |
| y.reset(*x); |
| x.reset(); |
| } |
| else if ( !!x && !!y ) |
| { |
| using std::swap ; |
| swap(*x,*y); |
| } |
| } |
| } |
| template<class T> inline void swap ( optional<T>& x, optional<T>& y ) |
| { |
| optional_detail::optional_swap(x,y); |
| } |
| } |
| namespace boost |
| { |
| template<class E> void throw_exception(E const & e) |
| { |
| throw e; |
| } |
| } |
| namespace boost { namespace spirit |
| { |
| namespace impl |
| { |
| template <typename T> |
| struct no_base {}; |
| template <typename T> |
| struct safe_bool_impl |
| { |
| typedef T* TP; |
| TP stub; |
| typedef TP safe_bool_impl::*type; |
| }; |
| } |
| template <typename DerivedT, typename BaseT = impl::no_base<DerivedT> > |
| struct safe_bool : BaseT |
| { |
| private: |
| typedef impl::safe_bool_impl<DerivedT> impl_t; |
| typedef typename impl_t::type bool_type; |
| public: |
| operator bool_type() const |
| { |
| return static_cast<const DerivedT*>(this)->operator_bool() ? |
| &impl_t::stub : 0; |
| } |
| operator bool_type() |
| { |
| return static_cast<DerivedT*>(this)->operator_bool() ? |
| &impl_t::stub : 0; |
| } |
| }; |
| }} |
| namespace boost { namespace spirit { namespace impl |
| { |
| template <typename T> |
| struct match_attr_traits |
| { |
| typedef typename |
| boost::optional<T>::reference_const_type |
| const_reference; |
| static void |
| convert(boost::optional<T>& dest, const_reference src) |
| { dest.reset(src); } |
| static void |
| convert(boost::optional<T>& dest, ... ) |
| { dest.reset(); } |
| template <typename OtherMatchT> |
| static void |
| copy(boost::optional<T>& dest, OtherMatchT const& src) |
| { |
| if (src.has_valid_attribute()) |
| convert(dest, src.value()); |
| } |
| template <typename OtherMatchT> |
| static void |
| assign(boost::optional<T>& dest, OtherMatchT const& src) |
| { |
| if (src.has_valid_attribute()) |
| convert(dest, src.value()); |
| else |
| dest.reset(); |
| } |
| template <typename ValueT> |
| static void |
| set_value(boost::optional<T>& dest, ValueT const& val, mpl::false_) |
| { |
| dest.reset(val); |
| } |
| template <typename ValueT> |
| static void |
| set_value(boost::optional<T>& dest, ValueT const& val, mpl::true_) |
| { |
| dest.get() = val; |
| } |
| }; |
| }}} |
| namespace boost { |
| template< typename T > struct add_const { typedef T const type; }; |
| template< typename T > struct add_const<T&> { typedef T& type; }; |
| } |
| namespace boost { namespace spirit |
| { |
| template <typename T = nil_t> |
| class match : public safe_bool<match<T> > |
| { |
| public: |
| typedef typename boost::optional<T> optional_type; |
| typedef typename optional_type::argument_type ctor_param_t; |
| typedef typename optional_type::reference_const_type return_t; |
| typedef T attr_t; |
| match(); |
| explicit match(std::size_t length); |
| match(std::size_t length, ctor_param_t val); |
| bool operator!() const; |
| std::ptrdiff_t length() const; |
| bool has_valid_attribute() const; |
| return_t value() const; |
| void swap(match& other); |
| template <typename T2> |
| match(match<T2> const& other) |
| : len(other.length()), val() |
| { |
| impl::match_attr_traits<T>::copy(val, other); |
| } |
| template <typename T2> |
| match& |
| operator=(match<T2> const& other) |
| { |
| impl::match_attr_traits<T>::assign(val, other); |
| len = other.length(); |
| return *this; |
| } |
| template <typename MatchT> |
| void |
| concat(MatchT const& other) |
| { |
| ; |
| len += other.length(); |
| } |
| template <typename ValueT> |
| void |
| value(ValueT const& val_) |
| { |
| impl::match_attr_traits<T>::set_value(val, val_, is_reference<T>()); |
| } |
| bool operator_bool() const |
| { |
| return len >= 0; |
| } |
| private: |
| std::ptrdiff_t len; |
| optional_type val; |
| }; |
| template <> |
| class match<nil_t> : public safe_bool<match<nil_t> > |
| { |
| public: |
| typedef nil_t attr_t; |
| typedef nil_t return_t; |
| match(); |
| explicit match(std::size_t length); |
| match(std::size_t length, nil_t); |
| bool operator!() const; |
| bool has_valid_attribute() const; |
| std::ptrdiff_t length() const; |
| nil_t value() const; |
| void value(nil_t); |
| void swap(match& other); |
| template <typename T> |
| match(match<T> const& other) |
| : len(other.length()) {} |
| template <typename T> |
| match<>& |
| operator=(match<T> const& other) |
| { |
| len = other.length(); |
| return *this; |
| } |
| template <typename T> |
| void |
| concat(match<T> const& other) |
| { |
| ; |
| len += other.length(); |
| } |
| bool operator_bool() const |
| { |
| return len >= 0; |
| } |
| private: |
| std::ptrdiff_t len; |
| }; |
| }} |
| namespace boost { namespace spirit |
| { |
| template <typename T> |
| inline match<T>::match() |
| : len(-1), val() {} |
| template <typename T> |
| inline match<T>::match(std::size_t length) |
| : len(length), val() {} |
| template <typename T> |
| inline match<T>::match(std::size_t length, ctor_param_t val_) |
| : len(length), val(val_) {} |
| template <typename T> |
| inline bool |
| match<T>::operator!() const |
| { |
| return len < 0; |
| } |
| template <typename T> |
| inline std::ptrdiff_t |
| match<T>::length() const |
| { |
| return len; |
| } |
| template <typename T> |
| inline bool |
| match<T>::has_valid_attribute() const |
| { |
| return val.is_initialized(); |
| } |
| template <typename T> |
| inline typename match<T>::return_t |
| match<T>::value() const |
| { |
| ; |
| return *val; |
| } |
| template <typename T> |
| inline void |
| match<T>::swap(match& other) |
| { |
| std::swap(len, other.len); |
| std::swap(val, other.val); |
| } |
| inline match<nil_t>::match() |
| : len(-1) {} |
| inline match<nil_t>::match(std::size_t length) |
| : len(length) {} |
| inline match<nil_t>::match(std::size_t length, nil_t) |
| : len(length) {} |
| inline bool |
| match<nil_t>::operator!() const |
| { |
| return len < 0; |
| } |
| inline bool |
| match<nil_t>::has_valid_attribute() const |
| { |
| return false; |
| } |
| inline std::ptrdiff_t |
| match<nil_t>::length() const |
| { |
| return len; |
| } |
| inline nil_t |
| match<nil_t>::value() const |
| { |
| return nil_t(); |
| } |
| inline void |
| match<nil_t>::value(nil_t) {} |
| inline void |
| match<nil_t>::swap(match& other) |
| { |
| std::swap(len, other.len); |
| } |
| }} |
| #include <iterator> |
| namespace boost { namespace spirit { |
| class parser_id |
| { |
| public: |
| parser_id() : p(0) {} |
| explicit parser_id(void const* prule) : p(prule) {} |
| parser_id(std::size_t l_) : l(l_) {} |
| bool operator==(parser_id const& x) const { return p == x.p; } |
| bool operator!=(parser_id const& x) const { return !(*this == x); } |
| bool operator<(parser_id const& x) const { return p < x.p; } |
| std::size_t to_long() const { return l; } |
| private: |
| union |
| { |
| void const* p; |
| std::size_t l; |
| }; |
| }; |
| struct parser_tag_base {}; |
| struct parser_address_tag : parser_tag_base |
| { |
| parser_id id() const |
| { return parser_id(reinterpret_cast<std::size_t>(this)); } |
| }; |
| template <int N> |
| struct parser_tag : parser_tag_base |
| { |
| static parser_id id() |
| { return parser_id(std::size_t(N)); } |
| }; |
| class dynamic_parser_tag : public parser_tag_base |
| { |
| public: |
| dynamic_parser_tag() |
| : tag(std::size_t(0)) {} |
| parser_id |
| id() const |
| { |
| return |
| tag.to_long() |
| ? tag |
| : parser_id(reinterpret_cast<std::size_t>(this)); |
| } |
| void set_id(parser_id id) { tag = id; } |
| private: |
| parser_id tag; |
| }; |
| }} |
| namespace boost { namespace detail { |
| template <class Iterator> |
| struct iterator_traits |
| : std::iterator_traits<Iterator> |
| {}; |
| using std::distance; |
| }} |
| namespace boost { namespace spirit |
| { |
| struct iteration_policy |
| { |
| template <typename ScannerT> |
| void |
| advance(ScannerT const& scan) const |
| { |
| ++scan.first; |
| } |
| template <typename ScannerT> |
| bool at_end(ScannerT const& scan) const |
| { |
| return scan.first == scan.last; |
| } |
| template <typename T> |
| T filter(T ch) const |
| { |
| return ch; |
| } |
| template <typename ScannerT> |
| typename ScannerT::ref_t |
| get(ScannerT const& scan) const |
| { |
| return *scan.first; |
| } |
| }; |
| struct match_policy |
| { |
| template <typename T> |
| struct result { typedef match<T> type; }; |
| const match<nil_t> |
| no_match() const |
| { |
| return match<nil_t>(); |
| } |
| const match<nil_t> |
| empty_match() const |
| { |
| return match<nil_t>(0, nil_t()); |
| } |
| template <typename AttrT, typename IteratorT> |
| match<AttrT> |
| create_match( |
| std::size_t length, |
| AttrT const& val, |
| IteratorT const& , |
| IteratorT const& ) const |
| { |
| return match<AttrT>(length, val); |
| } |
| template <typename MatchT, typename IteratorT> |
| void group_match( |
| MatchT& , |
| parser_id const& , |
| IteratorT const& , |
| IteratorT const& ) const {} |
| template <typename Match1T, typename Match2T> |
| void concat_match(Match1T& l, Match2T const& r) const |
| { |
| l.concat(r); |
| } |
| }; |
| template <typename MatchPolicyT, typename T> |
| struct match_result |
| { |
| typedef typename MatchPolicyT::template result<T>::type type; |
| }; |
| template <typename AttrT> |
| struct attributed_action_policy |
| { |
| template <typename ActorT, typename IteratorT> |
| static void |
| call( |
| ActorT const& actor, |
| AttrT& val, |
| IteratorT const&, |
| IteratorT const&) |
| { |
| actor(val); |
| } |
| }; |
| template <> |
| struct attributed_action_policy<nil_t> |
| { |
| template <typename ActorT, typename IteratorT> |
| static void |
| call( |
| ActorT const& actor, |
| nil_t, |
| IteratorT const& first, |
| IteratorT const& last) |
| { |
| actor(first, last); |
| } |
| }; |
| struct action_policy |
| { |
| template <typename ActorT, typename AttrT, typename IteratorT> |
| void |
| do_action( |
| ActorT const& actor, |
| AttrT& val, |
| IteratorT const& first, |
| IteratorT const& last) const |
| { |
| attributed_action_policy<AttrT>::call(actor, val, first, last); |
| } |
| }; |
| template < |
| typename IterationPolicyT = iteration_policy, |
| typename MatchPolicyT = match_policy, |
| typename ActionPolicyT = action_policy> |
| struct scanner_policies : |
| public IterationPolicyT, |
| public MatchPolicyT, |
| public ActionPolicyT |
| { |
| typedef IterationPolicyT iteration_policy_t; |
| typedef MatchPolicyT match_policy_t; |
| typedef ActionPolicyT action_policy_t; |
| scanner_policies( |
| IterationPolicyT const& i_policy = IterationPolicyT(), |
| MatchPolicyT const& m_policy = MatchPolicyT(), |
| ActionPolicyT const& a_policy = ActionPolicyT()) |
| : IterationPolicyT(i_policy) |
| , MatchPolicyT(m_policy) |
| , ActionPolicyT(a_policy) {} |
| template <typename ScannerPoliciesT> |
| scanner_policies(ScannerPoliciesT const& policies) |
| : IterationPolicyT(policies) |
| , MatchPolicyT(policies) |
| , ActionPolicyT(policies) {} |
| }; |
| struct scanner_base {}; |
| template < |
| typename IteratorT = char const*, |
| typename PoliciesT = scanner_policies<> > |
| class scanner : public PoliciesT, public scanner_base |
| { |
| public: |
| typedef IteratorT iterator_t; |
| typedef PoliciesT policies_t; |
| typedef typename boost::detail:: |
| iterator_traits<IteratorT>::value_type value_t; |
| typedef typename boost::detail:: |
| iterator_traits<IteratorT>::reference ref_t; |
| typedef typename boost:: |
| call_traits<IteratorT>::param_type iter_param_t; |
| scanner( |
| IteratorT& first_, |
| iter_param_t last_, |
| PoliciesT const& policies = PoliciesT()) |
| : PoliciesT(policies), first(first_), last(last_) |
| { |
| at_end(); |
| } |
| scanner(scanner const& other) |
| : PoliciesT(other), first(other.first), last(other.last) {} |
| scanner(scanner const& other, IteratorT& first_) |
| : PoliciesT(other), first(first_), last(other.last) {} |
| bool |
| at_end() const |
| { |
| typedef typename PoliciesT::iteration_policy_t iteration_policy_t; |
| return iteration_policy_t::at_end(*this); |
| } |
| value_t |
| operator*() const |
| { |
| typedef typename PoliciesT::iteration_policy_t iteration_policy_t; |
| return iteration_policy_t::filter(iteration_policy_t::get(*this)); |
| } |
| scanner const& |
| operator++() const |
| { |
| typedef typename PoliciesT::iteration_policy_t iteration_policy_t; |
| iteration_policy_t::advance(*this); |
| return *this; |
| } |
| template <typename PoliciesT2> |
| struct rebind_policies |
| { |
| typedef scanner<IteratorT, PoliciesT2> type; |
| }; |
| template <typename PoliciesT2> |
| scanner<IteratorT, PoliciesT2> |
| change_policies(PoliciesT2 const& policies) const |
| { |
| return scanner<IteratorT, PoliciesT2>(first, last, policies); |
| } |
| template <typename IteratorT2> |
| struct rebind_iterator |
| { |
| typedef scanner<IteratorT2, PoliciesT> type; |
| }; |
| template <typename IteratorT2> |
| scanner<IteratorT2, PoliciesT> |
| change_iterator(IteratorT2 const& first_, IteratorT2 const &last_) const |
| { |
| return scanner<IteratorT2, PoliciesT>(first_, last_, *this); |
| } |
| IteratorT& first; |
| IteratorT const last; |
| private: |
| scanner& |
| operator=(scanner const& other); |
| }; |
| template <typename ScannerT, typename PoliciesT> |
| struct rebind_scanner_policies |
| { |
| typedef typename ScannerT::template |
| rebind_policies<PoliciesT>::type type; |
| }; |
| template <typename ScannerT, typename IteratorT> |
| struct rebind_scanner_iterator |
| { |
| typedef typename ScannerT::template |
| rebind_iterator<IteratorT>::type type; |
| }; |
| }} |
| namespace boost { namespace spirit |
| { |
| template <typename ParserT, typename ActionT> |
| class action; |
| struct plain_parser_category {}; |
| struct binary_parser_category : plain_parser_category {}; |
| struct unary_parser_category : plain_parser_category {}; |
| struct action_parser_category : unary_parser_category {}; |
| template <typename ParserT, typename ScannerT> |
| struct parser_result |
| { |
| typedef typename ParserT::template result<ScannerT>::type type; |
| }; |
| template <typename DerivedT> |
| struct parser |
| { |
| typedef DerivedT embed_t; |
| typedef DerivedT derived_t; |
| typedef plain_parser_category parser_category_t; |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename match_result<ScannerT, nil_t>::type type; |
| }; |
| DerivedT& derived() |
| { |
| return *static_cast<DerivedT*>(this); |
| } |
| DerivedT const& derived() const |
| { |
| return *static_cast<DerivedT const*>(this); |
| } |
| template <typename ActionT> |
| action<DerivedT, ActionT> |
| operator[](ActionT const& actor) const |
| { |
| return action<DerivedT, ActionT>(derived(), actor); |
| } |
| }; |
| template <typename IteratorT = char const*> |
| struct parse_info |
| { |
| IteratorT stop; |
| bool hit; |
| bool full; |
| std::size_t length; |
| parse_info( |
| IteratorT const& stop_ = IteratorT(), |
| bool hit_ = false, |
| bool full_ = false, |
| std::size_t length_ = 0) |
| : stop(stop_) |
| , hit(hit_) |
| , full(full_) |
| , length(length_) {} |
| template <typename ParseInfoT> |
| parse_info(ParseInfoT const& pi) |
| : stop(pi.stop) |
| , hit(pi.hit) |
| , full(pi.full) |
| , length(pi.length) {} |
| }; |
| template <typename IteratorT, typename DerivedT> |
| parse_info<IteratorT> |
| parse( |
| IteratorT const& first, |
| IteratorT const& last, |
| parser<DerivedT> const& p); |
| template <typename CharT, typename DerivedT> |
| parse_info<CharT const*> |
| parse( |
| CharT const* str, |
| parser<DerivedT> const& p); |
| }} |
| namespace boost { namespace spirit |
| { |
| template <typename IteratorT, typename DerivedT> |
| inline parse_info<IteratorT> |
| parse( |
| IteratorT const& first_ |
| , IteratorT const& last |
| , parser<DerivedT> const& p) |
| { |
| IteratorT first = first_; |
| scanner<IteratorT, scanner_policies<> > scan(first, last); |
| match<nil_t> hit = p.derived().parse(scan); |
| return parse_info<IteratorT>( |
| first, hit, hit && (first == last), hit.length()); |
| } |
| template <typename CharT, typename DerivedT> |
| inline parse_info<CharT const*> |
| parse(CharT const* str, parser<DerivedT> const& p) |
| { |
| CharT const* last = str; |
| while (*last) |
| last++; |
| return parse(str, last, p); |
| } |
| }} |
| namespace boost { |
| template <typename T> T* |
| addressof(T& v) |
| { |
| return reinterpret_cast<T*>( |
| &const_cast<char&>(reinterpret_cast<const volatile char &>(v))); |
| } |
| } |
| namespace boost |
| { |
| template<class T> class reference_wrapper |
| { |
| public: |
| typedef T type; |
| explicit reference_wrapper(T& t): t_(boost::addressof(t)) {} |
| operator T& () const { return *t_; } |
| T& get() const { return *t_; } |
| T* get_pointer() const { return t_; } |
| private: |
| T* t_; |
| }; |
| template<class T> inline reference_wrapper<T> const ref(T & t) |
| { |
| return reference_wrapper<T>(t); |
| } |
| template<class T> inline reference_wrapper<T const> const cref(T const & t) |
| { |
| return reference_wrapper<T const>(t); |
| } |
| template<typename T> |
| class is_reference_wrapper |
| : public mpl::false_ |
| { |
| }; |
| template<typename T> |
| class is_reference_wrapper<reference_wrapper<T> > |
| : public mpl::true_ |
| { |
| }; |
| template<typename T> |
| class unwrap_reference |
| { |
| public: |
| typedef T type; |
| }; |
| template<typename T> |
| class unwrap_reference<reference_wrapper<T> > |
| { |
| public: |
| typedef T type; |
| }; |
| } |
| namespace boost { namespace spirit { |
| template <typename DrivedT> struct char_parser; |
| namespace impl |
| { |
| template <typename IteratorT> |
| inline IteratorT |
| get_last(IteratorT first) |
| { |
| while (*first) |
| first++; |
| return first; |
| } |
| template< |
| typename RT, |
| typename IteratorT, |
| typename ScannerT> |
| inline RT |
| string_parser_parse( |
| IteratorT str_first, |
| IteratorT str_last, |
| ScannerT& scan) |
| { |
| typedef typename ScannerT::iterator_t iterator_t; |
| iterator_t saved = scan.first; |
| std::size_t slen = str_last - str_first; |
| while (str_first != str_last) |
| { |
| if (scan.at_end() || (*str_first != *scan)) |
| return scan.no_match(); |
| ++str_first; |
| ++scan; |
| } |
| return scan.create_match(slen, nil_t(), saved, scan.first); |
| } |
| template <typename CharT> |
| inline typename |
| std::char_traits<CharT>::int_type |
| to_int_type(CharT c) |
| { |
| return std |
| ::char_traits<CharT>::to_int_type(c); |
| } |
| template <typename CharT> |
| inline CharT |
| to_char_type(typename |
| std::char_traits<CharT>::int_type c) |
| { |
| return std |
| ::char_traits<CharT>::to_char_type(c); |
| } |
| inline bool |
| isalnum_(char c) |
| { |
| using namespace std; |
| return isalnum(to_int_type(c)); |
| } |
| inline bool |
| isalpha_(char c) |
| { |
| using namespace std; |
| return isalpha(to_int_type(c)); |
| } |
| inline bool |
| iscntrl_(char c) |
| { |
| using namespace std; |
| return iscntrl(to_int_type(c)); |
| } |
| inline bool |
| isdigit_(char c) |
| { |
| using namespace std; |
| return isdigit(to_int_type(c)); |
| } |
| inline bool |
| isgraph_(char c) |
| { |
| using namespace std; |
| return isgraph(to_int_type(c)); |
| } |
| inline bool |
| islower_(char c) |
| { |
| using namespace std; |
| return islower(to_int_type(c)); |
| } |
| inline bool |
| isprint_(char c) |
| { |
| using namespace std; |
| return isprint(to_int_type(c)); |
| } |
| inline bool |
| ispunct_(char c) |
| { |
| using namespace std; |
| return ispunct(to_int_type(c)); |
| } |
| inline bool |
| isspace_(char c) |
| { |
| using namespace std; |
| return isspace(to_int_type(c)); |
| } |
| inline bool |
| isupper_(char c) |
| { |
| using namespace std; |
| return isupper(to_int_type(c)); } |
| inline bool |
| isxdigit_(char c) |
| { |
| using namespace std; |
| return isxdigit(to_int_type(c)); |
| } |
| inline bool |
| isblank_(char c) |
| { |
| return (c == ' ' || c == '\t'); |
| } |
| inline char |
| tolower_(char c) |
| { |
| using namespace std; |
| return to_char_type<char>(tolower(to_int_type(c))); |
| } |
| inline char |
| toupper_(char c) |
| { |
| using namespace std; |
| return to_char_type<char>(toupper(to_int_type(c))); |
| } |
| }}} |
| namespace boost { namespace spirit { |
| template <typename BaseT> |
| struct no_skipper_iteration_policy; |
| template <typename BaseT = iteration_policy> |
| struct skipper_iteration_policy : public BaseT |
| { |
| typedef BaseT base_t; |
| skipper_iteration_policy() |
| : BaseT() {} |
| template <typename PolicyT> |
| skipper_iteration_policy(PolicyT const& other) |
| : BaseT(other) {} |
| template <typename ScannerT> |
| void |
| advance(ScannerT const& scan) const |
| { |
| BaseT::advance(scan); |
| scan.skip(scan); |
| } |
| template <typename ScannerT> |
| bool |
| at_end(ScannerT const& scan) const |
| { |
| scan.skip(scan); |
| return BaseT::at_end(scan); |
| } |
| template <typename ScannerT> |
| void |
| skip(ScannerT const& scan) const |
| { |
| while (!BaseT::at_end(scan) && impl::isspace_(BaseT::get(scan))) |
| BaseT::advance(scan); |
| } |
| }; |
| namespace impl |
| { |
| template <typename ST, typename ScannerT, typename BaseT> |
| void |
| skipper_skip( |
| ST const& s, |
| ScannerT const& scan, |
| skipper_iteration_policy<BaseT> const&); |
| template <typename ST, typename ScannerT, typename BaseT> |
| void |
| skipper_skip( |
| ST const& s, |
| ScannerT const& scan, |
| no_skipper_iteration_policy<BaseT> const&); |
| template <typename ST, typename ScannerT> |
| void |
| skipper_skip( |
| ST const& s, |
| ScannerT const& scan, |
| iteration_policy const&); |
| } |
| template <typename ParserT, typename BaseT = iteration_policy> |
| class skip_parser_iteration_policy : public skipper_iteration_policy<BaseT> |
| { |
| public: |
| typedef skipper_iteration_policy<BaseT> base_t; |
| skip_parser_iteration_policy( |
| ParserT const& skip_parser, |
| base_t const& base = base_t()) |
| : base_t(base), subject(skip_parser) {} |
| template <typename PolicyT> |
| skip_parser_iteration_policy(PolicyT const& other) |
| : base_t(other), subject(other.skipper()) {} |
| template <typename ScannerT> |
| void |
| skip(ScannerT const& scan) const |
| { |
| impl::skipper_skip(subject, scan, scan); |
| } |
| ParserT const& |
| skipper() const |
| { |
| return subject; |
| } |
| private: |
| ParserT const& subject; |
| }; |
| template <typename IteratorT, typename ParserT, typename SkipT> |
| parse_info<IteratorT> |
| parse( |
| IteratorT const& first, |
| IteratorT const& last, |
| parser<ParserT> const& p, |
| parser<SkipT> const& skip); |
| template <typename CharT, typename ParserT, typename SkipT> |
| parse_info<CharT const*> |
| parse( |
| CharT const* str, |
| parser<ParserT> const& p, |
| parser<SkipT> const& skip); |
| typedef skipper_iteration_policy<> iter_policy_t; |
| typedef scanner_policies<iter_policy_t> scanner_policies_t; |
| typedef scanner<char const*, scanner_policies_t> phrase_scanner_t; |
| typedef scanner<wchar_t const*, scanner_policies_t> wide_phrase_scanner_t; |
| }} |
| namespace boost { namespace spirit { |
| struct space_parser; |
| template <typename BaseT> |
| struct no_skipper_iteration_policy; |
| namespace impl |
| { |
| template <typename ST, typename ScannerT, typename BaseT> |
| inline void |
| skipper_skip( |
| ST const& s, |
| ScannerT const& scan, |
| skipper_iteration_policy<BaseT> const&) |
| { |
| typedef scanner_policies< |
| no_skipper_iteration_policy< |
| typename ScannerT::iteration_policy_t>, |
| typename ScannerT::match_policy_t, |
| typename ScannerT::action_policy_t |
| > policies_t; |
| scanner<typename ScannerT::iterator_t, policies_t> |
| scan2(scan.first, scan.last, policies_t(scan)); |
| typedef typename ScannerT::iterator_t iterator_t; |
| for (;;) |
| { |
| iterator_t save = scan.first; |
| if (!s.parse(scan2)) |
| { |
| scan.first = save; |
| break; |
| } |
| } |
| } |
| template <typename ST, typename ScannerT, typename BaseT> |
| inline void |
| skipper_skip( |
| ST const& s, |
| ScannerT const& scan, |
| no_skipper_iteration_policy<BaseT> const&) |
| { |
| for (;;) |
| { |
| typedef typename ScannerT::iterator_t iterator_t; |
| iterator_t save = scan.first; |
| if (!s.parse(scan)) |
| { |
| scan.first = save; |
| break; |
| } |
| } |
| } |
| template <typename ST, typename ScannerT> |
| inline void |
| skipper_skip( |
| ST const& s, |
| ScannerT const& scan, |
| iteration_policy const&) |
| { |
| for (;;) |
| { |
| typedef typename ScannerT::iterator_t iterator_t; |
| iterator_t save = scan.first; |
| if (!s.parse(scan)) |
| { |
| scan.first = save; |
| break; |
| } |
| } |
| } |
| template <typename SkipT> |
| struct phrase_parser |
| { |
| template <typename IteratorT, typename ParserT> |
| static parse_info<IteratorT> |
| parse( |
| IteratorT const& first_, |
| IteratorT const& last, |
| ParserT const& p, |
| SkipT const& skip) |
| { |
| typedef skip_parser_iteration_policy<SkipT> iter_policy_t; |
| typedef scanner_policies<iter_policy_t> scanner_policies_t; |
| typedef scanner<IteratorT, scanner_policies_t> scanner_t; |
| iter_policy_t iter_policy(skip); |
| scanner_policies_t policies(iter_policy); |
| IteratorT first = first_; |
| scanner_t scan(first, last, policies); |
| match<nil_t> hit = p.parse(scan); |
| scan.skip(scan); |
| return parse_info<IteratorT>( |
| first, hit, hit && (first == last), |
| hit.length()); |
| } |
| }; |
| template <> |
| struct phrase_parser<space_parser> |
| { |
| template <typename IteratorT, typename ParserT> |
| static parse_info<IteratorT> |
| parse( |
| IteratorT const& first_, |
| IteratorT const& last, |
| ParserT const& p, |
| space_parser const&) |
| { |
| typedef skipper_iteration_policy<> iter_policy_t; |
| typedef scanner_policies<iter_policy_t> scanner_policies_t; |
| typedef scanner<IteratorT, scanner_policies_t> scanner_t; |
| IteratorT first = first_; |
| scanner_t scan(first, last); |
| match<nil_t> hit = p.parse(scan); |
| scan.skip(scan); |
| return parse_info<IteratorT>( |
| first, hit, hit && (first == last), |
| hit.length()); |
| } |
| }; |
| } |
| template <typename IteratorT, typename ParserT, typename SkipT> |
| inline parse_info<IteratorT> |
| parse( |
| IteratorT const& first, |
| IteratorT const& last, |
| parser<ParserT> const& p, |
| parser<SkipT> const& skip) |
| { |
| return impl::phrase_parser<SkipT>:: |
| parse(first, last, p.derived(), skip.derived()); |
| } |
| template <typename CharT, typename ParserT, typename SkipT> |
| inline parse_info<CharT const*> |
| parse( |
| CharT const* str, |
| parser<ParserT> const& p, |
| parser<SkipT> const& skip) |
| { |
| CharT const* last = str; |
| while (*last) |
| last++; |
| return parse(str, last, p, skip); |
| } |
| }} |
| namespace boost { namespace spirit { |
| template <typename BaseT> |
| struct no_skipper_iteration_policy; |
| template <typename BaseT> |
| struct inhibit_case_iteration_policy; |
| template <typename A, typename B> |
| struct alternative; |
| template <typename A, typename B> |
| struct longest_alternative; |
| template <typename A, typename B> |
| struct shortest_alternative; |
| namespace impl |
| { |
| template <typename RT, typename ST, typename ScannerT, typename BaseT> |
| inline RT |
| contiguous_parser_parse( |
| ST const& s, |
| ScannerT const& scan, |
| skipper_iteration_policy<BaseT> const&) |
| { |
| typedef scanner_policies< |
| no_skipper_iteration_policy< |
| typename ScannerT::iteration_policy_t>, |
| typename ScannerT::match_policy_t, |
| typename ScannerT::action_policy_t |
| > policies_t; |
| scan.skip(scan); |
| RT hit = s.parse(scan.change_policies(policies_t(scan))); |
| return hit; |
| } |
| template <typename RT, typename ST, typename ScannerT, typename BaseT> |
| inline RT |
| contiguous_parser_parse( |
| ST const& s, |
| ScannerT const& scan, |
| no_skipper_iteration_policy<BaseT> const&) |
| { |
| return s.parse(scan); |
| } |
| template <typename RT, typename ST, typename ScannerT> |
| inline RT |
| contiguous_parser_parse( |
| ST const& s, |
| ScannerT const& scan, |
| iteration_policy const&) |
| { |
| return s.parse(scan); |
| } |
| template < |
| typename RT, |
| typename ParserT, |
| typename ScannerT, |
| typename BaseT> |
| inline RT |
| implicit_lexeme_parse( |
| ParserT const& p, |
| ScannerT const& scan, |
| skipper_iteration_policy<BaseT> const&) |
| { |
| typedef scanner_policies< |
| no_skipper_iteration_policy< |
| typename ScannerT::iteration_policy_t>, |
| typename ScannerT::match_policy_t, |
| typename ScannerT::action_policy_t |
| > policies_t; |
| scan.skip(scan); |
| RT hit = p.parse_main(scan.change_policies(policies_t(scan))); |
| return hit; |
| } |
| template < |
| typename RT, |
| typename ParserT, |
| typename ScannerT, |
| typename BaseT> |
| inline RT |
| implicit_lexeme_parse( |
| ParserT const& p, |
| ScannerT const& scan, |
| no_skipper_iteration_policy<BaseT> const&) |
| { |
| return p.parse_main(scan); |
| } |
| template <typename RT, typename ParserT, typename ScannerT> |
| inline RT |
| implicit_lexeme_parse( |
| ParserT const& p, |
| ScannerT const& scan, |
| iteration_policy const&) |
| { |
| return p.parse_main(scan); |
| } |
| template <typename RT, typename ST, typename ScannerT> |
| inline RT |
| inhibit_case_parser_parse( |
| ST const& s, |
| ScannerT const& scan, |
| iteration_policy const&) |
| { |
| typedef scanner_policies< |
| inhibit_case_iteration_policy< |
| typename ScannerT::iteration_policy_t>, |
| typename ScannerT::match_policy_t, |
| typename ScannerT::action_policy_t |
| > policies_t; |
| return s.parse(scan.change_policies(policies_t(scan))); |
| } |
| template <typename RT, typename ST, typename ScannerT, typename BaseT> |
| inline RT |
| inhibit_case_parser_parse( |
| ST const& s, |
| ScannerT const& scan, |
| inhibit_case_iteration_policy<BaseT> const&) |
| { |
| return s.parse(scan); |
| } |
| template <typename T> |
| struct to_longest_alternative |
| { |
| typedef T result_t; |
| static result_t const& |
| convert(T const& a) |
| { return a; } |
| }; |
| template <typename A, typename B> |
| struct to_longest_alternative<alternative<A, B> > |
| { |
| typedef typename to_longest_alternative<A>::result_t a_t; |
| typedef typename to_longest_alternative<B>::result_t b_t; |
| typedef longest_alternative<a_t, b_t> result_t; |
| static result_t |
| convert(alternative<A, B> const& alt) |
| { |
| return result_t( |
| to_longest_alternative<A>::convert(alt.left()), |
| to_longest_alternative<B>::convert(alt.right())); |
| } |
| }; |
| template <typename T> |
| struct to_shortest_alternative |
| { |
| typedef T result_t; |
| static result_t const& |
| convert(T const& a) |
| { return a; } |
| }; |
| template <typename A, typename B> |
| struct to_shortest_alternative<alternative<A, B> > |
| { |
| typedef typename to_shortest_alternative<A>::result_t a_t; |
| typedef typename to_shortest_alternative<B>::result_t b_t; |
| typedef shortest_alternative<a_t, b_t> result_t; |
| static result_t |
| convert(alternative<A, B> const& alt) |
| { |
| return result_t( |
| to_shortest_alternative<A>::convert(alt.left()), |
| to_shortest_alternative<B>::convert(alt.right())); |
| } |
| }; |
| } |
| }} |
| namespace boost { namespace spirit { |
| template <typename DerivedT> |
| struct char_parser : public parser<DerivedT> |
| { |
| typedef DerivedT self_t; |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename match_result< |
| ScannerT, |
| typename ScannerT::value_t |
| >::type type; |
| }; |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| typedef typename ScannerT::value_t value_t; |
| typedef typename ScannerT::iterator_t iterator_t; |
| if (!scan.at_end()) |
| { |
| value_t ch = *scan; |
| if (this->derived().test(ch)) |
| { |
| iterator_t save(scan.first); |
| ++scan; |
| return scan.create_match(1, ch, save, scan.first); |
| } |
| } |
| return scan.no_match(); |
| } |
| }; |
| template <typename PositiveT> |
| struct negated_char_parser |
| : public char_parser<negated_char_parser<PositiveT> > |
| { |
| typedef negated_char_parser<PositiveT> self_t; |
| typedef PositiveT positive_t; |
| negated_char_parser(positive_t const& p) |
| : positive(p.derived()) {} |
| template <typename T> |
| bool test(T ch) const |
| { |
| return !positive.test(ch); |
| } |
| positive_t const positive; |
| }; |
| template <typename ParserT> |
| inline negated_char_parser<ParserT> |
| operator~(char_parser<ParserT> const& p) |
| { |
| return negated_char_parser<ParserT>(p.derived()); |
| } |
| template <typename ParserT> |
| inline ParserT |
| operator~(negated_char_parser<ParserT> const& n) |
| { |
| return n.positive; |
| } |
| template <typename CharT = char> |
| struct chlit : public char_parser<chlit<CharT> > |
| { |
| chlit(CharT ch_) |
| : ch(ch_) {} |
| template <typename T> |
| bool test(T ch_) const |
| { |
| return ch_ == ch; |
| } |
| CharT ch; |
| }; |
| template <typename CharT> |
| inline chlit<CharT> |
| ch_p(CharT ch) |
| { |
| return chlit<CharT>(ch); |
| } |
| template <typename CharT = char> |
| struct range : public char_parser<range<CharT> > |
| { |
| range(CharT first_, CharT last_) |
| : first(first_), last(last_) |
| { |
| ; |
| } |
| template <typename T> |
| bool test(T ch) const |
| { |
| return !(CharT(ch) < first) && !(last < CharT(ch)); |
| } |
| CharT first; |
| CharT last; |
| }; |
| template <typename CharT> |
| inline range<CharT> |
| range_p(CharT first, CharT last) |
| { |
| return range<CharT>(first, last); |
| } |
| template <typename IteratorT = char const*> |
| class chseq : public parser<chseq<IteratorT> > |
| { |
| public: |
| typedef chseq<IteratorT> self_t; |
| chseq(IteratorT first_, IteratorT last_) |
| : first(first_), last(last_) {} |
| chseq(IteratorT first_) |
| : first(first_), last(impl::get_last(first_)) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename boost::unwrap_reference<IteratorT>::type striter_t; |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| return impl::string_parser_parse<result_t>( |
| striter_t(first), |
| striter_t(last), |
| scan); |
| } |
| private: |
| IteratorT first; |
| IteratorT last; |
| }; |
| template <typename CharT> |
| inline chseq<CharT const*> |
| chseq_p(CharT const* str) |
| { |
| return chseq<CharT const*>(str); |
| } |
| template <typename IteratorT> |
| inline chseq<IteratorT> |
| chseq_p(IteratorT first, IteratorT last) |
| { |
| return chseq<IteratorT>(first, last); |
| } |
| template <typename IteratorT = char const*> |
| class strlit : public parser<strlit<IteratorT> > |
| { |
| public: |
| typedef strlit<IteratorT> self_t; |
| strlit(IteratorT first, IteratorT last) |
| : seq(first, last) {} |
| strlit(IteratorT first) |
| : seq(first) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| return impl::contiguous_parser_parse<result_t> |
| (seq, scan, scan); |
| } |
| private: |
| chseq<IteratorT> seq; |
| }; |
| template <typename CharT> |
| inline strlit<CharT const*> |
| str_p(CharT const* str) |
| { |
| return strlit<CharT const*>(str); |
| } |
| template <typename IteratorT> |
| inline strlit<IteratorT> |
| str_p(IteratorT first, IteratorT last) |
| { |
| return strlit<IteratorT>(first, last); |
| } |
| struct nothing_parser : public parser<nothing_parser> |
| { |
| typedef nothing_parser self_t; |
| nothing_parser() {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| return scan.no_match(); |
| } |
| }; |
| nothing_parser const nothing_p = nothing_parser(); |
| struct anychar_parser : public char_parser<anychar_parser> |
| { |
| typedef anychar_parser self_t; |
| anychar_parser() {} |
| template <typename CharT> |
| bool test(CharT) const |
| { |
| return true; |
| } |
| }; |
| anychar_parser const anychar_p = anychar_parser(); |
| inline nothing_parser |
| operator~(anychar_parser) |
| { |
| return nothing_p; |
| } |
| struct alnum_parser : public char_parser<alnum_parser> |
| { |
| typedef alnum_parser self_t; |
| alnum_parser() {} |
| template <typename CharT> |
| bool test(CharT ch) const |
| { |
| return impl::isalnum_(ch); |
| } |
| }; |
| alnum_parser const alnum_p = alnum_parser(); |
| struct alpha_parser : public char_parser<alpha_parser> |
| { |
| typedef alpha_parser self_t; |
| alpha_parser() {} |
| template <typename CharT> |
| bool test(CharT ch) const |
| { |
| return impl::isalpha_(ch); |
| } |
| }; |
| alpha_parser const alpha_p = alpha_parser(); |
| struct cntrl_parser : public char_parser<cntrl_parser> |
| { |
| typedef cntrl_parser self_t; |
| cntrl_parser() {} |
| template <typename CharT> |
| bool test(CharT ch) const |
| { |
| return impl::iscntrl_(ch); |
| } |
| }; |
| cntrl_parser const cntrl_p = cntrl_parser(); |
| struct digit_parser : public char_parser<digit_parser> |
| { |
| typedef digit_parser self_t; |
| digit_parser() {} |
| template <typename CharT> |
| bool test(CharT ch) const |
| { |
| return impl::isdigit_(ch); |
| } |
| }; |
| digit_parser const digit_p = digit_parser(); |
| struct graph_parser : public char_parser<graph_parser> |
| { |
| typedef graph_parser self_t; |
| graph_parser() {} |
| template <typename CharT> |
| bool test(CharT ch) const |
| { |
| return impl::isgraph_(ch); |
| } |
| }; |
| graph_parser const graph_p = graph_parser(); |
| struct lower_parser : public char_parser<lower_parser> |
| { |
| typedef lower_parser self_t; |
| lower_parser() {} |
| template <typename CharT> |
| bool test(CharT ch) const |
| { |
| return impl::islower_(ch); |
| } |
| }; |
| lower_parser const lower_p = lower_parser(); |
| struct print_parser : public char_parser<print_parser> |
| { |
| typedef print_parser self_t; |
| print_parser() {} |
| template <typename CharT> |
| bool test(CharT ch) const |
| { |
| return impl::isprint_(ch); |
| } |
| }; |
| print_parser const print_p = print_parser(); |
| struct punct_parser : public char_parser<punct_parser> |
| { |
| typedef punct_parser self_t; |
| punct_parser() {} |
| template <typename CharT> |
| bool test(CharT ch) const |
| { |
| return impl::ispunct_(ch); |
| } |
| }; |
| punct_parser const punct_p = punct_parser(); |
| struct blank_parser : public char_parser<blank_parser> |
| { |
| typedef blank_parser self_t; |
| blank_parser() {} |
| template <typename CharT> |
| bool test(CharT ch) const |
| { |
| return impl::isblank_(ch); |
| } |
| }; |
| blank_parser const blank_p = blank_parser(); |
| struct space_parser : public char_parser<space_parser> |
| { |
| typedef space_parser self_t; |
| space_parser() {} |
| template <typename CharT> |
| bool test(CharT ch) const |
| { |
| return impl::isspace_(ch); |
| } |
| }; |
| space_parser const space_p = space_parser(); |
| struct upper_parser : public char_parser<upper_parser> |
| { |
| typedef upper_parser self_t; |
| upper_parser() {} |
| template <typename CharT> |
| bool test(CharT ch) const |
| { |
| return impl::isupper_(ch); |
| } |
| }; |
| upper_parser const upper_p = upper_parser(); |
| struct xdigit_parser : public char_parser<xdigit_parser> |
| { |
| typedef xdigit_parser self_t; |
| xdigit_parser() {} |
| template <typename CharT> |
| bool test(CharT ch) const |
| { |
| return impl::isxdigit_(ch); |
| } |
| }; |
| xdigit_parser const xdigit_p = xdigit_parser(); |
| struct eol_parser : public parser<eol_parser> |
| { |
| typedef eol_parser self_t; |
| eol_parser() {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typename ScannerT::iterator_t save = scan.first; |
| std::size_t len = 0; |
| if (!scan.at_end() && *scan == '\r') |
| { |
| ++scan; |
| ++len; |
| } |
| if (!scan.at_end() && *scan == '\n') |
| { |
| ++scan; |
| ++len; |
| } |
| if (len) |
| return scan.create_match(len, nil_t(), save, scan.first); |
| return scan.no_match(); |
| } |
| }; |
| eol_parser const eol_p = eol_parser(); |
| struct end_parser : public parser<end_parser> |
| { |
| typedef end_parser self_t; |
| end_parser() {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| if (scan.at_end()) |
| return scan.empty_match(); |
| return scan.no_match(); |
| } |
| }; |
| end_parser const end_p = end_parser(); |
| inline strlit<char const*> const |
| pizza_p(char const* your_favorite_pizza) |
| { |
| return your_favorite_pizza; |
| } |
| }} |
| namespace boost { |
| template< typename T > struct is_const : mpl::bool_< ::boost::detail::cv_traits_imp<T*>::is_const > { }; |
| template< typename T > struct is_const< T& > : mpl::bool_< false > { }; |
| } |
| namespace boost { |
| namespace detail { |
| template <typename T> |
| struct has_trivial_assign_impl |
| { |
| static const bool value = (::boost::type_traits::ice_and< ::boost::type_traits::ice_or< ::boost::is_pod<T>::value, false >::value, ::boost::type_traits::ice_not< ::boost::is_const<T>::value >::value, ::boost::type_traits::ice_not< ::boost::is_volatile<T>::value >::value >::value); |
| }; |
| } |
| template< typename T > struct has_trivial_assign : mpl::bool_< ::boost::detail::has_trivial_assign_impl<T>::value > { }; |
| } |
| namespace boost { |
| namespace detail { |
| template <typename T> |
| struct has_trivial_ctor_impl |
| { |
| static const bool value = (::boost::type_traits::ice_or< ::boost::is_pod<T>::value, false >::value); |
| }; |
| } |
| template< typename T > struct has_trivial_constructor : mpl::bool_< ::boost::detail::has_trivial_ctor_impl<T>::value > { }; |
| } |
| namespace boost { |
| namespace detail { |
| template <typename T> |
| struct has_trivial_dtor_impl |
| { |
| static const bool value = (::boost::type_traits::ice_or< ::boost::is_pod<T>::value, false >::value); |
| }; |
| } |
| template< typename T > struct has_trivial_destructor : mpl::bool_< ::boost::detail::has_trivial_dtor_impl<T>::value > { }; |
| } |
| namespace boost { |
| template< typename T > struct has_nothrow_constructor : mpl::bool_< ::boost::has_trivial_constructor<T>::value > { }; |
| } |
| namespace boost { |
| template< typename T > struct has_nothrow_assign : mpl::bool_< ::boost::has_trivial_assign<T>::value > { }; |
| } |
| namespace boost { |
| template< typename T, typename U > struct is_same : mpl::bool_< false > { }; |
| template< typename T > struct is_same< T,T > : mpl::bool_< true > { }; |
| } |
| namespace boost { |
| namespace detail { |
| template <typename B, typename D> |
| struct bd_helper |
| { |
| template <typename T> |
| static type_traits::yes_type check(D const volatile *, T); |
| static type_traits::no_type check(B const volatile *, int); |
| }; |
| template<typename B, typename D> |
| struct is_base_and_derived_impl2 |
| { |
| struct Host |
| { |
| operator B const volatile *() const; |
| operator D const volatile *(); |
| }; |
| static const bool value = sizeof(bd_helper<B,D>::check(Host(), 0)) == sizeof(type_traits::yes_type); |
| }; |
| template <typename B, typename D> |
| struct is_base_and_derived_impl3 |
| { |
| static const bool value = false; |
| }; |
| template <bool ic1, bool ic2, bool iss> |
| struct is_base_and_derived_select |
| { |
| template <class T, class U> |
| struct rebind |
| { |
| typedef is_base_and_derived_impl3<T,U> type; |
| }; |
| }; |
| template <> |
| struct is_base_and_derived_select<true,true,false> |
| { |
| template <class T, class U> |
| struct rebind |
| { |
| typedef is_base_and_derived_impl2<T,U> type; |
| }; |
| }; |
| template <typename B, typename D> |
| struct is_base_and_derived_impl |
| { |
| typedef typename remove_cv<B>::type ncvB; |
| typedef typename remove_cv<D>::type ncvD; |
| typedef is_base_and_derived_select< |
| ::boost::is_class<B>::value, |
| ::boost::is_class<D>::value, |
| ::boost::is_same<B,D>::value> selector; |
| typedef typename selector::template rebind<ncvB,ncvD> binder; |
| typedef typename binder::type bound_type; |
| static const bool value = bound_type::value; |
| }; |
| } |
| template< typename Base, typename Derived > struct is_base_and_derived : mpl::bool_< (::boost::detail::is_base_and_derived_impl<Base,Derived>::value) > { }; |
| template< typename Base, typename Derived > struct is_base_and_derived< Base&,Derived > : mpl::bool_< false > { }; |
| template< typename Base, typename Derived > struct is_base_and_derived< Base,Derived& > : mpl::bool_< false > { }; |
| template< typename Base, typename Derived > struct is_base_and_derived< Base&,Derived& > : mpl::bool_< false > { }; |
| } |
| namespace boost { |
| namespace detail { |
| template <typename T> |
| struct is_compound_impl |
| { |
| static const bool value = (::boost::type_traits::ice_not< ::boost::is_fundamental<T>::value >::value); |
| }; |
| } |
| template< typename T > struct is_compound : mpl::bool_< ::boost::detail::is_compound_impl<T>::value > { }; |
| } |
| namespace boost { |
| namespace detail { |
| template <typename T> |
| struct empty_helper_t1 : public T |
| { |
| empty_helper_t1(); |
| int i[256]; |
| }; |
| struct empty_helper_t2 { int i[256]; }; |
| template <typename T, bool is_a_class = false> |
| struct empty_helper |
| { |
| static const bool value = false; |
| }; |
| template <typename T> |
| struct empty_helper<T, true> |
| { |
| static const bool value = (sizeof(empty_helper_t1<T>) == sizeof(empty_helper_t2)); |
| }; |
| template <typename T> |
| struct is_empty_impl |
| { |
| typedef typename remove_cv<T>::type cvt; |
| static const bool value = ( ::boost::type_traits::ice_or< ::boost::detail::empty_helper<cvt,::boost::is_class<T>::value>::value , false >::value ); |
| }; |
| template<> struct is_empty_impl< void > { static const bool value = (false); }; |
| template<> struct is_empty_impl< void const > { static const bool value = (false); }; |
| template<> struct is_empty_impl< void volatile > { static const bool value = (false); }; |
| template<> struct is_empty_impl< void const volatile > { static const bool value = (false); }; |
| } |
| template< typename T > struct is_empty : mpl::bool_< ::boost::detail::is_empty_impl<T>::value > { }; |
| } |
| namespace boost { |
| namespace detail { |
| template <typename T> |
| struct is_object_impl |
| { |
| static const bool value = (::boost::type_traits::ice_and< ::boost::type_traits::ice_not< ::boost::is_reference<T>::value>::value, ::boost::type_traits::ice_not< ::boost::is_void<T>::value>::value, ::boost::type_traits::ice_not< ::boost::is_function<T>::value>::value >::value); |
| }; |
| } |
| template< typename T > struct is_object : mpl::bool_< ::boost::detail::is_object_impl<T>::value > { }; |
| } |
| namespace boost { |
| namespace detail { |
| template <typename T> |
| struct is_stateless_impl |
| { |
| static const bool value = (::boost::type_traits::ice_and< ::boost::has_trivial_constructor<T>::value, ::boost::has_trivial_copy<T>::value, ::boost::has_trivial_destructor<T>::value, ::boost::is_class<T>::value, ::boost::is_empty<T>::value >::value); |
| }; |
| } |
| template< typename T > struct is_stateless : mpl::bool_< ::boost::detail::is_stateless_impl<T>::value > { }; |
| } |
| namespace boost |
| { |
| template <class T1, class T2> |
| class compressed_pair; |
| namespace details |
| { |
| template <class T1, class T2, bool IsSame, bool FirstEmpty, bool SecondEmpty> |
| struct compressed_pair_switch; |
| template <class T1, class T2> |
| struct compressed_pair_switch<T1, T2, false, false, false> |
| {static const int value = 0;}; |
| template <class T1, class T2> |
| struct compressed_pair_switch<T1, T2, false, true, true> |
| {static const int value = 3;}; |
| template <class T1, class T2> |
| struct compressed_pair_switch<T1, T2, false, true, false> |
| {static const int value = 1;}; |
| template <class T1, class T2> |
| struct compressed_pair_switch<T1, T2, false, false, true> |
| {static const int value = 2;}; |
| template <class T1, class T2> |
| struct compressed_pair_switch<T1, T2, true, true, true> |
| {static const int value = 4;}; |
| template <class T1, class T2> |
| struct compressed_pair_switch<T1, T2, true, false, false> |
| {static const int value = 5;}; |
| template <class T1, class T2, int Version> class compressed_pair_imp; |
| using std::swap; |
| template <typename T> |
| inline void cp_swap(T& t1, T& t2) |
| { |
| swap(t1, t2); |
| } |
| template <class T1, class T2> |
| class compressed_pair_imp<T1, T2, 0> |
| { |
| public: |
| typedef T1 first_type; |
| typedef T2 second_type; |
| typedef typename call_traits<first_type>::param_type first_param_type; |
| typedef typename call_traits<second_type>::param_type second_param_type; |
| typedef typename call_traits<first_type>::reference first_reference; |
| typedef typename call_traits<second_type>::reference second_reference; |
| typedef typename call_traits<first_type>::const_reference first_const_reference; |
| typedef typename call_traits<second_type>::const_reference second_const_reference; |
| compressed_pair_imp() {} |
| compressed_pair_imp(first_param_type x, second_param_type y) |
| : first_(x), second_(y) {} |
| compressed_pair_imp(first_param_type x) |
| : first_(x) {} |
| compressed_pair_imp(second_param_type y) |
| : second_(y) {} |
| first_reference first() {return first_;} |
| first_const_reference first() const {return first_;} |
| second_reference second() {return second_;} |
| second_const_reference second() const {return second_;} |
| void swap(::boost::compressed_pair<T1, T2>& y) |
| { |
| cp_swap(first_, y.first()); |
| cp_swap(second_, y.second()); |
| } |
| private: |
| first_type first_; |
| second_type second_; |
| }; |
| template <class T1, class T2> |
| class compressed_pair_imp<T1, T2, 1> |
| : private T1 |
| { |
| public: |
| typedef T1 first_type; |
| typedef T2 second_type; |
| typedef typename call_traits<first_type>::param_type first_param_type; |
| typedef typename call_traits<second_type>::param_type second_param_type; |
| typedef typename call_traits<first_type>::reference first_reference; |
| typedef typename call_traits<second_type>::reference second_reference; |
| typedef typename call_traits<first_type>::const_reference first_const_reference; |
| typedef typename call_traits<second_type>::const_reference second_const_reference; |
| compressed_pair_imp() {} |
| compressed_pair_imp(first_param_type x, second_param_type y) |
| : first_type(x), second_(y) {} |
| compressed_pair_imp(first_param_type x) |
| : first_type(x) {} |
| compressed_pair_imp(second_param_type y) |
| : second_(y) {} |
| first_reference first() {return *this;} |
| first_const_reference first() const {return *this;} |
| second_reference second() {return second_;} |
| second_const_reference second() const {return second_;} |
| void swap(::boost::compressed_pair<T1,T2>& y) |
| { |
| cp_swap(second_, y.second()); |
| } |
| private: |
| second_type second_; |
| }; |
| template <class T1, class T2> |
| class compressed_pair_imp<T1, T2, 2> |
| : private T2 |
| { |
| public: |
| typedef T1 first_type; |
| typedef T2 second_type; |
| typedef typename call_traits<first_type>::param_type first_param_type; |
| typedef typename call_traits<second_type>::param_type second_param_type; |
| typedef typename call_traits<first_type>::reference first_reference; |
| typedef typename call_traits<second_type>::reference second_reference; |
| typedef typename call_traits<first_type>::const_reference first_const_reference; |
| typedef typename call_traits<second_type>::const_reference second_const_reference; |
| compressed_pair_imp() {} |
| compressed_pair_imp(first_param_type x, second_param_type y) |
| : second_type(y), first_(x) {} |
| compressed_pair_imp(first_param_type x) |
| : first_(x) {} |
| compressed_pair_imp(second_param_type y) |
| : second_type(y) {} |
| first_reference first() {return first_;} |
| first_const_reference first() const {return first_;} |
| second_reference second() {return *this;} |
| second_const_reference second() const {return *this;} |
| void swap(::boost::compressed_pair<T1,T2>& y) |
| { |
| cp_swap(first_, y.first()); |
| } |
| private: |
| first_type first_; |
| }; |
| template <class T1, class T2> |
| class compressed_pair_imp<T1, T2, 3> |
| : private T1, |
| private T2 |
| { |
| public: |
| typedef T1 first_type; |
| typedef T2 second_type; |
| typedef typename call_traits<first_type>::param_type first_param_type; |
| typedef typename call_traits<second_type>::param_type second_param_type; |
| typedef typename call_traits<first_type>::reference first_reference; |
| typedef typename call_traits<second_type>::reference second_reference; |
| typedef typename call_traits<first_type>::const_reference first_const_reference; |
| typedef typename call_traits<second_type>::const_reference second_const_reference; |
| compressed_pair_imp() {} |
| compressed_pair_imp(first_param_type x, second_param_type y) |
| : first_type(x), second_type(y) {} |
| compressed_pair_imp(first_param_type x) |
| : first_type(x) {} |
| compressed_pair_imp(second_param_type y) |
| : second_type(y) {} |
| first_reference first() {return *this;} |
| first_const_reference first() const {return *this;} |
| second_reference second() {return *this;} |
| second_const_reference second() const {return *this;} |
| void swap(::boost::compressed_pair<T1,T2>&) {} |
| }; |
| template <class T1, class T2> |
| class compressed_pair_imp<T1, T2, 4> |
| : private T1 |
| { |
| public: |
| typedef T1 first_type; |
| typedef T2 second_type; |
| typedef typename call_traits<first_type>::param_type first_param_type; |
| typedef typename call_traits<second_type>::param_type second_param_type; |
| typedef typename call_traits<first_type>::reference first_reference; |
| typedef typename call_traits<second_type>::reference second_reference; |
| typedef typename call_traits<first_type>::const_reference first_const_reference; |
| typedef typename call_traits<second_type>::const_reference second_const_reference; |
| compressed_pair_imp() {} |
| compressed_pair_imp(first_param_type x, second_param_type) |
| : first_type(x) {} |
| compressed_pair_imp(first_param_type x) |
| : first_type(x) {} |
| first_reference first() {return *this;} |
| first_const_reference first() const {return *this;} |
| second_reference second() {return *this;} |
| second_const_reference second() const {return *this;} |
| void swap(::boost::compressed_pair<T1,T2>&) {} |
| private: |
| }; |
| template <class T1, class T2> |
| class compressed_pair_imp<T1, T2, 5> |
| { |
| public: |
| typedef T1 first_type; |
| typedef T2 second_type; |
| typedef typename call_traits<first_type>::param_type first_param_type; |
| typedef typename call_traits<second_type>::param_type second_param_type; |
| typedef typename call_traits<first_type>::reference first_reference; |
| typedef typename call_traits<second_type>::reference second_reference; |
| typedef typename call_traits<first_type>::const_reference first_const_reference; |
| typedef typename call_traits<second_type>::const_reference second_const_reference; |
| compressed_pair_imp() {} |
| compressed_pair_imp(first_param_type x, second_param_type y) |
| : first_(x), second_(y) {} |
| compressed_pair_imp(first_param_type x) |
| : first_(x), second_(x) {} |
| first_reference first() {return first_;} |
| first_const_reference first() const {return first_;} |
| second_reference second() {return second_;} |
| second_const_reference second() const {return second_;} |
| void swap(::boost::compressed_pair<T1, T2>& y) |
| { |
| cp_swap(first_, y.first()); |
| cp_swap(second_, y.second()); |
| } |
| private: |
| first_type first_; |
| second_type second_; |
| }; |
| } |
| template <class T1, class T2> |
| class compressed_pair |
| : private ::boost::details::compressed_pair_imp<T1, T2, |
| ::boost::details::compressed_pair_switch< |
| T1, |
| T2, |
| ::boost::is_same<typename remove_cv<T1>::type, typename remove_cv<T2>::type>::value, |
| ::boost::is_empty<T1>::value, |
| ::boost::is_empty<T2>::value>::value> |
| { |
| private: |
| typedef details::compressed_pair_imp<T1, T2, |
| ::boost::details::compressed_pair_switch< |
| T1, |
| T2, |
| ::boost::is_same<typename remove_cv<T1>::type, typename remove_cv<T2>::type>::value, |
| ::boost::is_empty<T1>::value, |
| ::boost::is_empty<T2>::value>::value> base; |
| public: |
| typedef T1 first_type; |
| typedef T2 second_type; |
| typedef typename call_traits<first_type>::param_type first_param_type; |
| typedef typename call_traits<second_type>::param_type second_param_type; |
| typedef typename call_traits<first_type>::reference first_reference; |
| typedef typename call_traits<second_type>::reference second_reference; |
| typedef typename call_traits<first_type>::const_reference first_const_reference; |
| typedef typename call_traits<second_type>::const_reference second_const_reference; |
| compressed_pair() : base() {} |
| compressed_pair(first_param_type x, second_param_type y) : base(x, y) {} |
| explicit compressed_pair(first_param_type x) : base(x) {} |
| explicit compressed_pair(second_param_type y) : base(y) {} |
| first_reference first() {return base::first();} |
| first_const_reference first() const {return base::first();} |
| second_reference second() {return base::second();} |
| second_const_reference second() const {return base::second();} |
| void swap(compressed_pair& y) { base::swap(y); } |
| }; |
| template <class T> |
| class compressed_pair<T, T> |
| : private details::compressed_pair_imp<T, T, |
| ::boost::details::compressed_pair_switch< |
| T, |
| T, |
| ::boost::is_same<typename remove_cv<T>::type, typename remove_cv<T>::type>::value, |
| ::boost::is_empty<T>::value, |
| ::boost::is_empty<T>::value>::value> |
| { |
| private: |
| typedef details::compressed_pair_imp<T, T, |
| ::boost::details::compressed_pair_switch< |
| T, |
| T, |
| ::boost::is_same<typename remove_cv<T>::type, typename remove_cv<T>::type>::value, |
| ::boost::is_empty<T>::value, |
| ::boost::is_empty<T>::value>::value> base; |
| public: |
| typedef T first_type; |
| typedef T second_type; |
| typedef typename call_traits<first_type>::param_type first_param_type; |
| typedef typename call_traits<second_type>::param_type second_param_type; |
| typedef typename call_traits<first_type>::reference first_reference; |
| typedef typename call_traits<second_type>::reference second_reference; |
| typedef typename call_traits<first_type>::const_reference first_const_reference; |
| typedef typename call_traits<second_type>::const_reference second_const_reference; |
| compressed_pair() : base() {} |
| compressed_pair(first_param_type x, second_param_type y) : base(x, y) {} |
| explicit |
| compressed_pair(first_param_type x) : base(x) {} |
| first_reference first() {return base::first();} |
| first_const_reference first() const {return base::first();} |
| second_reference second() {return base::second();} |
| second_const_reference second() const {return base::second();} |
| void swap(::boost::compressed_pair<T,T>& y) { base::swap(y); } |
| }; |
| template <class T1, class T2> |
| inline |
| void |
| swap(compressed_pair<T1, T2>& x, compressed_pair<T1, T2>& y) |
| { |
| x.swap(y); |
| } |
| } |
| namespace boost { namespace spirit { |
| template <typename S, typename BaseT> |
| class unary : public BaseT |
| { |
| public: |
| typedef BaseT base_t; |
| typedef typename boost::call_traits<S>::param_type param_t; |
| typedef typename boost::call_traits<S>::const_reference return_t; |
| typedef S subject_t; |
| typedef typename S::embed_t subject_embed_t; |
| unary(param_t subj_) |
| : base_t(), subj(subj_) {} |
| unary(BaseT const& base, param_t subj_) |
| : base_t(base), subj(subj_) {} |
| return_t |
| subject() const |
| { return subj; } |
| private: |
| subject_embed_t subj; |
| }; |
| template <typename A, typename B, typename BaseT> |
| class binary : public BaseT |
| { |
| public: |
| typedef BaseT base_t; |
| typedef typename boost::call_traits<A>::param_type left_param_t; |
| typedef typename boost::call_traits<A>::const_reference left_return_t; |
| typedef typename boost::call_traits<B>::param_type right_param_t; |
| typedef typename boost::call_traits<B>::const_reference right_return_t; |
| typedef A left_t; |
| typedef typename A::embed_t left_embed_t; |
| typedef B right_t; |
| typedef typename B::embed_t right_embed_t; |
| binary(left_param_t a, right_param_t b) |
| : base_t(), subj(a, b) {} |
| left_return_t |
| left() const |
| { return subj.first(); } |
| right_return_t |
| right() const |
| { return subj.second(); } |
| private: |
| boost::compressed_pair<left_embed_t, right_embed_t> subj; |
| }; |
| }} |
| namespace boost { namespace spirit { |
| template <typename BaseT> |
| struct no_skipper_iteration_policy : public BaseT |
| { |
| typedef BaseT base_t; |
| no_skipper_iteration_policy() |
| : BaseT() {} |
| template <typename PolicyT> |
| no_skipper_iteration_policy(PolicyT const& other) |
| : BaseT(other) {} |
| template <typename ScannerT> |
| void |
| skip(ScannerT const& ) const {} |
| }; |
| struct lexeme_parser_gen; |
| template <typename ParserT> |
| struct contiguous |
| : public unary<ParserT, parser<contiguous<ParserT> > > |
| { |
| typedef contiguous<ParserT> self_t; |
| typedef unary_parser_category parser_category_t; |
| typedef lexeme_parser_gen parser_generator_t; |
| typedef unary<ParserT, parser<self_t> > base_t; |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename parser_result<ParserT, ScannerT>::type type; |
| }; |
| contiguous(ParserT const& p) |
| : base_t(p) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| return impl::contiguous_parser_parse<result_t> |
| (this->subject(), scan, scan); |
| } |
| }; |
| struct lexeme_parser_gen |
| { |
| template <typename ParserT> |
| struct result { |
| typedef contiguous<ParserT> type; |
| }; |
| template <typename ParserT> |
| static contiguous<ParserT> |
| generate(parser<ParserT> const& subject) |
| { |
| return contiguous<ParserT>(subject.derived()); |
| } |
| template <typename ParserT> |
| contiguous<ParserT> |
| operator[](parser<ParserT> const& subject) const |
| { |
| return contiguous<ParserT>(subject.derived()); |
| } |
| }; |
| const lexeme_parser_gen lexeme_d = lexeme_parser_gen(); |
| template <typename ScannerT> |
| struct lexeme_scanner |
| { |
| typedef scanner_policies< |
| no_skipper_iteration_policy< |
| typename ScannerT::iteration_policy_t>, |
| typename ScannerT::match_policy_t, |
| typename ScannerT::action_policy_t |
| > policies_t; |
| typedef typename |
| rebind_scanner_policies<ScannerT, policies_t>::type type; |
| }; |
| template <typename BaseT> |
| struct inhibit_case_iteration_policy : public BaseT |
| { |
| typedef BaseT base_t; |
| inhibit_case_iteration_policy() |
| : BaseT() {} |
| template <typename PolicyT> |
| inhibit_case_iteration_policy(PolicyT const& other) |
| : BaseT(other) {} |
| template <typename CharT> |
| CharT filter(CharT ch) const |
| { return impl::tolower_(ch); } |
| }; |
| struct inhibit_case_parser_gen; |
| template <typename ParserT> |
| struct inhibit_case |
| : public unary<ParserT, parser<inhibit_case<ParserT> > > |
| { |
| typedef inhibit_case<ParserT> self_t; |
| typedef unary_parser_category parser_category_t; |
| typedef inhibit_case_parser_gen parser_generator_t; |
| typedef unary<ParserT, parser<self_t> > base_t; |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename parser_result<ParserT, ScannerT>::type type; |
| }; |
| inhibit_case(ParserT const& p) |
| : base_t(p) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| return impl::inhibit_case_parser_parse<result_t> |
| (this->subject(), scan, scan); |
| } |
| }; |
| template <int N> |
| struct inhibit_case_parser_gen_base |
| { |
| static inhibit_case<strlit<char const*> > |
| generate(char const* str) |
| { return inhibit_case<strlit<char const*> >(str); } |
| static inhibit_case<strlit<wchar_t const*> > |
| generate(wchar_t const* str) |
| { return inhibit_case<strlit<wchar_t const*> >(str); } |
| static inhibit_case<chlit<char> > |
| generate(char ch) |
| { return inhibit_case<chlit<char> >(ch); } |
| static inhibit_case<chlit<wchar_t> > |
| generate(wchar_t ch) |
| { return inhibit_case<chlit<wchar_t> >(ch); } |
| template <typename ParserT> |
| static inhibit_case<ParserT> |
| generate(parser<ParserT> const& subject) |
| { return inhibit_case<ParserT>(subject.derived()); } |
| inhibit_case<strlit<char const*> > |
| operator[](char const* str) const |
| { return inhibit_case<strlit<char const*> >(str); } |
| inhibit_case<strlit<wchar_t const*> > |
| operator[](wchar_t const* str) const |
| { return inhibit_case<strlit<wchar_t const*> >(str); } |
| inhibit_case<chlit<char> > |
| operator[](char ch) const |
| { return inhibit_case<chlit<char> >(ch); } |
| inhibit_case<chlit<wchar_t> > |
| operator[](wchar_t ch) const |
| { return inhibit_case<chlit<wchar_t> >(ch); } |
| template <typename ParserT> |
| inhibit_case<ParserT> |
| operator[](parser<ParserT> const& subject) const |
| { return inhibit_case<ParserT>(subject.derived()); } |
| }; |
| struct inhibit_case_parser_gen : public inhibit_case_parser_gen_base<0> |
| { |
| inhibit_case_parser_gen() {} |
| }; |
| const inhibit_case_parser_gen nocase_d = inhibit_case_parser_gen(); |
| const inhibit_case_parser_gen as_lower_d = inhibit_case_parser_gen(); |
| template <typename ScannerT> |
| struct as_lower_scanner |
| { |
| typedef scanner_policies< |
| inhibit_case_iteration_policy< |
| typename ScannerT::iteration_policy_t>, |
| typename ScannerT::match_policy_t, |
| typename ScannerT::action_policy_t |
| > policies_t; |
| typedef typename |
| rebind_scanner_policies<ScannerT, policies_t>::type type; |
| }; |
| struct longest_parser_gen; |
| template <typename A, typename B> |
| struct longest_alternative |
| : public binary<A, B, parser<longest_alternative<A, B> > > |
| { |
| typedef longest_alternative<A, B> self_t; |
| typedef binary_parser_category parser_category_t; |
| typedef longest_parser_gen parser_generator_t; |
| typedef binary<A, B, parser<self_t> > base_t; |
| longest_alternative(A const& a, B const& b) |
| : base_t(a, b) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| typename ScannerT::iterator_t save = scan.first; |
| result_t l = this->left().parse(scan); |
| std::swap(scan.first, save); |
| result_t r = this->right().parse(scan); |
| if (l || r) |
| { |
| if (l.length() > r.length()) |
| { |
| scan.first = save; |
| return l; |
| } |
| return r; |
| } |
| return scan.no_match(); |
| } |
| }; |
| struct longest_parser_gen |
| { |
| template <typename A, typename B> |
| struct result { |
| typedef typename |
| impl::to_longest_alternative<alternative<A, B> >::result_t |
| type; |
| }; |
| template <typename A, typename B> |
| static typename |
| impl::to_longest_alternative<alternative<A, B> >::result_t |
| generate(alternative<A, B> const& alt) |
| { |
| return impl::to_longest_alternative<alternative<A, B> >:: |
| convert(alt); |
| } |
| template <typename A, typename B> |
| typename impl::to_longest_alternative<alternative<A, B> >::result_t |
| operator[](alternative<A, B> const& alt) const |
| { |
| return impl::to_longest_alternative<alternative<A, B> >:: |
| convert(alt); |
| } |
| }; |
| const longest_parser_gen longest_d = longest_parser_gen(); |
| struct shortest_parser_gen; |
| template <typename A, typename B> |
| struct shortest_alternative |
| : public binary<A, B, parser<shortest_alternative<A, B> > > |
| { |
| typedef shortest_alternative<A, B> self_t; |
| typedef binary_parser_category parser_category_t; |
| typedef shortest_parser_gen parser_generator_t; |
| typedef binary<A, B, parser<self_t> > base_t; |
| shortest_alternative(A const& a, B const& b) |
| : base_t(a, b) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| typename ScannerT::iterator_t save = scan.first; |
| result_t l = this->left().parse(scan); |
| std::swap(scan.first, save); |
| result_t r = this->right().parse(scan); |
| if (l || r) |
| { |
| if (l.length() < r.length()) |
| { |
| scan.first = save; |
| return l; |
| } |
| return r; |
| } |
| return scan.no_match(); |
| } |
| }; |
| struct shortest_parser_gen |
| { |
| template <typename A, typename B> |
| struct result { |
| typedef typename |
| impl::to_shortest_alternative<alternative<A, B> >::result_t |
| type; |
| }; |
| template <typename A, typename B> |
| static typename |
| impl::to_shortest_alternative<alternative<A, B> >::result_t |
| generate(alternative<A, B> const& alt) |
| { |
| return impl::to_shortest_alternative<alternative<A, B> >:: |
| convert(alt); |
| } |
| template <typename A, typename B> |
| typename impl::to_shortest_alternative<alternative<A, B> >::result_t |
| operator[](alternative<A, B> const& alt) const |
| { |
| return impl::to_shortest_alternative<alternative<A, B> >:: |
| convert(alt); |
| } |
| }; |
| const shortest_parser_gen shortest_d = shortest_parser_gen(); |
| template <typename BoundsT> |
| struct min_bounded_gen; |
| template <typename ParserT, typename BoundsT> |
| struct min_bounded |
| : public unary<ParserT, parser<min_bounded<ParserT, BoundsT> > > |
| { |
| typedef min_bounded<ParserT, BoundsT> self_t; |
| typedef unary_parser_category parser_category_t; |
| typedef min_bounded_gen<BoundsT> parser_generator_t; |
| typedef unary<ParserT, parser<self_t> > base_t; |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename parser_result<ParserT, ScannerT>::type type; |
| }; |
| min_bounded(ParserT const& p, BoundsT const& min__) |
| : base_t(p) |
| , min_(min__) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| result_t hit = this->subject().parse(scan); |
| if (hit.value() < min_) |
| return scan.no_match(); |
| return hit; |
| } |
| BoundsT min_; |
| }; |
| template <typename BoundsT> |
| struct min_bounded_gen |
| { |
| min_bounded_gen(BoundsT const& min__) |
| : min_(min__) {} |
| template <typename DerivedT> |
| min_bounded<DerivedT, BoundsT> |
| operator[](parser<DerivedT> const& p) const |
| { return min_bounded<DerivedT, BoundsT>(p.derived(), min_); } |
| BoundsT min_; |
| }; |
| template <typename BoundsT> |
| inline min_bounded_gen<BoundsT> |
| min_limit_d(BoundsT const& min_) |
| { return min_bounded_gen<BoundsT>(min_); } |
| template <typename BoundsT> |
| struct max_bounded_gen; |
| template <typename ParserT, typename BoundsT> |
| struct max_bounded |
| : public unary<ParserT, parser<max_bounded<ParserT, BoundsT> > > |
| { |
| typedef max_bounded<ParserT, BoundsT> self_t; |
| typedef unary_parser_category parser_category_t; |
| typedef max_bounded_gen<BoundsT> parser_generator_t; |
| typedef unary<ParserT, parser<self_t> > base_t; |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename parser_result<ParserT, ScannerT>::type type; |
| }; |
| max_bounded(ParserT const& p, BoundsT const& max__) |
| : base_t(p) |
| , max_(max__) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| result_t hit = this->subject().parse(scan); |
| if (hit.value() > max_) |
| return scan.no_match(); |
| return hit; |
| } |
| BoundsT max_; |
| }; |
| template <typename BoundsT> |
| struct max_bounded_gen |
| { |
| max_bounded_gen(BoundsT const& max__) |
| : max_(max__) {} |
| template <typename DerivedT> |
| max_bounded<DerivedT, BoundsT> |
| operator[](parser<DerivedT> const& p) const |
| { return max_bounded<DerivedT, BoundsT>(p.derived(), max_); } |
| BoundsT max_; |
| }; |
| template <typename BoundsT> |
| inline max_bounded_gen<BoundsT> |
| max_limit_d(BoundsT const& max_) |
| { return max_bounded_gen<BoundsT>(max_); } |
| template <typename BoundsT> |
| struct bounded_gen; |
| template <typename ParserT, typename BoundsT> |
| struct bounded |
| : public unary<ParserT, parser<bounded<ParserT, BoundsT> > > |
| { |
| typedef bounded<ParserT, BoundsT> self_t; |
| typedef unary_parser_category parser_category_t; |
| typedef bounded_gen<BoundsT> parser_generator_t; |
| typedef unary<ParserT, parser<self_t> > base_t; |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename parser_result<ParserT, ScannerT>::type type; |
| }; |
| bounded(ParserT const& p, BoundsT const& min__, BoundsT const& max__) |
| : base_t(p) |
| , min_(min__) |
| , max_(max__) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| result_t hit = this->subject().parse(scan); |
| if (hit.value() < min_ || hit.value() > max_) |
| return scan.no_match(); |
| return hit; |
| } |
| BoundsT min_, max_; |
| }; |
| template <typename BoundsT> |
| struct bounded_gen |
| { |
| bounded_gen(BoundsT const& min__, BoundsT const& max__) |
| : min_(min__) |
| , max_(max__) {} |
| template <typename DerivedT> |
| bounded<DerivedT, BoundsT> |
| operator[](parser<DerivedT> const& p) const |
| { return bounded<DerivedT, BoundsT>(p.derived(), min_, max_); } |
| BoundsT min_, max_; |
| }; |
| template <typename BoundsT> |
| inline bounded_gen<BoundsT> |
| limit_d(BoundsT const& min_, BoundsT const& max_) |
| { return bounded_gen<BoundsT>(min_, max_); } |
| }} |
| #include <cmath> |
| namespace boost { namespace spirit { |
| struct sign_parser; |
| namespace impl |
| { |
| template <typename ScannerT> |
| bool |
| extract_sign(ScannerT const& scan, std::size_t& count) |
| { |
| count = 0; |
| bool neg = *scan == '-'; |
| if (neg || (*scan == '+')) |
| { |
| ++scan; |
| ++count; |
| return neg; |
| } |
| return false; |
| } |
| template<const int Radix> |
| struct radix_traits; |
| template<> |
| struct radix_traits<2> |
| { |
| template<typename CharT> |
| static bool is_valid(CharT ch) |
| { |
| return ('0' == ch || '1' == ch); |
| } |
| template<typename CharT> |
| static int digit(CharT ch) |
| { |
| return ch - '0'; |
| } |
| }; |
| template<> |
| struct radix_traits<8> |
| { |
| template<typename CharT> |
| static bool is_valid(CharT ch) |
| { |
| return ('0' <= ch && ch <= '7'); |
| } |
| template<typename CharT> |
| static int digit(CharT ch) |
| { |
| return ch - '0'; |
| } |
| }; |
| template<> |
| struct radix_traits<10> |
| { |
| template<typename CharT> |
| static bool is_valid(CharT ch) |
| { |
| return impl::isdigit_(ch); |
| } |
| template<typename CharT> |
| static int digit(CharT ch) |
| { |
| return ch - '0'; |
| } |
| }; |
| template<> |
| struct radix_traits<16> |
| { |
| template<typename CharT> |
| static bool is_valid(CharT ch) |
| { |
| return impl::isxdigit_(ch); |
| } |
| template<typename CharT> |
| static int digit(CharT ch) |
| { |
| if (impl::isdigit_(ch)) |
| return ch - '0'; |
| return impl::tolower_(ch) - 'a' + 10; |
| } |
| }; |
| template <int Radix> |
| struct positive_accumulate |
| { |
| template <typename T> |
| static bool check(T const& n, T const& prev) |
| { |
| return n < prev; |
| } |
| template <typename T, typename CharT> |
| static void add(T& n, CharT ch) |
| { |
| n += radix_traits<Radix>::digit(ch); |
| } |
| }; |
| template <int Radix> |
| struct negative_accumulate |
| { |
| template <typename T> |
| static bool check(T const& n, T const& prev) |
| { |
| return n > prev; |
| } |
| template <typename T, typename CharT> |
| static void add(T& n, CharT ch) |
| { |
| n -= radix_traits<Radix>::digit(ch); |
| } |
| }; |
| template <int Radix, typename Accumulate> |
| struct extract_int_base |
| { |
| template <typename ScannerT, typename T> |
| static bool |
| f(ScannerT& scan, T& n) |
| { |
| T prev = n; |
| n *= Radix; |
| if (Accumulate::check(n, prev)) |
| return false; |
| prev = n; |
| Accumulate::add(n, *scan); |
| if (Accumulate::check(n, prev)) |
| return false; |
| return true; |
| } |
| }; |
| template <bool Bounded> |
| struct extract_int_ |
| { |
| template < |
| int Radix, |
| unsigned MinDigits, |
| int MaxDigits, |
| typename Accumulate |
| > |
| struct apply |
| { |
| typedef extract_int_base<Radix, Accumulate> base; |
| typedef radix_traits<Radix> check; |
| template <typename ScannerT, typename T> |
| static bool |
| f(ScannerT& scan, T& n, std::size_t& count) |
| { |
| std::size_t i = 0; |
| for (; (i < MaxDigits) && !scan.at_end() |
| && check::is_valid(*scan); |
| ++i, ++scan, ++count) |
| { |
| if (!base::f(scan, n)) |
| return false; |
| } |
| return i >= MinDigits; |
| } |
| }; |
| }; |
| template <> |
| struct extract_int_<false> |
| { |
| template < |
| int Radix, |
| unsigned MinDigits, |
| int MaxDigits, |
| typename Accumulate |
| > |
| struct apply |
| { |
| typedef extract_int_base<Radix, Accumulate> base; |
| typedef radix_traits<Radix> check; |
| template <typename ScannerT, typename T> |
| static bool |
| f(ScannerT& scan, T& n, std::size_t& count) |
| { |
| std::size_t i = 0; |
| for (; !scan.at_end() && check::is_valid(*scan); |
| ++i, ++scan, ++count) |
| { |
| if (!base::f(scan, n)) |
| return false; |
| } |
| return i >= MinDigits; |
| } |
| }; |
| }; |
| template < |
| int Radix, unsigned MinDigits, int MaxDigits, |
| typename Accumulate = positive_accumulate<Radix> |
| > |
| struct extract_int |
| { |
| template <typename ScannerT, typename T> |
| static bool |
| f(ScannerT& scan, T& n, std::size_t& count) |
| { |
| return extract_int_<(MaxDigits >= 0)>::template |
| apply<Radix, MinDigits, MaxDigits, Accumulate>:: |
| f(scan, n, count); |
| } |
| }; |
| template < |
| typename T = unsigned, |
| int Radix = 10, |
| unsigned MinDigits = 1, |
| int MaxDigits = -1 |
| > |
| struct uint_parser_impl |
| : parser<uint_parser_impl<T, Radix, MinDigits, MaxDigits> > |
| { |
| typedef uint_parser_impl<T, Radix, MinDigits, MaxDigits> self_t; |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename match_result<ScannerT, T>::type type; |
| }; |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| if (!scan.at_end()) |
| { |
| T n = 0; |
| std::size_t count = 0; |
| typename ScannerT::iterator_t save = scan.first; |
| if (extract_int<Radix, MinDigits, MaxDigits>:: |
| f(scan, n, count)) |
| { |
| return scan.create_match(count, n, save, scan.first); |
| } |
| } |
| return scan.no_match(); |
| } |
| }; |
| template < |
| typename T = unsigned, |
| int Radix = 10, |
| unsigned MinDigits = 1, |
| int MaxDigits = -1 |
| > |
| struct int_parser_impl |
| : parser<int_parser_impl<T, Radix, MinDigits, MaxDigits> > |
| { |
| typedef int_parser_impl<T, Radix, MinDigits, MaxDigits> self_t; |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename match_result<ScannerT, T>::type type; |
| }; |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef extract_int<Radix, MinDigits, MaxDigits, |
| negative_accumulate<Radix> > extract_int_neg_t; |
| typedef extract_int<Radix, MinDigits, MaxDigits> |
| extract_int_pos_t; |
| if (!scan.at_end()) |
| { |
| T n = 0; |
| std::size_t count = 0; |
| typename ScannerT::iterator_t save = scan.first; |
| bool hit = impl::extract_sign(scan, count); |
| if (hit) |
| hit = extract_int_neg_t::f(scan, n, count); |
| else |
| hit = extract_int_pos_t::f(scan, n, count); |
| if (hit) |
| return scan.create_match(count, n, save, scan.first); |
| else |
| scan.first = save; |
| } |
| return scan.no_match(); |
| } |
| }; |
| template <typename RT, typename T, typename RealPoliciesT> |
| struct real_parser_impl |
| { |
| typedef real_parser_impl<RT, T, RealPoliciesT> self_t; |
| template <typename ScannerT> |
| RT parse_main(ScannerT const& scan) const |
| { |
| if (scan.at_end()) |
| return scan.no_match(); |
| typename ScannerT::iterator_t save = scan.first; |
| typedef typename parser_result<sign_parser, ScannerT>::type |
| sign_match_t; |
| typedef typename parser_result<chlit<>, ScannerT>::type |
| exp_match_t; |
| sign_match_t sign_match = RealPoliciesT::parse_sign(scan); |
| std::size_t count = sign_match ? sign_match.length() : 0; |
| bool neg = sign_match.has_valid_attribute() ? |
| sign_match.value() : false; |
| RT n_match = RealPoliciesT::parse_n(scan); |
| T n = n_match.has_valid_attribute() ? |
| n_match.value() : T(0); |
| bool got_a_number = n_match; |
| exp_match_t e_hit; |
| if (!got_a_number && !RealPoliciesT::allow_leading_dot) |
| return scan.no_match(); |
| else |
| count += n_match.length(); |
| if (neg) |
| n = -n; |
| if (RealPoliciesT::parse_dot(scan)) |
| { |
| if (RT hit = RealPoliciesT::parse_frac_n(scan)) |
| { |
| hit.value(hit.value() |
| * std:: |
| pow(T(10), T(-hit.length()))); |
| if (neg) |
| n -= hit.value(); |
| else |
| n += hit.value(); |
| count += hit.length() + 1; |
| } |
| else if (!got_a_number || |
| !RealPoliciesT::allow_trailing_dot) |
| return scan.no_match(); |
| e_hit = RealPoliciesT::parse_exp(scan); |
| } |
| else |
| { |
| if (!got_a_number) |
| return scan.no_match(); |
| e_hit = RealPoliciesT::parse_exp(scan); |
| if (RealPoliciesT::expect_dot && !e_hit) |
| return scan.no_match(); |
| } |
| if (e_hit) |
| { |
| if (RT e_n_hit = RealPoliciesT::parse_exp_n(scan)) |
| { |
| n *= std:: |
| pow(T(10), T(e_n_hit.value())); |
| count += e_n_hit.length() + e_hit.length(); |
| } |
| else |
| { |
| return scan.no_match(); |
| } |
| } |
| return scan.create_match(count, n, save, scan.first); |
| } |
| template <typename ScannerT> |
| static RT parse(ScannerT const& scan) |
| { |
| static self_t this_; |
| return impl::implicit_lexeme_parse<RT>(this_, scan, scan); |
| } |
| }; |
| } |
| }} |
| namespace boost { namespace spirit |
| { |
| template < |
| typename T = unsigned, |
| int Radix = 10, |
| unsigned MinDigits = 1, |
| int MaxDigits = -1 |
| > |
| struct uint_parser : parser<uint_parser<T, Radix, MinDigits, MaxDigits> > |
| { |
| typedef uint_parser<T, Radix, MinDigits, MaxDigits> self_t; |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename match_result<ScannerT, T>::type type; |
| }; |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef impl::uint_parser_impl<T, Radix, MinDigits, MaxDigits> impl_t; |
| typedef typename parser_result<impl_t, ScannerT>::type result_t; |
| return impl::contiguous_parser_parse<result_t>(impl_t(), scan, scan); |
| } |
| }; |
| template < |
| typename T = unsigned, |
| int Radix = 10, |
| unsigned MinDigits = 1, |
| int MaxDigits = -1 |
| > |
| struct int_parser : parser<int_parser<T, Radix, MinDigits, MaxDigits> > |
| { |
| typedef int_parser<T, Radix, MinDigits, MaxDigits> self_t; |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename match_result<ScannerT, T>::type type; |
| }; |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef impl::int_parser_impl<T, Radix, MinDigits, MaxDigits> impl_t; |
| typedef typename parser_result<impl_t, ScannerT>::type result_t; |
| return impl::contiguous_parser_parse<result_t>(impl_t(), scan, scan); |
| } |
| }; |
| int_parser<int> const |
| int_p = int_parser<int>(); |
| uint_parser<unsigned> const |
| uint_p = uint_parser<unsigned>(); |
| uint_parser<unsigned, 2> const |
| bin_p = uint_parser<unsigned, 2>(); |
| uint_parser<unsigned, 8> const |
| oct_p = uint_parser<unsigned, 8>(); |
| uint_parser<unsigned, 16> const |
| hex_p = uint_parser<unsigned, 16>(); |
| namespace impl |
| { |
| template <typename ScannerT> |
| bool extract_sign(ScannerT const& scan, std::size_t& count); |
| } |
| struct sign_parser : public parser<sign_parser> |
| { |
| typedef sign_parser self_t; |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename match_result<ScannerT, bool>::type type; |
| }; |
| sign_parser() {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| if (!scan.at_end()) |
| { |
| std::size_t length; |
| typename ScannerT::iterator_t save(scan.first); |
| bool neg = impl::extract_sign(scan, length); |
| if (length) |
| return scan.create_match(1, neg, save, scan.first); |
| } |
| return scan.no_match(); |
| } |
| }; |
| sign_parser const sign_p = sign_parser(); |
| template <typename T> |
| struct ureal_parser_policies |
| { |
| static const bool allow_leading_dot = true; |
| static const bool allow_trailing_dot = true; |
| static const bool expect_dot = false; |
| typedef uint_parser<T, 10, 1, -1> uint_parser_t; |
| typedef int_parser<T, 10, 1, -1> int_parser_t; |
| template <typename ScannerT> |
| static typename match_result<ScannerT, nil_t>::type |
| parse_sign(ScannerT& scan) |
| { |
| return scan.no_match(); |
| } |
| template <typename ScannerT> |
| static typename parser_result<uint_parser_t, ScannerT>::type |
| parse_n(ScannerT& scan) |
| { |
| return uint_parser_t().parse(scan); |
| } |
| template <typename ScannerT> |
| static typename parser_result<chlit<>, ScannerT>::type |
| parse_dot(ScannerT& scan) |
| { |
| return ch_p('.').parse(scan); |
| } |
| template <typename ScannerT> |
| static typename parser_result<uint_parser_t, ScannerT>::type |
| parse_frac_n(ScannerT& scan) |
| { |
| return uint_parser_t().parse(scan); |
| } |
| template <typename ScannerT> |
| static typename parser_result<chlit<>, ScannerT>::type |
| parse_exp(ScannerT& scan) |
| { |
| return as_lower_d['e'].parse(scan); |
| } |
| template <typename ScannerT> |
| static typename parser_result<int_parser_t, ScannerT>::type |
| parse_exp_n(ScannerT& scan) |
| { |
| return int_parser_t().parse(scan); |
| } |
| }; |
| template <typename T> |
| struct real_parser_policies : public ureal_parser_policies<T> |
| { |
| template <typename ScannerT> |
| static typename parser_result<sign_parser, ScannerT>::type |
| parse_sign(ScannerT& scan) |
| { |
| return sign_p.parse(scan); |
| } |
| }; |
| template < |
| typename T = double, |
| typename RealPoliciesT = ureal_parser_policies<T> |
| > |
| struct real_parser |
| : public parser<real_parser<T, RealPoliciesT> > |
| { |
| typedef real_parser<T, RealPoliciesT> self_t; |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename match_result<ScannerT, T>::type type; |
| }; |
| real_parser() {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| return impl::real_parser_impl<result_t, T, RealPoliciesT>::parse(scan); |
| } |
| }; |
| real_parser<double, ureal_parser_policies<double> > const |
| ureal_p = real_parser<double, ureal_parser_policies<double> >(); |
| real_parser<double, real_parser_policies<double> > const |
| real_p = real_parser<double, real_parser_policies<double> >(); |
| template <typename T> |
| struct strict_ureal_parser_policies : public ureal_parser_policies<T> |
| { |
| static const bool expect_dot = true; |
| }; |
| template <typename T> |
| struct strict_real_parser_policies : public real_parser_policies<T> |
| { |
| static const bool expect_dot = true; |
| }; |
| real_parser<double, strict_ureal_parser_policies<double> > const |
| strict_ureal_p |
| = real_parser<double, strict_ureal_parser_policies<double> >(); |
| real_parser<double, strict_real_parser_policies<double> > const |
| strict_real_p |
| = real_parser<double, strict_real_parser_policies<double> >(); |
| }} |
| namespace boost |
| { |
| namespace spirit |
| { |
| struct default_parser_context_base |
| { |
| template <typename DerivedT> |
| struct aux {}; |
| }; |
| struct parser_context_base {}; |
| struct nil_t; |
| template<typename ContextT> struct parser_context_linker; |
| template<typename AttrT = nil_t> |
| struct parser_context : parser_context_base |
| { |
| typedef AttrT attr_t; |
| typedef default_parser_context_base base_t; |
| typedef parser_context_linker<parser_context<AttrT> > context_linker_t; |
| template <typename ParserT> |
| parser_context(ParserT const&) {} |
| template <typename ParserT, typename ScannerT> |
| void |
| pre_parse(ParserT const&, ScannerT const&) {} |
| template <typename ResultT, typename ParserT, typename ScannerT> |
| ResultT& |
| post_parse(ResultT& hit, ParserT const&, ScannerT const&) |
| { return hit; } |
| }; |
| template <typename ContextT, typename DerivedT> |
| struct context_aux : public ContextT::base_t::template aux<DerivedT> {}; |
| template<typename ScannerT> |
| struct parser_scanner_linker : public ScannerT |
| { |
| parser_scanner_linker(ScannerT const scan_) : ScannerT(scan_) {} |
| }; |
| template<typename ContextT> |
| struct parser_context_linker : public ContextT |
| { |
| template <typename ParserT> |
| parser_context_linker(ParserT const& p) |
| : ContextT(p) {} |
| template <typename ParserT, typename ScannerT> |
| void pre_parse(ParserT const& p, ScannerT const& scan) |
| { ContextT::pre_parse(p, scan); } |
| template <typename ResultT, typename ParserT, typename ScannerT> |
| ResultT& |
| post_parse(ResultT& hit, ParserT const& p, ScannerT const& scan) |
| { return ContextT::post_parse(hit, p, scan); } |
| }; |
| } |
| } |
| namespace boost { namespace spirit { |
| template <typename FirstT, typename RestT> |
| struct subrule_list; |
| template <int ID, typename DefT, typename ContextT> |
| struct subrule_parser; |
| namespace impl { |
| template <int N, typename ListT> |
| struct get_subrule |
| { |
| typedef typename get_subrule<N, typename ListT::rest_t>::type type; |
| }; |
| template <int ID, typename DefT, typename ContextT, typename RestT> |
| struct get_subrule< |
| ID, |
| subrule_list< |
| subrule_parser<ID, DefT, ContextT>, |
| RestT> > |
| { |
| typedef DefT type; |
| }; |
| template <int ID> |
| struct get_subrule<ID, nil_t> |
| { |
| typedef nil_t type; |
| }; |
| template <typename T1, typename T2> |
| struct get_result_t { |
| typedef typename mpl::if_< |
| boost::is_same<T1, nil_t>, T2, T1 |
| >::type type; |
| }; |
| template <int ID, typename ScannerT, typename ContextResultT> |
| struct get_subrule_result |
| { |
| typedef typename |
| impl::get_subrule<ID, typename ScannerT::list_t>::type |
| parser_t; |
| typedef typename parser_result<parser_t, ScannerT>::type |
| def_result_t; |
| typedef typename match_result<ScannerT, ContextResultT>::type |
| context_result_t; |
| typedef typename get_result_t<context_result_t, def_result_t>::type |
| type; |
| }; |
| template <typename DefT, typename ScannerT, typename ContextResultT> |
| struct get_subrule_parser_result |
| { |
| typedef typename parser_result<DefT, ScannerT>::type |
| def_result_t; |
| typedef typename match_result<ScannerT, ContextResultT>::type |
| context_result_t; |
| typedef typename get_result_t<context_result_t, def_result_t>::type |
| type; |
| }; |
| template <typename SubruleT, int ID> |
| struct same_subrule_id |
| { |
| static const bool value = (SubruleT::id == ID); |
| }; |
| template <typename RT, typename ScannerT, int ID> |
| struct parse_subrule |
| { |
| template <typename ListT> |
| static void |
| do_parse(RT& r, ScannerT const& scan, ListT const& list, mpl::true_) |
| { |
| r = list.first.rhs.parse(scan); |
| } |
| template <typename ListT> |
| static void |
| do_parse(RT& r, ScannerT const& scan, ListT const& list, mpl::false_) |
| { |
| typedef typename ListT::rest_t::first_t subrule_t; |
| mpl::bool_<same_subrule_id<subrule_t, ID>::value> same_id; |
| do_parse(r, scan, list.rest, same_id); |
| } |
| static void |
| do_(RT& r, ScannerT const& scan) |
| { |
| typedef typename ScannerT::list_t::first_t subrule_t; |
| mpl::bool_<same_subrule_id<subrule_t, ID>::value> same_id; |
| do_parse(r, scan, scan.list, same_id); |
| } |
| }; |
| }}} |
| namespace boost { namespace spirit { |
| template <typename ScannerT, typename ListT> |
| struct subrules_scanner : public ScannerT |
| { |
| typedef ScannerT scanner_t; |
| typedef ListT list_t; |
| typedef subrules_scanner<ScannerT, ListT> self_t; |
| subrules_scanner(ScannerT const& scan, ListT const& list_) |
| : ScannerT(scan), list(list_) {} |
| template <typename PoliciesT> |
| struct rebind_policies |
| { |
| typedef typename rebind_scanner_policies<ScannerT, PoliciesT>::type |
| rebind_scanner; |
| typedef subrules_scanner<rebind_scanner, ListT> type; |
| }; |
| template <typename PoliciesT> |
| subrules_scanner< |
| typename rebind_scanner_policies<ScannerT, PoliciesT>::type, |
| ListT> |
| change_policies(PoliciesT const& policies) const |
| { |
| typedef subrules_scanner< |
| typename |
| rebind_scanner_policies<ScannerT, PoliciesT>::type, |
| ListT> |
| subrules_scanner_t; |
| return subrules_scanner_t( |
| ScannerT::change_policies(policies), |
| list); |
| } |
| template <typename IteratorT> |
| struct rebind_iterator |
| { |
| typedef typename rebind_scanner_iterator<ScannerT, IteratorT>::type |
| rebind_scanner; |
| typedef subrules_scanner<rebind_scanner, ListT> type; |
| }; |
| template <typename IteratorT> |
| subrules_scanner< |
| typename rebind_scanner_iterator<ScannerT, IteratorT>::type, |
| ListT> |
| change_iterator(IteratorT const& first, IteratorT const &last) const |
| { |
| typedef subrules_scanner< |
| typename |
| rebind_scanner_iterator<ScannerT, IteratorT>::type, |
| ListT> |
| subrules_scanner_t; |
| return subrules_scanner_t( |
| ScannerT::change_iterator(first, last), |
| list); |
| } |
| ListT const& list; |
| }; |
| template <typename ScannerT, typename ListT> |
| struct subrules_scanner_finder |
| { |
| typedef subrules_scanner<ScannerT, ListT> type; |
| }; |
| template <typename ScannerT, typename ListT> |
| struct subrules_scanner_finder<subrules_scanner<ScannerT, ListT>, ListT> |
| { |
| typedef subrules_scanner<ScannerT, ListT> type; |
| }; |
| template <typename FirstT, typename RestT> |
| struct subrule_list : public parser<subrule_list<FirstT, RestT> > |
| { |
| typedef subrule_list<FirstT, RestT> self_t; |
| typedef FirstT first_t; |
| typedef RestT rest_t; |
| subrule_list(FirstT const& first_, RestT const& rest_) |
| : first(first_), rest(rest_) {} |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename parser_result<FirstT, ScannerT>::type type; |
| }; |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename subrules_scanner_finder<ScannerT, self_t>::type |
| subrules_scanner_t; |
| subrules_scanner_t g_arg(scan, *this); |
| return first.start.parse(g_arg); |
| } |
| template <int ID, typename DefT, typename ContextT> |
| subrule_list< |
| FirstT, |
| subrule_list< |
| subrule_parser<ID, DefT, ContextT>, |
| RestT> > |
| operator,(subrule_parser<ID, DefT, ContextT> const& rhs) |
| { |
| return subrule_list< |
| FirstT, |
| subrule_list< |
| subrule_parser<ID, DefT, ContextT>, |
| RestT> >( |
| first, |
| subrule_list< |
| subrule_parser<ID, DefT, ContextT>, |
| RestT>(rhs, rest)); |
| } |
| FirstT first; |
| RestT rest; |
| }; |
| template <int ID, typename ContextT = parser_context<> > |
| struct subrule; |
| template <int ID, typename DefT, typename ContextT> |
| struct subrule_parser |
| : public parser<subrule_parser<ID, DefT, ContextT> > |
| { |
| typedef subrule_parser<ID, DefT, ContextT> self_t; |
| typedef subrule<ID, ContextT> subrule_t; |
| typedef DefT def_t; |
| static const int id = ID; |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename |
| impl::get_subrule_parser_result< |
| DefT, ScannerT, typename subrule_t::attr_t>::type type; |
| }; |
| subrule_parser(subrule_t const& start_, DefT const& rhs_) |
| : rhs(rhs_), start(start_) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef subrule_list<self_t, nil_t> list_t; |
| typedef subrules_scanner<ScannerT, list_t> scanner_t; |
| list_t list(*this, nil_t()); |
| scanner_t g_arg(scan, list); |
| return start.parse(g_arg); |
| } |
| template <int ID2, typename DefT2, typename ContextT2> |
| inline subrule_list< |
| self_t, |
| subrule_list< |
| subrule_parser<ID2, DefT2, ContextT2>, |
| nil_t> > |
| operator,(subrule_parser<ID2, DefT2, ContextT2> const& rhs) const |
| { |
| return subrule_list< |
| self_t, |
| subrule_list< |
| subrule_parser<ID2, DefT2, ContextT2>, |
| nil_t> >( |
| *this, |
| subrule_list< |
| subrule_parser<ID2, DefT2, ContextT2>, nil_t>( |
| rhs, nil_t())); |
| } |
| typename DefT::embed_t rhs; |
| subrule_t const& start; |
| }; |
| template <int ID, typename ContextT> |
| struct subrule |
| : public parser<subrule<ID, ContextT> > |
| , public ContextT::base_t |
| , public context_aux<ContextT, subrule<ID, ContextT> > |
| { |
| typedef subrule<ID, ContextT> self_t; |
| typedef subrule<ID, ContextT> const& embed_t; |
| typedef typename ContextT::context_linker_t context_t; |
| typedef typename context_t::attr_t attr_t; |
| static const int id = ID; |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename |
| impl::get_subrule_result<ID, ScannerT, attr_t>::type type; |
| }; |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse_main(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| result_t result; |
| impl::parse_subrule<result_t, ScannerT, ID>:: |
| do_(result, scan); |
| return result; |
| } |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| typedef parser_scanner_linker<ScannerT> scanner_t; |
| scanner_t scan_wrap(scan); context_t context_wrap(*this); context_wrap.pre_parse(*this, scan_wrap); result_t hit = parse_main(scan); return context_wrap.post_parse(hit, *this, scan_wrap);; |
| } |
| template <typename DefT> |
| subrule_parser<ID, DefT, ContextT> |
| operator=(parser<DefT> const& rhs) const |
| { |
| return subrule_parser<ID, DefT, ContextT>(*this, rhs.derived()); |
| } |
| private: |
| subrule& operator=(subrule const&); |
| template <int ID2, typename ContextT2> |
| subrule& operator=(subrule<ID2, ContextT2> const&); |
| }; |
| }} |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( 1 > 0 ) >)> boost_static_assert_typedef_30; |
| #include <assert.h> |
| namespace boost |
| { |
| template<class T> inline void checked_delete(T * x) |
| { |
| typedef char type_must_be_complete[ sizeof(T)? 1: -1 ]; |
| (void) sizeof(type_must_be_complete); |
| delete x; |
| } |
| template<class T> inline void checked_array_delete(T * x) |
| { |
| typedef char type_must_be_complete[ sizeof(T)? 1: -1 ]; |
| (void) sizeof(type_must_be_complete); |
| delete [] x; |
| } |
| template<class T> struct checked_deleter |
| { |
| typedef void result_type; |
| typedef T * argument_type; |
| void operator()(T * x) const |
| { |
| boost::checked_delete(x); |
| } |
| }; |
| template<class T> struct checked_array_deleter |
| { |
| typedef void result_type; |
| typedef T * argument_type; |
| void operator()(T * x) const |
| { |
| boost::checked_array_delete(x); |
| } |
| }; |
| } |
| namespace boost |
| { |
| template<class T> class scoped_ptr |
| { |
| private: |
| T * ptr; |
| scoped_ptr(scoped_ptr const &); |
| scoped_ptr & operator=(scoped_ptr const &); |
| typedef scoped_ptr<T> this_type; |
| public: |
| typedef T element_type; |
| explicit scoped_ptr(T * p = 0): ptr(p) |
| { |
| } |
| explicit scoped_ptr(std::auto_ptr<T> p): ptr(p.release()) |
| { |
| } |
| ~scoped_ptr() |
| { |
| boost::checked_delete(ptr); |
| } |
| void reset(T * p = 0) |
| { |
| ((void)0); |
| this_type(p).swap(*this); |
| } |
| T & operator*() const |
| { |
| ((void)0); |
| return *ptr; |
| } |
| T * operator->() const |
| { |
| ((void)0); |
| return ptr; |
| } |
| T * get() const |
| { |
| return ptr; |
| } |
| typedef T * this_type::*unspecified_bool_type; |
| operator unspecified_bool_type() const |
| { |
| return ptr == 0? 0: &this_type::ptr; |
| } |
| bool operator! () const |
| { |
| return ptr == 0; |
| } |
| void swap(scoped_ptr & b) |
| { |
| T * tmp = b.ptr; |
| b.ptr = ptr; |
| ptr = tmp; |
| } |
| }; |
| template<class T> inline void swap(scoped_ptr<T> & a, scoped_ptr<T> & b) |
| { |
| a.swap(b); |
| } |
| template<class T> inline T * get_pointer(scoped_ptr<T> const & p) |
| { |
| return p.get(); |
| } |
| } |
| namespace boost { namespace spirit { |
| namespace impl |
| { |
| template <typename BaseT, typename DefaultT |
| , typename T0, typename T1, typename T2> |
| struct get_param |
| { |
| typedef typename mpl::if_< |
| is_base_and_derived<BaseT, T0> |
| , T0 |
| , typename mpl::if_< |
| is_base_and_derived<BaseT, T1> |
| , T1 |
| , typename mpl::if_< |
| is_base_and_derived<BaseT, T2> |
| , T2 |
| , DefaultT |
| >::type |
| >::type |
| >::type type; |
| }; |
| template <typename T0, typename T1, typename T2> |
| struct get_context |
| { |
| typedef typename get_param< |
| parser_context_base, parser_context<>, T0, T1, T2>::type |
| type; |
| }; |
| template <typename T0, typename T1, typename T2> |
| struct get_tag |
| { |
| typedef typename get_param< |
| parser_tag_base, parser_address_tag, T0, T1, T2>::type |
| type; |
| }; |
| template <typename T0, typename T1, typename T2> |
| struct get_scanner |
| { |
| typedef typename get_param< |
| scanner_base, scanner<>, T0, T1, T2>::type |
| type; |
| }; |
| template < |
| typename DerivedT |
| , typename EmbedT |
| , typename T0 = nil_t |
| , typename T1 = nil_t |
| , typename T2 = nil_t |
| > |
| class rule_base; |
| class rule_base_access |
| { |
| template < |
| typename DerivedT |
| , typename EmbedT |
| , typename T0 |
| , typename T1 |
| , typename T2 |
| > |
| friend class rule_base; |
| template <typename RuleT> |
| static typename RuleT::abstract_parser_t* |
| get(RuleT const& r) |
| { |
| return r.get(); |
| } |
| }; |
| template < |
| typename DerivedT |
| , typename EmbedT |
| , typename T0 |
| , typename T1 |
| , typename T2 |
| > |
| class rule_base |
| : public parser<DerivedT> |
| , public impl::get_context<T0, T1, T2>::type::base_t |
| , public context_aux< |
| typename impl::get_context<T0, T1, T2>::type, DerivedT> |
| , public impl::get_tag<T0, T1, T2>::type |
| { |
| public: |
| typedef typename impl::get_scanner<T0, T1, T2>::type scanner_t; |
| typedef typename impl::get_context<T0, T1, T2>::type context_t; |
| typedef typename impl::get_tag<T0, T1, T2>::type tag_t; |
| typedef EmbedT embed_t; |
| typedef typename context_t::context_linker_t linked_context_t; |
| typedef typename linked_context_t::attr_t attr_t; |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename match_result<ScannerT, attr_t>::type type; |
| }; |
| template <typename ScannerT> |
| typename parser_result<DerivedT, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef parser_scanner_linker<ScannerT> linked_scanner_t; |
| typedef typename parser_result<DerivedT, ScannerT>::type result_t; |
| linked_scanner_t scan_wrap(scan); linked_context_t context_wrap(*this); context_wrap.pre_parse(*this, scan_wrap); result_t hit = parse_main(scan); return context_wrap.post_parse(hit, *this, scan_wrap);; |
| } |
| template <typename ScannerT> |
| typename parser_result<DerivedT, ScannerT>::type |
| parse_main(ScannerT const& scan) const |
| { |
| typename parser_result<DerivedT, ScannerT>::type hit; |
| DerivedT const * derivedThis = |
| static_cast<DerivedT const *>(this); |
| if (rule_base_access::get(*derivedThis)) |
| { |
| typename ScannerT::iterator_t s(scan.first); |
| hit = rule_base_access::get(*derivedThis) |
| ->do_parse_virtual(scan); |
| scan.group_match(hit, this->id(), s, scan.first); |
| } |
| else |
| { |
| hit = scan.no_match(); |
| } |
| return hit; |
| } |
| }; |
| template <typename ScannerT, typename AttrT> |
| struct abstract_parser |
| { |
| abstract_parser() {} |
| virtual ~abstract_parser() {} |
| virtual typename match_result<ScannerT, AttrT>::type |
| do_parse_virtual(ScannerT const& scan) const = 0; |
| virtual abstract_parser* |
| clone() const = 0; |
| }; |
| template <typename ParserT, typename ScannerT, typename AttrT> |
| struct concrete_parser : abstract_parser<ScannerT, AttrT> |
| { |
| concrete_parser(ParserT const& p) : p(p) {} |
| virtual ~concrete_parser() {} |
| virtual typename match_result<ScannerT, AttrT>::type |
| do_parse_virtual(ScannerT const& scan) const |
| { |
| return p.parse(scan); |
| } |
| virtual abstract_parser<ScannerT, AttrT>* |
| clone() const |
| { |
| return new concrete_parser(p); |
| } |
| typename ParserT::embed_t p; |
| }; |
| } |
| }} |
| namespace boost { namespace spirit { |
| template < |
| typename T0 = nil_t |
| , typename T1 = nil_t |
| , typename T2 = nil_t |
| > |
| class rule |
| : public impl::rule_base< |
| rule<T0, T1, T2> |
| , rule<T0, T1, T2> const& |
| , T0, T1, T2> |
| { |
| public: |
| typedef rule<T0, T1, T2> self_t; |
| typedef impl::rule_base< |
| self_t |
| , self_t const& |
| , T0, T1, T2> |
| base_t; |
| typedef typename base_t::scanner_t scanner_t; |
| typedef typename base_t::attr_t attr_t; |
| typedef impl::abstract_parser<scanner_t, attr_t> abstract_parser_t; |
| rule() : ptr() {} |
| ~rule() {} |
| rule(rule const& r) |
| : ptr(new impl::concrete_parser<rule, scanner_t, attr_t>(r)) {} |
| template <typename ParserT> |
| rule(ParserT const& p) |
| : ptr(new impl::concrete_parser<ParserT, scanner_t, attr_t>(p)) {} |
| template <typename ParserT> |
| rule& operator=(ParserT const& p) |
| { |
| ptr.reset(new impl::concrete_parser<ParserT, scanner_t, attr_t>(p)); |
| return *this; |
| } |
| rule& operator=(rule const& r) |
| { |
| ptr.reset(new impl::concrete_parser<rule, scanner_t, attr_t>(r)); |
| return *this; |
| } |
| rule<T0, T1, T2> |
| copy() const |
| { |
| return rule<T0, T1, T2>(ptr.get() ? ptr->clone() : 0); |
| } |
| private: |
| friend class impl::rule_base_access; |
| abstract_parser_t* |
| get() const |
| { |
| return ptr.get(); |
| } |
| rule(abstract_parser_t const* ptr) |
| : ptr(ptr) {} |
| scoped_ptr<abstract_parser_t> ptr; |
| }; |
| }} |
| #include <assert.h> |
| #include <pthread.h> |
| namespace boost |
| { |
| namespace detail |
| { |
| #ifdef __XS1B__ |
| class lightweight_mutex { |
| public: |
| class scoped_lock { |
| public: |
| scoped_lock(lightweight_mutex & m){} |
| }; |
| friend class scoped_lock; |
| }; |
| #else |
| class lightweight_mutex |
| { |
| private: |
| pthread_mutex_t m_; |
| lightweight_mutex(lightweight_mutex const &); |
| lightweight_mutex & operator=(lightweight_mutex const &); |
| public: |
| lightweight_mutex() |
| { |
| pthread_mutex_init(&m_, 0); |
| } |
| ~lightweight_mutex() |
| { |
| pthread_mutex_destroy(&m_); |
| } |
| class scoped_lock; |
| friend class scoped_lock; |
| class scoped_lock |
| { |
| private: |
| pthread_mutex_t & m_; |
| scoped_lock(scoped_lock const &); |
| scoped_lock & operator=(scoped_lock const &); |
| public: |
| scoped_lock(lightweight_mutex & m): m_(m.m_) |
| { |
| pthread_mutex_lock(&m_); |
| } |
| ~scoped_lock() |
| { |
| pthread_mutex_unlock(&m_); |
| } |
| }; |
| }; |
| #endif |
| } |
| } |
| namespace boost |
| { |
| class bad_weak_ptr: public std::exception |
| { |
| public: |
| virtual char const * what() const throw() |
| { |
| return "boost::bad_weak_ptr"; |
| } |
| }; |
| namespace detail |
| { |
| class sp_counted_base |
| { |
| private: |
| typedef detail::lightweight_mutex mutex_type; |
| public: |
| sp_counted_base(): use_count_(1), weak_count_(1) |
| { |
| } |
| virtual ~sp_counted_base() |
| { |
| } |
| virtual void dispose() = 0; |
| virtual void destruct() |
| { |
| delete this; |
| } |
| virtual void * get_deleter(std::type_info const & ti) = 0; |
| void add_ref_copy() |
| { |
| mutex_type::scoped_lock lock(mtx_); |
| ++use_count_; |
| } |
| void add_ref_lock() |
| { |
| mutex_type::scoped_lock lock(mtx_); |
| if(use_count_ == 0) boost::throw_exception(boost::bad_weak_ptr()); |
| ++use_count_; |
| } |
| void release() |
| { |
| { |
| mutex_type::scoped_lock lock(mtx_); |
| long new_use_count = --use_count_; |
| if(new_use_count != 0) return; |
| } |
| dispose(); |
| weak_release(); |
| } |
| void weak_add_ref() |
| { |
| mutex_type::scoped_lock lock(mtx_); |
| ++weak_count_; |
| } |
| void weak_release() |
| { |
| long new_weak_count; |
| { |
| mutex_type::scoped_lock lock(mtx_); |
| new_weak_count = --weak_count_; |
| } |
| if(new_weak_count == 0) |
| { |
| destruct(); |
| } |
| } |
| long use_count() const |
| { |
| mutex_type::scoped_lock lock(mtx_); |
| return use_count_; |
| } |
| private: |
| sp_counted_base(sp_counted_base const &); |
| sp_counted_base & operator= (sp_counted_base const &); |
| long use_count_; |
| long weak_count_; |
| mutable mutex_type mtx_; |
| }; |
| template<class P, class D> class sp_counted_base_impl: public sp_counted_base |
| { |
| private: |
| P ptr; |
| D del; |
| sp_counted_base_impl(sp_counted_base_impl const &); |
| sp_counted_base_impl & operator= (sp_counted_base_impl const &); |
| typedef sp_counted_base_impl<P, D> this_type; |
| public: |
| sp_counted_base_impl(P p, D d): ptr(p), del(d) |
| { |
| } |
| virtual void dispose() |
| { |
| del(ptr); |
| } |
| virtual void * get_deleter(std::type_info const & ti) |
| { |
| return ti == typeid(D)? &del: 0; |
| } |
| }; |
| class weak_count; |
| class shared_count |
| { |
| private: |
| sp_counted_base * pi_; |
| friend class weak_count; |
| public: |
| shared_count(): pi_(0) |
| { |
| } |
| template<class P, class D> shared_count(P p, D d): pi_(0) |
| { |
| try |
| { |
| pi_ = new sp_counted_base_impl<P, D>(p, d); |
| } |
| catch(...) |
| { |
| d(p); |
| throw; |
| } |
| } |
| template<class Y> |
| explicit shared_count(std::auto_ptr<Y> & r): pi_(new sp_counted_base_impl< Y *, checked_deleter<Y> >(r.get(), checked_deleter<Y>())) |
| { |
| r.release(); |
| } |
| ~shared_count() |
| { |
| if(pi_ != 0) pi_->release(); |
| } |
| shared_count(shared_count const & r): pi_(r.pi_) |
| { |
| if(pi_ != 0) pi_->add_ref_copy(); |
| } |
| explicit shared_count(weak_count const & r); |
| shared_count & operator= (shared_count const & r) |
| { |
| sp_counted_base * tmp = r.pi_; |
| if(tmp != 0) tmp->add_ref_copy(); |
| if(pi_ != 0) pi_->release(); |
| pi_ = tmp; |
| return *this; |
| } |
| void swap(shared_count & r) |
| { |
| sp_counted_base * tmp = r.pi_; |
| r.pi_ = pi_; |
| pi_ = tmp; |
| } |
| long use_count() const |
| { |
| return pi_ != 0? pi_->use_count(): 0; |
| } |
| bool unique() const |
| { |
| return use_count() == 1; |
| } |
| friend inline bool operator==(shared_count const & a, shared_count const & b) |
| { |
| return a.pi_ == b.pi_; |
| } |
| friend inline bool operator<(shared_count const & a, shared_count const & b) |
| { |
| return std::less<sp_counted_base *>()(a.pi_, b.pi_); |
| } |
| void * get_deleter(std::type_info const & ti) const |
| { |
| return pi_? pi_->get_deleter(ti): 0; |
| } |
| }; |
| class weak_count |
| { |
| private: |
| sp_counted_base * pi_; |
| friend class shared_count; |
| public: |
| weak_count(): pi_(0) |
| { |
| } |
| weak_count(shared_count const & r): pi_(r.pi_) |
| { |
| if(pi_ != 0) pi_->weak_add_ref(); |
| } |
| weak_count(weak_count const & r): pi_(r.pi_) |
| { |
| if(pi_ != 0) pi_->weak_add_ref(); |
| } |
| ~weak_count() |
| { |
| if(pi_ != 0) pi_->weak_release(); |
| } |
| weak_count & operator= (shared_count const & r) |
| { |
| sp_counted_base * tmp = r.pi_; |
| if(tmp != 0) tmp->weak_add_ref(); |
| if(pi_ != 0) pi_->weak_release(); |
| pi_ = tmp; |
| return *this; |
| } |
| weak_count & operator= (weak_count const & r) |
| { |
| sp_counted_base * tmp = r.pi_; |
| if(tmp != 0) tmp->weak_add_ref(); |
| if(pi_ != 0) pi_->weak_release(); |
| pi_ = tmp; |
| return *this; |
| } |
| void swap(weak_count & r) |
| { |
| sp_counted_base * tmp = r.pi_; |
| r.pi_ = pi_; |
| pi_ = tmp; |
| } |
| long use_count() const |
| { |
| return pi_ != 0? pi_->use_count(): 0; |
| } |
| friend inline bool operator==(weak_count const & a, weak_count const & b) |
| { |
| return a.pi_ == b.pi_; |
| } |
| friend inline bool operator<(weak_count const & a, weak_count const & b) |
| { |
| return std::less<sp_counted_base *>()(a.pi_, b.pi_); |
| } |
| }; |
| inline shared_count::shared_count(weak_count const & r): pi_(r.pi_) |
| { |
| if(pi_ != 0) |
| { |
| pi_->add_ref_lock(); |
| } |
| else |
| { |
| boost::throw_exception(boost::bad_weak_ptr()); |
| } |
| } |
| } |
| } |
| namespace boost |
| { |
| template<class T> class weak_ptr; |
| template<class T> class enable_shared_from_this; |
| namespace detail |
| { |
| struct static_cast_tag {}; |
| struct const_cast_tag {}; |
| struct dynamic_cast_tag {}; |
| struct polymorphic_cast_tag {}; |
| template<class T> struct shared_ptr_traits |
| { |
| typedef T & reference; |
| }; |
| template<> struct shared_ptr_traits<void> |
| { |
| typedef void reference; |
| }; |
| template<> struct shared_ptr_traits<void const> |
| { |
| typedef void reference; |
| }; |
| template<> struct shared_ptr_traits<void volatile> |
| { |
| typedef void reference; |
| }; |
| template<> struct shared_ptr_traits<void const volatile> |
| { |
| typedef void reference; |
| }; |
| template<class T, class Y> void sp_enable_shared_from_this(boost::enable_shared_from_this<T> * pe, Y * px, shared_count const & pn) |
| { |
| if(pe != 0) pe->_internal_weak_this._internal_assign(px, pn); |
| } |
| inline void sp_enable_shared_from_this(void const volatile *, void const volatile *, shared_count const &) |
| { |
| } |
| } |
| template<class T> class shared_ptr |
| { |
| private: |
| typedef shared_ptr<T> this_type; |
| public: |
| typedef T element_type; |
| typedef T value_type; |
| typedef T * pointer; |
| typedef typename detail::shared_ptr_traits<T>::reference reference; |
| shared_ptr(): px(0), pn() |
| { |
| } |
| template<class Y> |
| explicit shared_ptr(Y * p): px(p), pn(p, checked_deleter<Y>()) |
| { |
| detail::sp_enable_shared_from_this(p, p, pn); |
| } |
| template<class Y, class D> shared_ptr(Y * p, D d): px(p), pn(p, d) |
| { |
| detail::sp_enable_shared_from_this(p, p, pn); |
| } |
| shared_ptr & operator=(shared_ptr const & r) |
| { |
| px = r.px; |
| pn = r.pn; |
| return *this; |
| } |
| template<class Y> |
| explicit shared_ptr(weak_ptr<Y> const & r): pn(r.pn) |
| { |
| px = r.px; |
| } |
| template<class Y> |
| shared_ptr(shared_ptr<Y> const & r): px(r.px), pn(r.pn) |
| { |
| } |
| template<class Y> |
| shared_ptr(shared_ptr<Y> const & r, detail::static_cast_tag): px(static_cast<element_type *>(r.px)), pn(r.pn) |
| { |
| } |
| template<class Y> |
| shared_ptr(shared_ptr<Y> const & r, detail::const_cast_tag): px(const_cast<element_type *>(r.px)), pn(r.pn) |
| { |
| } |
| template<class Y> |
| shared_ptr(shared_ptr<Y> const & r, detail::dynamic_cast_tag): px(dynamic_cast<element_type *>(r.px)), pn(r.pn) |
| { |
| if(px == 0) |
| { |
| pn = detail::shared_count(); |
| } |
| } |
| template<class Y> |
| shared_ptr(shared_ptr<Y> const & r, detail::polymorphic_cast_tag): px(dynamic_cast<element_type *>(r.px)), pn(r.pn) |
| { |
| if(px == 0) |
| { |
| boost::throw_exception(std::bad_cast()); |
| } |
| } |
| template<class Y> |
| explicit shared_ptr(std::auto_ptr<Y> & r): px(r.get()), pn() |
| { |
| Y * tmp = r.get(); |
| pn = detail::shared_count(r); |
| detail::sp_enable_shared_from_this(tmp, tmp, pn); |
| } |
| template<class Y> |
| shared_ptr & operator=(shared_ptr<Y> const & r) |
| { |
| px = r.px; |
| pn = r.pn; |
| return *this; |
| } |
| template<class Y> |
| shared_ptr & operator=(std::auto_ptr<Y> & r) |
| { |
| this_type(r).swap(*this); |
| return *this; |
| } |
| void reset() |
| { |
| this_type().swap(*this); |
| } |
| template<class Y> void reset(Y * p) |
| { |
| ((void)0); |
| this_type(p).swap(*this); |
| } |
| template<class Y, class D> void reset(Y * p, D d) |
| { |
| this_type(p, d).swap(*this); |
| } |
| reference operator* () const |
| { |
| ((void)0); |
| return *px; |
| } |
| T * operator-> () const |
| { |
| ((void)0); |
| return px; |
| } |
| T * get() const |
| { |
| return px; |
| } |
| typedef T * this_type::*unspecified_bool_type; |
| operator unspecified_bool_type() const |
| { |
| return px == 0? 0: &this_type::px; |
| } |
| bool operator! () const |
| { |
| return px == 0; |
| } |
| bool unique() const |
| { |
| return pn.unique(); |
| } |
| long use_count() const |
| { |
| return pn.use_count(); |
| } |
| void swap(shared_ptr<T> & other) |
| { |
| std::swap(px, other.px); |
| pn.swap(other.pn); |
| } |
| template<class Y> bool _internal_less(shared_ptr<Y> const & rhs) const |
| { |
| return pn < rhs.pn; |
| } |
| void * _internal_get_deleter(std::type_info const & ti) const |
| { |
| return pn.get_deleter(ti); |
| } |
| private: |
| template<class Y> friend class shared_ptr; |
| template<class Y> friend class weak_ptr; |
| T * px; |
| detail::shared_count pn; |
| }; |
| template<class T, class U> inline bool operator==(shared_ptr<T> const & a, shared_ptr<U> const & b) |
| { |
| return a.get() == b.get(); |
| } |
| template<class T, class U> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<U> const & b) |
| { |
| return a.get() != b.get(); |
| } |
| template<class T, class U> inline bool operator<(shared_ptr<T> const & a, shared_ptr<U> const & b) |
| { |
| return a._internal_less(b); |
| } |
| template<class T> inline void swap(shared_ptr<T> & a, shared_ptr<T> & b) |
| { |
| a.swap(b); |
| } |
| template<class T, class U> shared_ptr<T> static_pointer_cast(shared_ptr<U> const & r) |
| { |
| return shared_ptr<T>(r, detail::static_cast_tag()); |
| } |
| template<class T, class U> shared_ptr<T> const_pointer_cast(shared_ptr<U> const & r) |
| { |
| return shared_ptr<T>(r, detail::const_cast_tag()); |
| } |
| template<class T, class U> shared_ptr<T> dynamic_pointer_cast(shared_ptr<U> const & r) |
| { |
| return shared_ptr<T>(r, detail::dynamic_cast_tag()); |
| } |
| template<class T, class U> shared_ptr<T> shared_static_cast(shared_ptr<U> const & r) |
| { |
| return shared_ptr<T>(r, detail::static_cast_tag()); |
| } |
| template<class T, class U> shared_ptr<T> shared_dynamic_cast(shared_ptr<U> const & r) |
| { |
| return shared_ptr<T>(r, detail::dynamic_cast_tag()); |
| } |
| template<class T, class U> shared_ptr<T> shared_polymorphic_cast(shared_ptr<U> const & r) |
| { |
| return shared_ptr<T>(r, detail::polymorphic_cast_tag()); |
| } |
| template<class T, class U> shared_ptr<T> shared_polymorphic_downcast(shared_ptr<U> const & r) |
| { |
| ((void)0); |
| return shared_static_cast<T>(r); |
| } |
| template<class T> inline T * get_pointer(shared_ptr<T> const & p) |
| { |
| return p.get(); |
| } |
| template<class E, class T, class Y> std::basic_ostream<E, T> & operator<< (std::basic_ostream<E, T> & os, shared_ptr<Y> const & p) |
| { |
| os << p.get(); |
| return os; |
| } |
| template<class D, class T> D * get_deleter(shared_ptr<T> const & p) |
| { |
| return static_cast<D *>(p._internal_get_deleter(typeid(D))); |
| } |
| } |
| namespace boost { namespace spirit { |
| namespace impl { |
| template <typename IdT = std::size_t> |
| struct object_with_id_base_supply |
| { |
| typedef IdT object_id; |
| typedef std::vector<object_id> id_vector; |
| object_with_id_base_supply() : max_id(object_id()) {} |
| object_id max_id; |
| id_vector free_ids; |
| object_id acquire(); |
| void release(object_id); |
| }; |
| template <typename TagT, typename IdT = std::size_t> |
| struct object_with_id_base |
| { |
| typedef TagT tag_t; |
| typedef IdT object_id; |
| protected: |
| object_id acquire_object_id(); |
| void release_object_id(object_id); |
| private: |
| boost::shared_ptr<object_with_id_base_supply<IdT> > id_supply; |
| }; |
| template<class TagT, typename IdT = std::size_t> |
| struct object_with_id : private object_with_id_base<TagT, IdT> |
| { |
| typedef object_with_id<TagT, IdT> self_t; |
| typedef object_with_id_base<TagT, IdT> base_t; |
| typedef IdT object_id; |
| object_with_id() : id(base_t::acquire_object_id()) {} |
| object_with_id(self_t const &other) |
| : base_t(other) |
| , id(base_t::acquire_object_id()) |
| {} |
| self_t &operator = (self_t const &other) |
| { |
| base_t::operator=(other); |
| return *this; |
| } |
| ~object_with_id() { base_t::release_object_id(id); } |
| object_id get_object_id() const { return id; } |
| private: |
| object_id const id; |
| }; |
| template <typename IdT> |
| inline IdT |
| object_with_id_base_supply<IdT>::acquire() |
| { |
| if (free_ids.size()) |
| { |
| object_id id = *free_ids.rbegin(); |
| free_ids.pop_back(); |
| return id; |
| } |
| else |
| { |
| if (free_ids.capacity()<=max_id) |
| free_ids.reserve(max_id*3/2+1); |
| return ++max_id; |
| } |
| } |
| template <typename IdT> |
| inline void |
| object_with_id_base_supply<IdT>::release(IdT id) |
| { |
| if (max_id == id) |
| max_id--; |
| else |
| free_ids.push_back(id); |
| } |
| template <typename TagT, typename IdT> |
| inline IdT |
| object_with_id_base<TagT, IdT>::acquire_object_id() |
| { |
| { |
| static boost::shared_ptr<object_with_id_base_supply<IdT> > |
| static_supply; |
| if (!static_supply.get()) |
| static_supply.reset(new object_with_id_base_supply<IdT>()); |
| id_supply = static_supply; |
| } |
| return id_supply->acquire(); |
| } |
| template <typename TagT, typename IdT> |
| inline void |
| object_with_id_base<TagT, IdT>::release_object_id(IdT id) |
| { |
| id_supply->release(id); |
| } |
| } |
| }} |
| namespace boost |
| { |
| template<class T> class weak_ptr |
| { |
| private: |
| typedef weak_ptr<T> this_type; |
| public: |
| typedef T element_type; |
| weak_ptr(): px(0), pn() |
| { |
| } |
| template<class Y> |
| weak_ptr(weak_ptr<Y> const & r): pn(r.pn) |
| { |
| px = r.lock().get(); |
| } |
| template<class Y> |
| weak_ptr(shared_ptr<Y> const & r): px(r.px), pn(r.pn) |
| { |
| } |
| template<class Y> |
| weak_ptr & operator=(weak_ptr<Y> const & r) |
| { |
| px = r.lock().get(); |
| pn = r.pn; |
| return *this; |
| } |
| template<class Y> |
| weak_ptr & operator=(shared_ptr<Y> const & r) |
| { |
| px = r.px; |
| pn = r.pn; |
| return *this; |
| } |
| shared_ptr<T> lock() const |
| { |
| if(expired()) |
| { |
| return shared_ptr<element_type>(); |
| } |
| try |
| { |
| return shared_ptr<element_type>(*this); |
| } |
| catch(bad_weak_ptr const &) |
| { |
| return shared_ptr<element_type>(); |
| } |
| } |
| long use_count() const |
| { |
| return pn.use_count(); |
| } |
| bool expired() const |
| { |
| return pn.use_count() == 0; |
| } |
| void reset() |
| { |
| this_type().swap(*this); |
| } |
| void swap(this_type & other) |
| { |
| std::swap(px, other.px); |
| pn.swap(other.pn); |
| } |
| void _internal_assign(T * px2, detail::shared_count const & pn2) |
| { |
| px = px2; |
| pn = pn2; |
| } |
| template<class Y> bool _internal_less(weak_ptr<Y> const & rhs) const |
| { |
| return pn < rhs.pn; |
| } |
| private: |
| template<class Y> friend class weak_ptr; |
| template<class Y> friend class shared_ptr; |
| T * px; |
| detail::weak_count pn; |
| }; |
| template<class T, class U> inline bool operator<(weak_ptr<T> const & a, weak_ptr<U> const & b) |
| { |
| return a._internal_less(b); |
| } |
| template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b) |
| { |
| a.swap(b); |
| } |
| template<class T> shared_ptr<T> make_shared(weak_ptr<T> const & r) |
| { |
| return r.lock(); |
| } |
| } |
| namespace boost { namespace spirit { |
| template <typename DerivedT, typename ContextT> |
| struct grammar; |
| template <typename GrammarT, typename ScannerT> |
| struct grammar_definition |
| { |
| typedef typename GrammarT::template definition<ScannerT> type; |
| }; |
| namespace impl |
| { |
| struct grammar_tag {}; |
| template <typename GrammarT> |
| struct grammar_helper_base |
| { |
| virtual int undefine(GrammarT *) = 0; |
| virtual ~grammar_helper_base() {} |
| }; |
| template <typename GrammarT> |
| struct grammar_helper_list |
| { |
| typedef GrammarT grammar_t; |
| typedef grammar_helper_base<GrammarT> helper_t; |
| typedef std::vector<helper_t*> vector_t; |
| grammar_helper_list() {} |
| grammar_helper_list(grammar_helper_list const& x) |
| { |
| } |
| grammar_helper_list& operator=(grammar_helper_list const& x) |
| { |
| return *this; |
| } |
| void push_back(helper_t *helper) |
| { helpers.push_back(helper); } |
| void pop_back() |
| { helpers.pop_back(); } |
| typename vector_t::size_type |
| size() const |
| { return helpers.size(); } |
| typename vector_t::reverse_iterator |
| rbegin() |
| { return helpers.rbegin(); } |
| typename vector_t::reverse_iterator |
| rend() |
| { return helpers.rend(); } |
| private: |
| vector_t helpers; |
| }; |
| struct grammartract_helper_list; |
| struct grammartract_helper_list |
| { |
| template<typename GrammarT> |
| static grammar_helper_list<GrammarT>& |
| do_(GrammarT const* g) |
| { |
| return g->helpers; |
| } |
| }; |
| template <typename GrammarT, typename DerivedT, typename ScannerT> |
| struct grammar_helper : private grammar_helper_base<GrammarT> |
| { |
| typedef GrammarT grammar_t; |
| typedef ScannerT scanner_t; |
| typedef DerivedT derived_t; |
| typedef typename grammar_definition<DerivedT, ScannerT>::type definition_t; |
| typedef grammar_helper<grammar_t, derived_t, scanner_t> helper_t; |
| typedef boost::shared_ptr<helper_t> helper_ptr_t; |
| typedef boost::weak_ptr<helper_t> helper_weak_ptr_t; |
| grammar_helper* |
| this_() { return this; } |
| grammar_helper(helper_weak_ptr_t& p) |
| : definitions_cnt(0) |
| , self(this_()) |
| { p = self; } |
| definition_t& |
| define(grammar_t const* target_grammar) |
| { |
| grammar_helper_list<GrammarT> &helpers = |
| grammartract_helper_list::do_(target_grammar); |
| typename grammar_t::object_id id = target_grammar->get_object_id(); |
| if (definitions.size()<=id) |
| definitions.resize(id*3/2+1); |
| if (definitions[id]!=0) |
| return *definitions[id]; |
| std::auto_ptr<definition_t> |
| result(new definition_t(target_grammar->derived())); |
| helpers.push_back(this); |
| ++definitions_cnt; |
| definitions[id] = result.get(); |
| return *(result.release()); |
| } |
| int |
| undefine(grammar_t* target_grammar) |
| { |
| typename grammar_t::object_id id = target_grammar->get_object_id(); |
| if (definitions.size()<=id) |
| return 0; |
| delete definitions[id]; |
| definitions[id] = 0; |
| if (--definitions_cnt==0) |
| self.reset(); |
| return 0; |
| } |
| private: |
| std::vector<definition_t*> definitions; |
| unsigned long definitions_cnt; |
| helper_ptr_t self; |
| }; |
| template<typename DerivedT, typename ContextT, typename ScannerT> |
| inline typename DerivedT::template definition<ScannerT> & |
| get_definition(grammar<DerivedT, ContextT> const* self) |
| { |
| typedef grammar<DerivedT, ContextT> self_t; |
| typedef impl::grammar_helper<self_t, DerivedT, ScannerT> helper_t; |
| typedef typename helper_t::helper_weak_ptr_t ptr_t; |
| static ptr_t helper; |
| if (!boost::make_shared(helper).get()) |
| new helper_t(helper); |
| return boost::make_shared(helper)->define(self); |
| } |
| template <int N> |
| struct call_helper { |
| template <typename RT, typename DefinitionT, typename ScannerT> |
| static void |
| do_ (RT &result, DefinitionT &def, ScannerT const &scan) |
| { |
| result = def.template get_start_parser<N>()->parse(scan); |
| } |
| }; |
| template <> |
| struct call_helper<0> { |
| template <typename RT, typename DefinitionT, typename ScannerT> |
| static void |
| do_ (RT &result, DefinitionT &def, ScannerT const &scan) |
| { |
| result = def.start().parse(scan); |
| } |
| }; |
| template<int N, typename DerivedT, typename ContextT, typename ScannerT> |
| inline typename parser_result<grammar<DerivedT, ContextT>, ScannerT>::type |
| grammar_parser_parse( |
| grammar<DerivedT, ContextT> const* self, |
| ScannerT const &scan) |
| { |
| typedef |
| typename parser_result<grammar<DerivedT, ContextT>, ScannerT>::type |
| result_t; |
| typedef typename DerivedT::template definition<ScannerT> definition_t; |
| result_t result; |
| definition_t &def = get_definition<DerivedT, ContextT, ScannerT>(self); |
| call_helper<N>::do_(result, def, scan); |
| return result; |
| } |
| template<typename GrammarT> |
| inline void |
| grammar_destruct(GrammarT* self) |
| { |
| typedef impl::grammar_helper_base<GrammarT> helper_base_t; |
| typedef grammar_helper_list<GrammarT> helper_list_t; |
| typedef typename helper_list_t::vector_t::reverse_iterator iterator_t; |
| helper_list_t& helpers = |
| grammartract_helper_list::do_(self); |
| std::for_each(helpers.rbegin(), helpers.rend(), |
| std::bind2nd(std::mem_fun(&helper_base_t::undefine), self)); |
| } |
| template <typename DerivedT, int N, typename ContextT> |
| class entry_grammar |
| : public parser<entry_grammar<DerivedT, N, ContextT> > |
| { |
| public: |
| typedef entry_grammar<DerivedT, N, ContextT> self_t; |
| typedef DerivedT const& embed_t; |
| typedef typename ContextT::context_linker_t context_t; |
| typedef typename context_t::attr_t attr_t; |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename match_result<ScannerT, attr_t>::type type; |
| }; |
| entry_grammar(DerivedT const &p) : target_grammar(p) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse_main(ScannerT const& scan) const |
| { return impl::grammar_parser_parse<N>(&target_grammar, scan); } |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| typedef parser_scanner_linker<ScannerT> scanner_t; |
| scanner_t scan_wrap(scan); context_t context_wrap(*this); context_wrap.pre_parse(*this, scan_wrap); result_t hit = parse_main(scan); return context_wrap.post_parse(hit, *this, scan_wrap); |
| } |
| private: |
| DerivedT const &target_grammar; |
| }; |
| } |
| }} |
| namespace boost { namespace spirit { |
| template <typename DerivedT, typename ContextT = parser_context<> > |
| struct grammar |
| : public parser<DerivedT> |
| , public ContextT::base_t |
| , public context_aux<ContextT, DerivedT> |
| , public impl::object_with_id<impl::grammar_tag> |
| { |
| typedef grammar<DerivedT, ContextT> self_t; |
| typedef DerivedT const& embed_t; |
| typedef typename ContextT::context_linker_t context_t; |
| typedef typename context_t::attr_t attr_t; |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename match_result<ScannerT, attr_t>::type type; |
| }; |
| grammar() {} |
| ~grammar() { impl::grammar_destruct(this); } |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse_main(ScannerT const& scan) const |
| { return impl::grammar_parser_parse<0>(this, scan); } |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| typedef parser_scanner_linker<ScannerT> scanner_t; |
| scanner_t scan_wrap(scan); context_t context_wrap(*this); context_wrap.pre_parse(*this, scan_wrap); result_t hit = parse_main(scan); return context_wrap.post_parse(hit, *this, scan_wrap); |
| } |
| template <int N> |
| impl::entry_grammar<DerivedT, N, ContextT> |
| use_parser() const |
| { return impl::entry_grammar<DerivedT, N, ContextT>( this->derived()); } |
| private: friend struct impl::grammartract_helper_list; mutable impl::grammar_helper_list<self_t> helpers; |
| }; |
| }} |
| namespace boost { namespace spirit { |
| template <typename ParserT, typename ActionT> |
| class action : public unary<ParserT, parser<action<ParserT, ActionT> > > |
| { |
| public: |
| typedef action<ParserT, ActionT> self_t; |
| typedef action_parser_category parser_category_t; |
| typedef unary<ParserT, parser<self_t> > base_t; |
| typedef ActionT predicate_t; |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename parser_result<ParserT, ScannerT>::type type; |
| }; |
| action(ParserT const& p, ActionT const& a) |
| : base_t(p) |
| , actor(a) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename ScannerT::iterator_t iterator_t; |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| scan.at_end(); |
| iterator_t save = scan.first; |
| result_t hit = this->subject().parse(scan); |
| if (hit) |
| { |
| typename result_t::return_t val = hit.value(); |
| scan.do_action(actor, val, save, scan.first); |
| } |
| return hit; |
| } |
| ActionT const& predicate() const { return actor; } |
| private: |
| ActionT actor; |
| }; |
| }} |
| namespace boost { namespace spirit { |
| namespace impl |
| { |
| template<typename T> |
| struct default_as_parser |
| { |
| typedef T type; |
| static type const& convert(type const& p) |
| { |
| return p; |
| } |
| }; |
| struct char_as_parser |
| { |
| typedef chlit<char> type; |
| static type convert(char ch) |
| { |
| return type(ch); |
| } |
| }; |
| struct wchar_as_parser |
| { |
| typedef chlit<wchar_t> type; |
| static type convert(wchar_t ch) |
| { |
| return type(ch); |
| } |
| }; |
| struct string_as_parser |
| { |
| typedef strlit<char const*> type; |
| static type convert(char const* str) |
| { |
| return type(str); |
| } |
| }; |
| struct wstring_as_parser |
| { |
| typedef strlit<wchar_t const*> type; |
| static type convert(wchar_t const* str) |
| { |
| return type(str); |
| } |
| }; |
| } |
| template<typename T> |
| struct as_parser : impl::default_as_parser<T> {}; |
| template<> |
| struct as_parser<char> : impl::char_as_parser {}; |
| template<> |
| struct as_parser<wchar_t> : impl::wchar_as_parser {}; |
| template<> |
| struct as_parser<char*> : impl::string_as_parser {}; |
| template<> |
| struct as_parser<char const*> : impl::string_as_parser {}; |
| template<> |
| struct as_parser<wchar_t*> : impl::wstring_as_parser {}; |
| template<> |
| struct as_parser<wchar_t const*> : impl::wstring_as_parser {}; |
| template<int N> |
| struct as_parser<char[N]> : impl::string_as_parser {}; |
| template<int N> |
| struct as_parser<wchar_t[N]> : impl::wstring_as_parser {}; |
| template<int N> |
| struct as_parser<char const[N]> : impl::string_as_parser {}; |
| template<int N> |
| struct as_parser<wchar_t const[N]> : impl::wstring_as_parser {}; |
| }} |
| namespace boost { namespace spirit { |
| struct sequence_parser_gen; |
| template <typename A, typename B> |
| struct sequence : public binary<A, B, parser<sequence<A, B> > > |
| { |
| typedef sequence<A, B> self_t; |
| typedef binary_parser_category parser_category_t; |
| typedef sequence_parser_gen parser_generator_t; |
| typedef binary<A, B, parser<self_t> > base_t; |
| sequence(A const& a, B const& b) |
| : base_t(a, b) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| if (result_t ma = this->left().parse(scan)) |
| if (result_t mb = this->right().parse(scan)) |
| { |
| scan.concat_match(ma, mb); |
| return ma; |
| } |
| return scan.no_match(); |
| } |
| }; |
| struct sequence_parser_gen |
| { |
| template <typename A, typename B> |
| struct result |
| { |
| typedef |
| sequence< |
| typename as_parser<A>::type |
| , typename as_parser<B>::type |
| > |
| type; |
| }; |
| template <typename A, typename B> |
| static sequence< |
| typename as_parser<A>::type |
| , typename as_parser<B>::type |
| > |
| generate(A const& a, B const& b) |
| { |
| return sequence<typename as_parser<A>::type, |
| typename as_parser<B>::type> |
| (as_parser<A>::convert(a), as_parser<B>::convert(b)); |
| } |
| }; |
| template <typename A, typename B> |
| sequence<A, B> |
| operator>>(parser<A> const& a, parser<B> const& b); |
| template <typename A> |
| sequence<A, chlit<char> > |
| operator>>(parser<A> const& a, char b); |
| template <typename B> |
| sequence<chlit<char>, B> |
| operator>>(char a, parser<B> const& b); |
| template <typename A> |
| sequence<A, strlit<char const*> > |
| operator>>(parser<A> const& a, char const* b); |
| template <typename B> |
| sequence<strlit<char const*>, B> |
| operator>>(char const* a, parser<B> const& b); |
| template <typename A> |
| sequence<A, chlit<wchar_t> > |
| operator>>(parser<A> const& a, wchar_t b); |
| template <typename B> |
| sequence<chlit<wchar_t>, B> |
| operator>>(wchar_t a, parser<B> const& b); |
| template <typename A> |
| sequence<A, strlit<wchar_t const*> > |
| operator>>(parser<A> const& a, wchar_t const* b); |
| template <typename B> |
| sequence<strlit<wchar_t const*>, B> |
| operator>>(wchar_t const* a, parser<B> const& b); |
| }} |
| namespace boost { namespace spirit { |
| template <typename A, typename B> |
| inline sequence<A, B> |
| operator>>(parser<A> const& a, parser<B> const& b) |
| { |
| return sequence<A, B>(a.derived(), b.derived()); |
| } |
| template <typename A> |
| inline sequence<A, chlit<char> > |
| operator>>(parser<A> const& a, char b) |
| { |
| return sequence<A, chlit<char> >(a.derived(), b); |
| } |
| template <typename B> |
| inline sequence<chlit<char>, B> |
| operator>>(char a, parser<B> const& b) |
| { |
| return sequence<chlit<char>, B>(a, b.derived()); |
| } |
| template <typename A> |
| inline sequence<A, strlit<char const*> > |
| operator>>(parser<A> const& a, char const* b) |
| { |
| return sequence<A, strlit<char const*> >(a.derived(), b); |
| } |
| template <typename B> |
| inline sequence<strlit<char const*>, B> |
| operator>>(char const* a, parser<B> const& b) |
| { |
| return sequence<strlit<char const*>, B>(a, b.derived()); |
| } |
| template <typename A> |
| inline sequence<A, chlit<wchar_t> > |
| operator>>(parser<A> const& a, wchar_t b) |
| { |
| return sequence<A, chlit<wchar_t> >(a.derived(), b); |
| } |
| template <typename B> |
| inline sequence<chlit<wchar_t>, B> |
| operator>>(wchar_t a, parser<B> const& b) |
| { |
| return sequence<chlit<wchar_t>, B>(a, b.derived()); |
| } |
| template <typename A> |
| inline sequence<A, strlit<wchar_t const*> > |
| operator>>(parser<A> const& a, wchar_t const* b) |
| { |
| return sequence<A, strlit<wchar_t const*> >(a.derived(), b); |
| } |
| template <typename B> |
| inline sequence<strlit<wchar_t const*>, B> |
| operator>>(wchar_t const* a, parser<B> const& b) |
| { |
| return sequence<strlit<wchar_t const*>, B>(a, b.derived()); |
| } |
| }} |
| namespace boost { namespace spirit { |
| template <typename A, typename B> |
| sequence<A, B> |
| operator&&(parser<A> const& a, parser<B> const& b); |
| template <typename A> |
| sequence<A, chlit<char> > |
| operator&&(parser<A> const& a, char b); |
| template <typename B> |
| sequence<chlit<char>, B> |
| operator&&(char a, parser<B> const& b); |
| template <typename A> |
| sequence<A, strlit<char const*> > |
| operator&&(parser<A> const& a, char const* b); |
| template <typename B> |
| sequence<strlit<char const*>, B> |
| operator&&(char const* a, parser<B> const& b); |
| template <typename A> |
| sequence<A, chlit<wchar_t> > |
| operator&&(parser<A> const& a, wchar_t b); |
| template <typename B> |
| sequence<chlit<wchar_t>, B> |
| operator&&(wchar_t a, parser<B> const& b); |
| template <typename A> |
| sequence<A, strlit<wchar_t const*> > |
| operator&&(parser<A> const& a, wchar_t const* b); |
| template <typename B> |
| sequence<strlit<wchar_t const*>, B> |
| operator&&(wchar_t const* a, parser<B> const& b); |
| }} |
| namespace boost { namespace spirit { |
| template <typename A, typename B> |
| inline sequence<A, B> |
| operator&&(parser<A> const& a, parser<B> const& b) |
| { |
| return sequence<A, B>(a.derived(), b.derived()); |
| } |
| template <typename A> |
| inline sequence<A, chlit<char> > |
| operator&&(parser<A> const& a, char b) |
| { |
| return sequence<A, chlit<char> >(a.derived(), b); |
| } |
| template <typename B> |
| inline sequence<chlit<char>, B> |
| operator&&(char a, parser<B> const& b) |
| { |
| return sequence<chlit<char>, B>(a, b.derived()); |
| } |
| template <typename A> |
| inline sequence<A, strlit<char const*> > |
| operator&&(parser<A> const& a, char const* b) |
| { |
| return sequence<A, strlit<char const*> >(a.derived(), b); |
| } |
| template <typename B> |
| inline sequence<strlit<char const*>, B> |
| operator&&(char const* a, parser<B> const& b) |
| { |
| return sequence<strlit<char const*>, B>(a, b.derived()); |
| } |
| template <typename A> |
| inline sequence<A, chlit<wchar_t> > |
| operator&&(parser<A> const& a, wchar_t b) |
| { |
| return sequence<A, chlit<wchar_t> >(a.derived(), b); |
| } |
| template <typename B> |
| inline sequence<chlit<wchar_t>, B> |
| operator&&(wchar_t a, parser<B> const& b) |
| { |
| return sequence<chlit<wchar_t>, B>(a, b.derived()); |
| } |
| template <typename A> |
| inline sequence<A, strlit<wchar_t const*> > |
| operator&&(parser<A> const& a, wchar_t const* b) |
| { |
| return sequence<A, strlit<wchar_t const*> >(a.derived(), b); |
| } |
| template <typename B> |
| inline sequence<strlit<wchar_t const*>, B> |
| operator&&(wchar_t const* a, parser<B> const& b) |
| { |
| return sequence<strlit<wchar_t const*>, B>(a, b.derived()); |
| } |
| }} |
| namespace boost { namespace spirit { |
| struct sequential_or_parser_gen; |
| template <typename A, typename B> |
| struct sequential_or : public binary<A, B, parser<sequential_or<A, B> > > |
| { |
| typedef sequential_or<A, B> self_t; |
| typedef binary_parser_category parser_category_t; |
| typedef sequential_or_parser_gen parser_generator_t; |
| typedef binary<A, B, parser<self_t> > base_t; |
| sequential_or(A const& a, B const& b) |
| : base_t(a, b) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| typedef typename ScannerT::iterator_t iterator_t; |
| { |
| iterator_t save = scan.first; |
| if (result_t ma = this->left().parse(scan)) |
| { |
| save = scan.first; |
| if (result_t mb = this->right().parse(scan)) |
| { |
| scan.concat_match(ma, mb); |
| return ma; |
| } |
| else |
| { |
| scan.first = save; |
| return ma; |
| } |
| } |
| scan.first = save; |
| } |
| return this->right().parse(scan); |
| } |
| }; |
| struct sequential_or_parser_gen |
| { |
| template <typename A, typename B> |
| struct result |
| { |
| typedef |
| sequential_or< |
| typename as_parser<A>::type |
| , typename as_parser<B>::type |
| > |
| type; |
| }; |
| template <typename A, typename B> |
| static sequential_or< |
| typename as_parser<A>::type |
| , typename as_parser<B>::type |
| > |
| generate(A const& a, B const& b) |
| { |
| return sequential_or<typename as_parser<A>::type, |
| typename as_parser<B>::type> |
| (as_parser<A>::convert(a), as_parser<B>::convert(b)); |
| } |
| }; |
| template <typename A, typename B> |
| sequential_or<A, B> |
| operator||(parser<A> const& a, parser<B> const& b); |
| template <typename A> |
| sequential_or<A, chlit<char> > |
| operator||(parser<A> const& a, char b); |
| template <typename B> |
| sequential_or<chlit<char>, B> |
| operator||(char a, parser<B> const& b); |
| template <typename A> |
| sequential_or<A, strlit<char const*> > |
| operator||(parser<A> const& a, char const* b); |
| template <typename B> |
| sequential_or<strlit<char const*>, B> |
| operator||(char const* a, parser<B> const& b); |
| template <typename A> |
| sequential_or<A, chlit<wchar_t> > |
| operator||(parser<A> const& a, wchar_t b); |
| template <typename B> |
| sequential_or<chlit<wchar_t>, B> |
| operator||(wchar_t a, parser<B> const& b); |
| template <typename A> |
| sequential_or<A, strlit<wchar_t const*> > |
| operator||(parser<A> const& a, wchar_t const* b); |
| template <typename B> |
| sequential_or<strlit<wchar_t const*>, B> |
| operator||(wchar_t const* a, parser<B> const& b); |
| }} |
| namespace boost { namespace spirit { |
| template <typename A, typename B> |
| inline sequential_or<A, B> |
| operator||(parser<A> const& a, parser<B> const& b) |
| { |
| return sequential_or<A, B>(a.derived(), b.derived()); |
| } |
| template <typename A> |
| inline sequential_or<A, chlit<char> > |
| operator||(parser<A> const& a, char b) |
| { |
| return sequential_or<A, chlit<char> >(a.derived(), b); |
| } |
| template <typename B> |
| inline sequential_or<chlit<char>, B> |
| operator||(char a, parser<B> const& b) |
| { |
| return sequential_or<chlit<char>, B>(a, b.derived()); |
| } |
| template <typename A> |
| inline sequential_or<A, strlit<char const*> > |
| operator||(parser<A> const& a, char const* b) |
| { |
| return sequential_or<A, strlit<char const*> >(a.derived(), b); |
| } |
| template <typename B> |
| inline sequential_or<strlit<char const*>, B> |
| operator||(char const* a, parser<B> const& b) |
| { |
| return sequential_or<strlit<char const*>, B>(a, b.derived()); |
| } |
| template <typename A> |
| inline sequential_or<A, chlit<wchar_t> > |
| operator||(parser<A> const& a, wchar_t b) |
| { |
| return sequential_or<A, chlit<wchar_t> >(a.derived(), b); |
| } |
| template <typename B> |
| inline sequential_or<chlit<wchar_t>, B> |
| operator||(wchar_t a, parser<B> const& b) |
| { |
| return sequential_or<chlit<wchar_t>, B>(a, b.derived()); |
| } |
| template <typename A> |
| inline sequential_or<A, strlit<wchar_t const*> > |
| operator||(parser<A> const& a, wchar_t const* b) |
| { |
| return sequential_or<A, strlit<wchar_t const*> >(a.derived(), b); |
| } |
| template <typename B> |
| inline sequential_or<strlit<wchar_t const*>, B> |
| operator||(wchar_t const* a, parser<B> const& b) |
| { |
| return sequential_or<strlit<wchar_t const*>, B>(a, b.derived()); |
| } |
| }} |
| namespace boost { namespace spirit { |
| struct alternative_parser_gen; |
| template <typename A, typename B> |
| struct alternative |
| : public binary<A, B, parser<alternative<A, B> > > |
| { |
| typedef alternative<A, B> self_t; |
| typedef binary_parser_category parser_category_t; |
| typedef alternative_parser_gen parser_generator_t; |
| typedef binary<A, B, parser<self_t> > base_t; |
| alternative(A const& a, B const& b) |
| : base_t(a, b) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| typedef typename ScannerT::iterator_t iterator_t; |
| { |
| iterator_t save = scan.first; |
| if (result_t hit = this->left().parse(scan)) |
| return hit; |
| scan.first = save; |
| } |
| return this->right().parse(scan); |
| } |
| }; |
| struct alternative_parser_gen |
| { |
| template <typename A, typename B> |
| struct result |
| { |
| typedef |
| alternative< |
| typename as_parser<A>::type |
| , typename as_parser<B>::type |
| > |
| type; |
| }; |
| template <typename A, typename B> |
| static alternative< |
| typename as_parser<A>::type |
| , typename as_parser<B>::type |
| > |
| generate(A const& a, B const& b) |
| { |
| return alternative<typename as_parser<A>::type, |
| typename as_parser<B>::type> |
| (as_parser<A>::convert(a), as_parser<B>::convert(b)); |
| } |
| }; |
| template <typename A, typename B> |
| alternative<A, B> |
| operator|(parser<A> const& a, parser<B> const& b); |
| template <typename A> |
| alternative<A, chlit<char> > |
| operator|(parser<A> const& a, char b); |
| template <typename B> |
| alternative<chlit<char>, B> |
| operator|(char a, parser<B> const& b); |
| template <typename A> |
| alternative<A, strlit<char const*> > |
| operator|(parser<A> const& a, char const* b); |
| template <typename B> |
| alternative<strlit<char const*>, B> |
| operator|(char const* a, parser<B> const& b); |
| template <typename A> |
| alternative<A, chlit<wchar_t> > |
| operator|(parser<A> const& a, wchar_t b); |
| template <typename B> |
| alternative<chlit<wchar_t>, B> |
| operator|(wchar_t a, parser<B> const& b); |
| template <typename A> |
| alternative<A, strlit<wchar_t const*> > |
| operator|(parser<A> const& a, wchar_t const* b); |
| template <typename B> |
| alternative<strlit<wchar_t const*>, B> |
| operator|(wchar_t const* a, parser<B> const& b); |
| }} |
| namespace boost { namespace spirit { |
| template <typename A, typename B> |
| inline alternative<A, B> |
| operator|(parser<A> const& a, parser<B> const& b) |
| { |
| return alternative<A, B>(a.derived(), b.derived()); |
| } |
| template <typename A> |
| inline alternative<A, chlit<char> > |
| operator|(parser<A> const& a, char b) |
| { |
| return alternative<A, chlit<char> >(a.derived(), b); |
| } |
| template <typename B> |
| inline alternative<chlit<char>, B> |
| operator|(char a, parser<B> const& b) |
| { |
| return alternative<chlit<char>, B>(a, b.derived()); |
| } |
| template <typename A> |
| inline alternative<A, strlit<char const*> > |
| operator|(parser<A> const& a, char const* b) |
| { |
| return alternative<A, strlit<char const*> >(a.derived(), b); |
| } |
| template <typename B> |
| inline alternative<strlit<char const*>, B> |
| operator|(char const* a, parser<B> const& b) |
| { |
| return alternative<strlit<char const*>, B>(a, b.derived()); |
| } |
| template <typename A> |
| inline alternative<A, chlit<wchar_t> > |
| operator|(parser<A> const& a, wchar_t b) |
| { |
| return alternative<A, chlit<wchar_t> >(a.derived(), b); |
| } |
| template <typename B> |
| inline alternative<chlit<wchar_t>, B> |
| operator|(wchar_t a, parser<B> const& b) |
| { |
| return alternative<chlit<wchar_t>, B>(a, b.derived()); |
| } |
| template <typename A> |
| inline alternative<A, strlit<wchar_t const*> > |
| operator|(parser<A> const& a, wchar_t const* b) |
| { |
| return alternative<A, strlit<wchar_t const*> >(a.derived(), b); |
| } |
| template <typename B> |
| inline alternative<strlit<wchar_t const*>, B> |
| operator|(wchar_t const* a, parser<B> const& b) |
| { |
| return alternative<strlit<wchar_t const*>, B>(a, b.derived()); |
| } |
| }} |
| namespace boost { namespace spirit { |
| struct difference_parser_gen; |
| template <typename A, typename B> |
| struct difference |
| : public binary<A, B, parser<difference<A, B> > > |
| { |
| typedef difference<A, B> self_t; |
| typedef binary_parser_category parser_category_t; |
| typedef difference_parser_gen parser_generator_t; |
| typedef binary<A, B, parser<self_t> > base_t; |
| difference(A const& a, B const& b) |
| : base_t(a, b) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| typedef typename ScannerT::iterator_t iterator_t; |
| iterator_t save = scan.first; |
| if (result_t hl = this->left().parse(scan)) |
| { |
| std::swap(save, scan.first); |
| result_t hr = this->right().parse(scan); |
| if (!hr || (hr.length() < hl.length())) |
| { |
| scan.first = save; |
| return hl; |
| } |
| } |
| return scan.no_match(); |
| } |
| }; |
| struct difference_parser_gen |
| { |
| template <typename A, typename B> |
| struct result |
| { |
| typedef |
| difference< |
| typename as_parser<A>::type |
| , typename as_parser<B>::type |
| > |
| type; |
| }; |
| template <typename A, typename B> |
| static difference< |
| typename as_parser<A>::type |
| , typename as_parser<B>::type |
| > |
| generate(A const& a, B const& b) |
| { |
| return difference<typename as_parser<A>::type, |
| typename as_parser<B>::type> |
| (as_parser<A>::convert(a), as_parser<B>::convert(b)); |
| } |
| }; |
| template <typename A, typename B> |
| difference<A, B> |
| operator-(parser<A> const& a, parser<B> const& b); |
| template <typename A> |
| difference<A, chlit<char> > |
| operator-(parser<A> const& a, char b); |
| template <typename B> |
| difference<chlit<char>, B> |
| operator-(char a, parser<B> const& b); |
| template <typename A> |
| difference<A, strlit<char const*> > |
| operator-(parser<A> const& a, char const* b); |
| template <typename B> |
| difference<strlit<char const*>, B> |
| operator-(char const* a, parser<B> const& b); |
| template <typename A> |
| difference<A, chlit<wchar_t> > |
| operator-(parser<A> const& a, wchar_t b); |
| template <typename B> |
| difference<chlit<wchar_t>, B> |
| operator-(wchar_t a, parser<B> const& b); |
| template <typename A> |
| difference<A, strlit<wchar_t const*> > |
| operator-(parser<A> const& a, wchar_t const* b); |
| template <typename B> |
| difference<strlit<wchar_t const*>, B> |
| operator-(wchar_t const* a, parser<B> const& b); |
| }} |
| namespace boost { namespace spirit { |
| template <typename A, typename B> |
| inline difference<A, B> |
| operator-(parser<A> const& a, parser<B> const& b) |
| { |
| return difference<A, B>(a.derived(), b.derived()); |
| } |
| template <typename A> |
| inline difference<A, chlit<char> > |
| operator-(parser<A> const& a, char b) |
| { |
| return difference<A, chlit<char> >(a.derived(), b); |
| } |
| template <typename B> |
| inline difference<chlit<char>, B> |
| operator-(char a, parser<B> const& b) |
| { |
| return difference<chlit<char>, B>(a, b.derived()); |
| } |
| template <typename A> |
| inline difference<A, strlit<char const*> > |
| operator-(parser<A> const& a, char const* b) |
| { |
| return difference<A, strlit<char const*> >(a.derived(), b); |
| } |
| template <typename B> |
| inline difference<strlit<char const*>, B> |
| operator-(char const* a, parser<B> const& b) |
| { |
| return difference<strlit<char const*>, B>(a, b.derived()); |
| } |
| template <typename A> |
| inline difference<A, chlit<wchar_t> > |
| operator-(parser<A> const& a, wchar_t b) |
| { |
| return difference<A, chlit<wchar_t> >(a.derived(), b); |
| } |
| template <typename B> |
| inline difference<chlit<wchar_t>, B> |
| operator-(wchar_t a, parser<B> const& b) |
| { |
| return difference<chlit<wchar_t>, B>(a, b.derived()); |
| } |
| template <typename A> |
| inline difference<A, strlit<wchar_t const*> > |
| operator-(parser<A> const& a, wchar_t const* b) |
| { |
| return difference<A, strlit<wchar_t const*> >(a.derived(), b); |
| } |
| template <typename B> |
| inline difference<strlit<wchar_t const*>, B> |
| operator-(wchar_t const* a, parser<B> const& b) |
| { |
| return difference<strlit<wchar_t const*>, B>(a, b.derived()); |
| } |
| }} |
| namespace boost { namespace spirit { |
| struct intersection_parser_gen; |
| template <typename A, typename B> |
| struct intersection |
| : public binary<A, B, parser<intersection<A, B> > > |
| { |
| typedef intersection<A, B> self_t; |
| typedef binary_parser_category parser_category_t; |
| typedef intersection_parser_gen parser_generator_t; |
| typedef binary<A, B, parser<self_t> > base_t; |
| intersection(A const& a, B const& b) |
| : base_t(a, b) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| typedef typename ScannerT::iterator_t iterator_t; |
| iterator_t save = scan.first; |
| if (result_t hl = this->left().parse(scan)) |
| { |
| ScannerT bscan(scan.first, scan.first); |
| scan.first = save; |
| result_t hr = this->right().parse(bscan); |
| if (hl.length() == hr.length()) |
| return hl; |
| } |
| return scan.no_match(); |
| } |
| }; |
| struct intersection_parser_gen |
| { |
| template <typename A, typename B> |
| struct result |
| { |
| typedef |
| intersection< |
| typename as_parser<A>::type |
| , typename as_parser<B>::type |
| > |
| type; |
| }; |
| template <typename A, typename B> |
| static intersection< |
| typename as_parser<A>::type |
| , typename as_parser<B>::type |
| > |
| generate(A const& a, B const& b) |
| { |
| return intersection<typename as_parser<A>::type, |
| typename as_parser<B>::type> |
| (as_parser<A>::convert(a), as_parser<B>::convert(b)); |
| } |
| }; |
| template <typename A, typename B> |
| intersection<A, B> |
| operator&(parser<A> const& a, parser<B> const& b); |
| template <typename A> |
| intersection<A, chlit<char> > |
| operator&(parser<A> const& a, char b); |
| template <typename B> |
| intersection<chlit<char>, B> |
| operator&(char a, parser<B> const& b); |
| template <typename A> |
| intersection<A, strlit<char const*> > |
| operator&(parser<A> const& a, char const* b); |
| template <typename B> |
| intersection<strlit<char const*>, B> |
| operator&(char const* a, parser<B> const& b); |
| template <typename A> |
| intersection<A, chlit<wchar_t> > |
| operator&(parser<A> const& a, wchar_t b); |
| template <typename B> |
| intersection<chlit<wchar_t>, B> |
| operator&(wchar_t a, parser<B> const& b); |
| template <typename A> |
| intersection<A, strlit<wchar_t const*> > |
| operator&(parser<A> const& a, wchar_t const* b); |
| template <typename B> |
| intersection<strlit<wchar_t const*>, B> |
| operator&(wchar_t const* a, parser<B> const& b); |
| }} |
| namespace boost { namespace spirit { |
| template <typename A, typename B> |
| inline intersection<A, B> |
| operator&(parser<A> const& a, parser<B> const& b) |
| { |
| return intersection<A, B>(a.derived(), b.derived()); |
| } |
| template <typename A> |
| inline intersection<A, chlit<char> > |
| operator&(parser<A> const& a, char b) |
| { |
| return intersection<A, chlit<char> >(a.derived(), b); |
| } |
| template <typename B> |
| inline intersection<chlit<char>, B> |
| operator&(char a, parser<B> const& b) |
| { |
| return intersection<chlit<char>, B>(a, b.derived()); |
| } |
| template <typename A> |
| inline intersection<A, strlit<char const*> > |
| operator&(parser<A> const& a, char const* b) |
| { |
| return intersection<A, strlit<char const*> >(a.derived(), b); |
| } |
| template <typename B> |
| inline intersection<strlit<char const*>, B> |
| operator&(char const* a, parser<B> const& b) |
| { |
| return intersection<strlit<char const*>, B>(a, b.derived()); |
| } |
| template <typename A> |
| inline intersection<A, chlit<wchar_t> > |
| operator&(parser<A> const& a, wchar_t b) |
| { |
| return intersection<A, chlit<wchar_t> >(a.derived(), b); |
| } |
| template <typename B> |
| inline intersection<chlit<wchar_t>, B> |
| operator&(wchar_t a, parser<B> const& b) |
| { |
| return intersection<chlit<wchar_t>, B>(a, b.derived()); |
| } |
| template <typename A> |
| inline intersection<A, strlit<wchar_t const*> > |
| operator&(parser<A> const& a, wchar_t const* b) |
| { |
| return intersection<A, strlit<wchar_t const*> >(a.derived(), b); |
| } |
| template <typename B> |
| inline intersection<strlit<wchar_t const*>, B> |
| operator&(wchar_t const* a, parser<B> const& b) |
| { |
| return intersection<strlit<wchar_t const*>, B>(a, b.derived()); |
| } |
| }} |
| namespace boost { namespace spirit { |
| struct exclusive_or_parser_gen; |
| template <typename A, typename B> |
| struct exclusive_or |
| : public binary<A, B, parser<exclusive_or<A, B> > > |
| { |
| typedef exclusive_or<A, B> self_t; |
| typedef binary_parser_category parser_category_t; |
| typedef exclusive_or_parser_gen parser_generator_t; |
| typedef binary<A, B, parser<self_t> > base_t; |
| exclusive_or(A const& a, B const& b) |
| : base_t(a, b) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| typedef typename ScannerT::iterator_t iterator_t; |
| iterator_t save = scan.first; |
| result_t l = this->left().parse(scan); |
| std::swap(save, scan.first); |
| result_t r = this->right().parse(scan); |
| if (l ? !bool(r) : bool(r)) |
| { |
| if (l) |
| scan.first = save; |
| return l ? l : r; |
| } |
| return scan.no_match(); |
| } |
| }; |
| struct exclusive_or_parser_gen |
| { |
| template <typename A, typename B> |
| struct result |
| { |
| typedef |
| exclusive_or< |
| typename as_parser<A>::type |
| , typename as_parser<B>::type |
| > |
| type; |
| }; |
| template <typename A, typename B> |
| static exclusive_or< |
| typename as_parser<A>::type |
| , typename as_parser<B>::type |
| > |
| generate(A const& a, B const& b) |
| { |
| return exclusive_or<typename as_parser<A>::type, |
| typename as_parser<B>::type> |
| (as_parser<A>::convert(a), as_parser<B>::convert(b)); |
| } |
| }; |
| template <typename A, typename B> |
| exclusive_or<A, B> |
| operator^(parser<A> const& a, parser<B> const& b); |
| template <typename A> |
| exclusive_or<A, chlit<char> > |
| operator^(parser<A> const& a, char b); |
| template <typename B> |
| exclusive_or<chlit<char>, B> |
| operator^(char a, parser<B> const& b); |
| template <typename A> |
| exclusive_or<A, strlit<char const*> > |
| operator^(parser<A> const& a, char const* b); |
| template <typename B> |
| exclusive_or<strlit<char const*>, B> |
| operator^(char const* a, parser<B> const& b); |
| template <typename A> |
| exclusive_or<A, chlit<wchar_t> > |
| operator^(parser<A> const& a, wchar_t b); |
| template <typename B> |
| exclusive_or<chlit<wchar_t>, B> |
| operator^(wchar_t a, parser<B> const& b); |
| template <typename A> |
| exclusive_or<A, strlit<wchar_t const*> > |
| operator^(parser<A> const& a, wchar_t const* b); |
| template <typename B> |
| exclusive_or<strlit<wchar_t const*>, B> |
| operator^(wchar_t const* a, parser<B> const& b); |
| }} |
| namespace boost { namespace spirit { |
| template <typename A, typename B> |
| inline exclusive_or<A, B> |
| operator^(parser<A> const& a, parser<B> const& b) |
| { |
| return exclusive_or<A, B>(a.derived(), b.derived()); |
| } |
| template <typename A> |
| inline exclusive_or<A, chlit<char> > |
| operator^(parser<A> const& a, char b) |
| { |
| return exclusive_or<A, chlit<char> >(a.derived(), b); |
| } |
| template <typename B> |
| inline exclusive_or<chlit<char>, B> |
| operator^(char a, parser<B> const& b) |
| { |
| return exclusive_or<chlit<char>, B>(a, b.derived()); |
| } |
| template <typename A> |
| inline exclusive_or<A, strlit<char const*> > |
| operator^(parser<A> const& a, char const* b) |
| { |
| return exclusive_or<A, strlit<char const*> >(a.derived(), b); |
| } |
| template <typename B> |
| inline exclusive_or<strlit<char const*>, B> |
| operator^(char const* a, parser<B> const& b) |
| { |
| return exclusive_or<strlit<char const*>, B>(a, b.derived()); |
| } |
| template <typename A> |
| inline exclusive_or<A, chlit<wchar_t> > |
| operator^(parser<A> const& a, wchar_t b) |
| { |
| return exclusive_or<A, chlit<wchar_t> >(a.derived(), b); |
| } |
| template <typename B> |
| inline exclusive_or<chlit<wchar_t>, B> |
| operator^(wchar_t a, parser<B> const& b) |
| { |
| return exclusive_or<chlit<wchar_t>, B>(a, b.derived()); |
| } |
| template <typename A> |
| inline exclusive_or<A, strlit<wchar_t const*> > |
| operator^(parser<A> const& a, wchar_t const* b) |
| { |
| return exclusive_or<A, strlit<wchar_t const*> >(a.derived(), b); |
| } |
| template <typename B> |
| inline exclusive_or<strlit<wchar_t const*>, B> |
| operator^(wchar_t const* a, parser<B> const& b) |
| { |
| return exclusive_or<strlit<wchar_t const*>, B>(a, b.derived()); |
| } |
| }} |
| namespace boost { namespace spirit { |
| struct kleene_star_parser_gen; |
| template <typename S> |
| struct kleene_star |
| : public unary<S, parser<kleene_star<S> > > |
| { |
| typedef kleene_star<S> self_t; |
| typedef unary_parser_category parser_category_t; |
| typedef kleene_star_parser_gen parser_generator_t; |
| typedef unary<S, parser<self_t> > base_t; |
| kleene_star(S const& a) |
| : base_t(a) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| typedef typename ScannerT::iterator_t iterator_t; |
| result_t hit = scan.empty_match(); |
| for (;;) |
| { |
| iterator_t save = scan.first; |
| if (result_t next = this->subject().parse(scan)) |
| { |
| scan.concat_match(hit, next); |
| } |
| else |
| { |
| scan.first = save; |
| return hit; |
| } |
| } |
| } |
| }; |
| struct kleene_star_parser_gen |
| { |
| template <typename S> |
| struct result |
| { |
| typedef kleene_star<S> type; |
| }; |
| template <typename S> |
| static kleene_star<S> |
| generate(parser<S> const& a) |
| { |
| return kleene_star<S>(a.derived()); |
| } |
| }; |
| template <typename S> |
| kleene_star<S> |
| operator*(parser<S> const& a); |
| }} |
| namespace boost { namespace spirit { |
| template <typename S> |
| inline kleene_star<S> |
| operator*(parser<S> const& a) |
| { |
| return kleene_star<S>(a.derived()); |
| } |
| }} |
| namespace boost { namespace spirit { |
| struct positive_parser_gen; |
| template <typename S> |
| struct positive |
| : public unary<S, parser<positive<S> > > |
| { |
| typedef positive<S> self_t; |
| typedef unary_parser_category parser_category_t; |
| typedef positive_parser_gen parser_generator_t; |
| typedef unary<S, parser<self_t> > base_t; |
| positive(S const& a) |
| : base_t(a) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| typedef typename ScannerT::iterator_t iterator_t; |
| result_t hit = this->subject().parse(scan); |
| if (hit) |
| { |
| for (;;) |
| { |
| iterator_t save = scan.first; |
| if (result_t next = this->subject().parse(scan)) |
| { |
| scan.concat_match(hit, next); |
| } |
| else |
| { |
| scan.first = save; |
| break; |
| } |
| } |
| } |
| return hit; |
| } |
| }; |
| struct positive_parser_gen |
| { |
| template <typename S> |
| struct result |
| { |
| typedef positive<S> type; |
| }; |
| template <typename S> |
| static positive<S> |
| generate(parser<S> const& a) |
| { |
| return positive<S>(a.derived()); |
| } |
| }; |
| template <typename S> |
| inline positive<S> |
| operator+(parser<S> const& a); |
| }} |
| namespace boost { namespace spirit { |
| template <typename S> |
| inline positive<S> |
| operator+(parser<S> const& a) |
| { |
| return positive<S>(a.derived()); |
| } |
| }} |
| namespace boost { namespace spirit { |
| struct optional_parser_gen; |
| template <typename S> |
| struct optional |
| : public unary<S, parser<optional<S> > > |
| { |
| typedef optional<S> self_t; |
| typedef unary_parser_category parser_category_t; |
| typedef optional_parser_gen parser_generator_t; |
| typedef unary<S, parser<self_t> > base_t; |
| optional(S const& a) |
| : base_t(a) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| typedef typename ScannerT::iterator_t iterator_t; |
| iterator_t save = scan.first; |
| if (result_t r = this->subject().parse(scan)) |
| { |
| return r; |
| } |
| else |
| { |
| scan.first = save; |
| return scan.empty_match(); |
| } |
| } |
| }; |
| struct optional_parser_gen |
| { |
| template <typename S> |
| struct result |
| { |
| typedef optional<S> type; |
| }; |
| template <typename S> |
| static optional<S> |
| generate(parser<S> const& a) |
| { |
| return optional<S>(a.derived()); |
| } |
| }; |
| template <typename S> |
| optional<S> |
| operator!(parser<S> const& a); |
| }} |
| namespace boost { namespace spirit { |
| template <typename S> |
| optional<S> |
| operator!(parser<S> const& a) |
| { |
| return optional<S>(a.derived()); |
| } |
| }} |
| namespace boost { namespace spirit { |
| template <typename A, typename B> |
| sequence<A, kleene_star<sequence<B, A> > > |
| operator%(parser<A> const& a, parser<B> const& b); |
| template <typename A> |
| sequence<A, kleene_star<sequence<chlit<char>, A> > > |
| operator%(parser<A> const& a, char b); |
| template <typename B> |
| sequence<chlit<char>, kleene_star<sequence<B, chlit<char> > > > |
| operator%(char a, parser<B> const& b); |
| template <typename A> |
| sequence<A, kleene_star<sequence<strlit<char const*>, A> > > |
| operator%(parser<A> const& a, char const* b); |
| template <typename B> |
| sequence<strlit<char const*>, |
| kleene_star<sequence<B, strlit<char const*> > > > |
| operator%(char const* a, parser<B> const& b); |
| template <typename A> |
| sequence<A, kleene_star<sequence<chlit<wchar_t>, A> > > |
| operator%(parser<A> const& a, wchar_t b); |
| template <typename B> |
| sequence<chlit<wchar_t>, kleene_star<sequence<B, chlit<wchar_t> > > > |
| operator%(wchar_t a, parser<B> const& b); |
| template <typename A> |
| sequence<A, kleene_star<sequence<strlit<wchar_t const*>, A> > > |
| operator%(parser<A> const& a, wchar_t const* b); |
| template <typename B> |
| sequence<strlit<wchar_t const*>, |
| kleene_star<sequence<B, strlit<wchar_t const*> > > > |
| operator%(wchar_t const* a, parser<B> const& b); |
| }} |
| namespace boost { namespace spirit { |
| template <typename A, typename B> |
| inline sequence<A, kleene_star<sequence<B, A> > > |
| operator%(parser<A> const& a, parser<B> const& b) |
| { |
| return a.derived() >> *(b.derived() >> a.derived()); |
| } |
| template <typename A> |
| inline sequence<A, kleene_star<sequence<chlit<char>, A> > > |
| operator%(parser<A> const& a, char b) |
| { |
| return a.derived() >> *(b >> a.derived()); |
| } |
| template <typename B> |
| inline sequence<chlit<char>, kleene_star<sequence<B, chlit<char> > > > |
| operator%(char a, parser<B> const& b) |
| { |
| return a >> *(b.derived() >> a); |
| } |
| template <typename A> |
| inline sequence<A, kleene_star<sequence<strlit<char const*>, A> > > |
| operator%(parser<A> const& a, char const* b) |
| { |
| return a.derived() >> *(b >> a.derived()); |
| } |
| template <typename B> |
| inline sequence<strlit<char const*>, |
| kleene_star<sequence<B, strlit<char const*> > > > |
| operator%(char const* a, parser<B> const& b) |
| { |
| return a >> *(b.derived() >> a); |
| } |
| template <typename A> |
| inline sequence<A, kleene_star<sequence<chlit<wchar_t>, A> > > |
| operator%(parser<A> const& a, wchar_t b) |
| { |
| return a.derived() >> *(b >> a.derived()); |
| } |
| template <typename B> |
| inline sequence<chlit<wchar_t>, kleene_star<sequence<B, chlit<wchar_t> > > > |
| operator%(wchar_t a, parser<B> const& b) |
| { |
| return a >> *(b.derived() >> a); |
| } |
| template <typename A> |
| inline sequence<A, kleene_star<sequence<strlit<wchar_t const*>, A> > > |
| operator%(parser<A> const& a, wchar_t const* b) |
| { |
| return a.derived() >> *(b >> a.derived()); |
| } |
| template <typename B> |
| inline sequence<strlit<wchar_t const*>, |
| kleene_star<sequence<B, strlit<wchar_t const*> > > > |
| operator%(wchar_t const* a, parser<B> const& b) |
| { |
| return a >> *(b.derived() >> a); |
| } |
| }} |
| namespace boost { namespace spirit { |
| namespace impl |
| { |
| struct parser_type_traits_base { |
| static const bool is_alternative = false; |
| static const bool is_sequence = false; |
| static const bool is_sequential_or = false; |
| static const bool is_intersection = false; |
| static const bool is_difference = false; |
| static const bool is_exclusive_or = false; |
| static const bool is_optional = false; |
| static const bool is_kleene_star = false; |
| static const bool is_positive = false; |
| }; |
| template <typename ParserT> |
| struct parser_type_traits : public parser_type_traits_base { |
| }; |
| template <typename A, typename B> |
| struct parser_type_traits<alternative<A, B> > |
| : public parser_type_traits_base { |
| static const bool is_alternative = true; |
| }; |
| template <typename A, typename B> |
| struct parser_type_traits<sequence<A, B> > |
| : public parser_type_traits_base { |
| static const bool is_sequence = true; |
| }; |
| template <typename A, typename B> |
| struct parser_type_traits<sequential_or<A, B> > |
| : public parser_type_traits_base { |
| static const bool is_sequential_or = true; |
| }; |
| template <typename A, typename B> |
| struct parser_type_traits<intersection<A, B> > |
| : public parser_type_traits_base { |
| static const bool is_intersection = true; |
| }; |
| template <typename A, typename B> |
| struct parser_type_traits<difference<A, B> > |
| : public parser_type_traits_base { |
| static const bool is_difference = true; |
| }; |
| template <typename A, typename B> |
| struct parser_type_traits<exclusive_or<A, B> > |
| : public parser_type_traits_base { |
| static const bool is_exclusive_or = true; |
| }; |
| template <typename S> |
| struct parser_type_traits<optional<S> > |
| : public parser_type_traits_base { |
| static const bool is_optional = true; |
| }; |
| template <typename S> |
| struct parser_type_traits<kleene_star<S> > |
| : public parser_type_traits_base { |
| static const bool is_kleene_star = true; |
| }; |
| template <typename S> |
| struct parser_type_traits<positive<S> > |
| : public parser_type_traits_base { |
| static const bool is_positive = true; |
| }; |
| } |
| }} |
| namespace boost { namespace spirit { |
| template <typename T> |
| struct is_parser |
| { |
| static const bool value = (::boost::is_base_and_derived<parser<T>, T>::value); |
| }; |
| template <typename UnaryT> |
| struct is_unary_composite { |
| static const bool value = (::boost::is_convertible< typename UnaryT::parser_category_t, unary_parser_category>::value); |
| }; |
| template <typename ActionT> |
| struct is_action_parser { |
| static const bool value = (::boost::is_convertible< typename ActionT::parser_category_t, action_parser_category>::value); |
| }; |
| template <typename BinaryT> |
| struct is_binary_composite { |
| static const bool value = (::boost::is_convertible< typename BinaryT::parser_category_t, binary_parser_category>::value); |
| }; |
| template <typename CompositeT> |
| struct is_composite_parser { |
| static const bool value = ( ::boost::spirit::is_unary_composite<CompositeT>::value || ::boost::spirit::is_binary_composite<CompositeT>::value); |
| }; |
| template <typename ParserT> |
| struct is_alternative { |
| static const bool value = ( ::boost::spirit::impl::parser_type_traits<ParserT>::is_alternative); |
| }; |
| template <typename ParserT> |
| struct is_sequence { |
| static const bool value = ( ::boost::spirit::impl::parser_type_traits<ParserT>::is_sequence); |
| }; |
| template <typename ParserT> |
| struct is_sequential_or { |
| static const bool value = ( ::boost::spirit::impl::parser_type_traits<ParserT>::is_sequential_or); |
| }; |
| template <typename ParserT> |
| struct is_intersection { |
| static const bool value = ( ::boost::spirit::impl::parser_type_traits<ParserT>::is_intersection); |
| }; |
| template <typename ParserT> |
| struct is_difference { |
| static const bool value = ( ::boost::spirit::impl::parser_type_traits<ParserT>::is_difference); |
| }; |
| template <typename ParserT> |
| struct is_exclusive_or { |
| static const bool value = ( ::boost::spirit::impl::parser_type_traits<ParserT>::is_exclusive_or); |
| }; |
| template <typename ParserT> |
| struct is_optional { |
| static const bool value = ( ::boost::spirit::impl::parser_type_traits<ParserT>::is_optional); |
| }; |
| template <typename ParserT> |
| struct is_kleene_star { |
| static const bool value = ( ::boost::spirit::impl::parser_type_traits<ParserT>::is_kleene_star); |
| }; |
| template <typename ParserT> |
| struct is_positive { |
| static const bool value = ( ::boost::spirit::impl::parser_type_traits<ParserT>::is_positive); |
| }; |
| template <typename UnaryT> |
| struct unary_subject { |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( ::boost::spirit::is_unary_composite<UnaryT>::value ) >)> boost_static_assert_typedef_183; |
| typedef typename UnaryT::subject_t type; |
| }; |
| template <typename UnaryT> |
| inline typename unary_subject<UnaryT>::type const & |
| get_unary_subject(UnaryT const &unary_) |
| { |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( ::boost::spirit::is_unary_composite<UnaryT>::value ) >)> boost_static_assert_typedef_199; |
| return unary_.subject(); |
| } |
| template <typename BinaryT> |
| struct binary_left_subject { |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( ::boost::spirit::is_binary_composite<BinaryT>::value ) >)> boost_static_assert_typedef_215; |
| typedef typename BinaryT::left_t type; |
| }; |
| template <typename BinaryT> |
| struct binary_right_subject { |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( ::boost::spirit::is_binary_composite<BinaryT>::value ) >)> boost_static_assert_typedef_222; |
| typedef typename BinaryT::right_t type; |
| }; |
| template <typename BinaryT> |
| inline typename binary_left_subject<BinaryT>::type const & |
| get_binary_left_subject(BinaryT const &binary_) |
| { |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( ::boost::spirit::is_binary_composite<BinaryT>::value ) >)> boost_static_assert_typedef_239; |
| return binary_.left(); |
| } |
| template <typename BinaryT> |
| inline typename binary_right_subject<BinaryT>::type const & |
| get_binary_right_subject(BinaryT const &binary_) |
| { |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( ::boost::spirit::is_binary_composite<BinaryT>::value ) >)> boost_static_assert_typedef_247; |
| return binary_.right(); |
| } |
| template <typename ActionT> |
| struct action_subject { |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( ::boost::spirit::is_action_parser<ActionT>::value ) >)> boost_static_assert_typedef_262; |
| typedef typename ActionT::subject_t type; |
| }; |
| template <typename ActionT> |
| inline typename action_subject<ActionT>::type const & |
| get_action_subject(ActionT const &action_) |
| { |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( ::boost::spirit::is_action_parser<ActionT>::value ) >)> boost_static_assert_typedef_278; |
| return action_.subject(); |
| } |
| template <typename ActionT> |
| struct semantic_action { |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( ::boost::spirit::is_action_parser<ActionT>::value ) >)> boost_static_assert_typedef_293; |
| typedef typename ActionT::predicate_t type; |
| }; |
| template <typename ActionT> |
| inline typename semantic_action<ActionT>::type const & |
| get_semantic_action(ActionT const &action_) |
| { |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( ::boost::spirit::is_action_parser<ActionT>::value ) >)> boost_static_assert_typedef_309; |
| return action_.predicate(); |
| } |
| }} |
| namespace boost { |
| namespace spirit { |
| template<typename BaseT = action_policy> |
| struct no_actions_action_policy: |
| public BaseT |
| { |
| typedef BaseT base_t; |
| no_actions_action_policy(): |
| BaseT() |
| {} |
| template<typename PolicyT> |
| no_actions_action_policy(PolicyT const& other): |
| BaseT(other) |
| {} |
| template<typename ActorT, typename AttrT, typename IteratorT> |
| void |
| do_action( |
| ActorT const& actor, |
| AttrT& val, |
| IteratorT const& first, |
| IteratorT const& last) const |
| {} |
| }; |
| template<typename ScannerT = scanner<> > |
| struct no_actions_scanner |
| { |
| typedef scanner_policies< |
| typename ScannerT::iteration_policy_t, |
| typename ScannerT::match_policy_t, |
| no_actions_action_policy<typename ScannerT::action_policy_t> |
| > policies_t; |
| typedef typename |
| rebind_scanner_policies<ScannerT, policies_t>::type type; |
| }; |
| struct no_actions_parser_gen; |
| template<typename ParserT> |
| struct no_actions_parser: |
| public unary<ParserT, parser<no_actions_parser<ParserT> > > |
| { |
| typedef no_actions_parser<ParserT> self_t; |
| typedef unary_parser_category parser_category_t; |
| typedef no_actions_parser_gen parser_generator_t; |
| typedef unary<ParserT, parser<self_t> > base_t; |
| template<typename ScannerT> |
| struct result |
| { |
| typedef typename parser_result<ParserT, ScannerT>::type type; |
| }; |
| no_actions_parser(ParserT const& p) |
| : base_t(p) |
| {} |
| template<typename ScannerT> |
| typename result<ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename no_actions_scanner<ScannerT>::policies_t policies_t; |
| return this->subject().parse(scan.change_policies(policies_t(scan))); |
| } |
| }; |
| struct no_actions_parser_gen |
| { |
| template<typename ParserT> |
| struct result |
| { |
| typedef no_actions_parser<ParserT> type; |
| }; |
| template<typename ParserT> |
| static no_actions_parser<ParserT> |
| generate(parser<ParserT> const& subject) |
| { |
| return no_actions_parser<ParserT>(subject.derived()); |
| } |
| template<typename ParserT> |
| no_actions_parser<ParserT> |
| operator[](parser<ParserT> const& subject) const |
| { |
| return no_actions_parser<ParserT>(subject.derived()); |
| } |
| }; |
| const no_actions_parser_gen no_actions_d = no_actions_parser_gen(); |
| } |
| } |
| namespace boost { namespace spirit { |
| template <typename CondT, bool positive = true> |
| struct condition_parser : parser<condition_parser<CondT, positive> > |
| { |
| typedef condition_parser<CondT, positive> self_t; |
| condition_parser(CondT const& cond_) : cond(cond_) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| if (positive == cond()) |
| return scan.empty_match(); |
| else |
| return scan.no_match(); |
| } |
| condition_parser<CondT, !positive> |
| negate() const |
| { return condition_parser<CondT, !positive>(cond); } |
| private: |
| CondT cond; |
| }; |
| template <typename CondT, bool positive> |
| inline condition_parser<CondT, !positive> |
| operator~(condition_parser<CondT, positive> const& p) |
| { return p.negate(); } |
| struct empty_match_parser_gen; |
| struct negated_empty_match_parser_gen; |
| template <typename SubjectT> |
| struct negated_empty_match_parser; |
| template<typename SubjectT> |
| struct empty_match_parser |
| : unary<SubjectT, parser<empty_match_parser<SubjectT> > > |
| { |
| typedef empty_match_parser<SubjectT> self_t; |
| typedef unary<SubjectT, parser<self_t> > base_t; |
| typedef unary_parser_category parser_category_t; |
| typedef empty_match_parser_gen parser_genererator_t; |
| typedef self_t embed_t; |
| explicit empty_match_parser(SubjectT const& p) : base_t(p) {} |
| template <typename ScannerT> |
| struct result |
| { typedef typename match_result<ScannerT, nil_t>::type type; }; |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typename ScannerT::iterator_t save(scan.first); |
| typedef typename no_actions_scanner<ScannerT>::policies_t |
| policies_t; |
| bool matches = this->subject().parse( |
| scan.change_policies(policies_t(scan))); |
| if (matches) |
| { |
| scan.first = save; |
| return scan.empty_match(); |
| } |
| else |
| { |
| return scan.no_match(); |
| } |
| } |
| negated_empty_match_parser<SubjectT> |
| negate() const |
| { return negated_empty_match_parser<SubjectT>(this->subject()); } |
| }; |
| template<typename SubjectT> |
| struct negated_empty_match_parser |
| : public unary<SubjectT, parser<negated_empty_match_parser<SubjectT> > > |
| { |
| typedef negated_empty_match_parser<SubjectT> self_t; |
| typedef unary<SubjectT, parser<self_t> > base_t; |
| typedef unary_parser_category parser_category_t; |
| typedef negated_empty_match_parser_gen parser_genererator_t; |
| explicit negated_empty_match_parser(SubjectT const& p) : base_t(p) {} |
| template <typename ScannerT> |
| struct result |
| { typedef typename match_result<ScannerT, nil_t>::type type; }; |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typename ScannerT::iterator_t save(scan.first); |
| bool matches = this->subject().parse(scan); |
| if (!matches) |
| { |
| scan.first = save; |
| return scan.empty_match(); |
| } |
| else |
| { |
| return scan.no_match(); |
| } |
| } |
| empty_match_parser<SubjectT> |
| negate() const |
| { return empty_match_parser<SubjectT>(this->subject()); } |
| }; |
| struct empty_match_parser_gen |
| { |
| template <typename SubjectT> |
| struct result |
| { typedef empty_match_parser<SubjectT> type; }; |
| template <typename SubjectT> |
| static empty_match_parser<SubjectT> |
| generate(parser<SubjectT> const& subject) |
| { return empty_match_parser<SubjectT>(subject.derived()); } |
| }; |
| struct negated_empty_match_parser_gen |
| { |
| template <typename SubjectT> |
| struct result |
| { typedef negated_empty_match_parser<SubjectT> type; }; |
| template <typename SubjectT> |
| static negated_empty_match_parser<SubjectT> |
| generate(parser<SubjectT> const& subject) |
| { return negated_empty_match_parser<SubjectT>(subject.derived()); } |
| }; |
| template <typename SubjectT> |
| inline negated_empty_match_parser<SubjectT> |
| operator~(empty_match_parser<SubjectT> const& p) |
| { return p.negate(); } |
| template <typename SubjectT> |
| inline empty_match_parser<SubjectT> |
| operator~(negated_empty_match_parser<SubjectT> const& p) |
| { return p.negate(); } |
| namespace impl |
| { |
| template <typename SubjectT> |
| struct epsilon_selector |
| { |
| typedef typename as_parser<SubjectT>::type subject_t; |
| typedef typename |
| mpl::if_< |
| is_parser<subject_t> |
| ,empty_match_parser<subject_t> |
| ,condition_parser<subject_t> |
| >::type type; |
| }; |
| } |
| struct epsilon_parser : public parser<epsilon_parser> |
| { |
| typedef epsilon_parser self_t; |
| epsilon_parser() {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { return scan.empty_match(); } |
| template <typename SubjectT> |
| typename impl::epsilon_selector<SubjectT>::type |
| operator()(SubjectT const& subject) const |
| { |
| typedef typename impl::epsilon_selector<SubjectT>::type result_t; |
| return result_t(subject); |
| } |
| }; |
| epsilon_parser const epsilon_p = epsilon_parser(); |
| epsilon_parser const eps_p = epsilon_parser(); |
| }} |
| #include <bitset> |
| namespace boost { namespace spirit { namespace utility { namespace impl { |
| template <typename CharT> |
| struct range { |
| range(CharT first, CharT last); |
| bool is_valid() const; |
| bool includes(CharT v) const; |
| bool includes(range const& r) const; |
| bool overlaps(range const& r) const; |
| void merge(range const& r); |
| CharT first; |
| CharT last; |
| }; |
| template <typename CharT> |
| struct range_char_compare { |
| bool operator()(range<CharT> const& x, const CharT y) const |
| { return x.first < y; } |
| }; |
| template <typename CharT> |
| struct range_compare { |
| bool operator()(range<CharT> const& x, range<CharT> const& y) const |
| { return x.first < y.first; } |
| }; |
| template <typename CharT> |
| class range_run { |
| public: |
| typedef range<CharT> range_t; |
| typedef std::vector<range_t> run_t; |
| typedef typename run_t::iterator iterator; |
| typedef typename run_t::const_iterator const_iterator; |
| void swap(range_run& rr); |
| bool test(CharT v) const; |
| void set(range_t const& r); |
| void clear(range_t const& r); |
| void clear(); |
| const_iterator begin() const; |
| const_iterator end() const; |
| private: |
| void merge(iterator iter, range_t const& r); |
| run_t run; |
| }; |
| }}}} |
| namespace boost { namespace spirit { |
| namespace utility { namespace impl { |
| template <typename CharT> |
| inline range<CharT>::range(CharT first_, CharT last_) |
| : first(first_), last(last_) {} |
| template <typename CharT> |
| inline bool |
| range<CharT>::is_valid() const |
| { return first <= last; } |
| template <typename CharT> |
| inline bool |
| range<CharT>::includes(range const& r) const |
| { return (first <= r.first) && (last >= r.last); } |
| template <typename CharT> |
| inline bool |
| range<CharT>::includes(CharT v) const |
| { return (first <= v) && (last >= v); } |
| template <typename CharT> |
| inline bool |
| range<CharT>::overlaps(range const& r) const |
| { |
| CharT decr_first = |
| first == std::numeric_limits<CharT>::min() ? first : first-1; |
| CharT incr_last = |
| last == std::numeric_limits<CharT>::max() ? last : last+1; |
| return (decr_first <= r.last) && (incr_last >= r.first); |
| } |
| template <typename CharT> |
| inline void |
| range<CharT>::merge(range const& r) |
| { |
| first = std::min(first, r.first); |
| last = std::max(last, r.last); |
| } |
| template <typename CharT> |
| inline bool |
| range_run<CharT>::test(CharT v) const |
| { |
| if (!run.empty()) |
| { |
| const_iterator iter = |
| std::lower_bound( |
| run.begin(), run.end(), v, |
| range_char_compare<CharT>() |
| ); |
| if (iter != run.end() && iter->includes(v)) |
| return true; |
| if (iter != run.begin()) |
| return (--iter)->includes(v); |
| } |
| return false; |
| } |
| template <typename CharT> |
| inline void |
| range_run<CharT>::swap(range_run& rr) |
| { run.swap(rr.run); } |
| template <typename CharT> |
| void |
| range_run<CharT>::merge(iterator iter, range<CharT> const& r) |
| { |
| iter->merge(r); |
| iterator i = iter + 1; |
| while (i != run.end() && iter->overlaps(*i)) |
| iter->merge(*i++); |
| run.erase(iter+1, i); |
| } |
| template <typename CharT> |
| void |
| range_run<CharT>::set(range<CharT> const& r) |
| { |
| ; |
| if (!run.empty()) |
| { |
| iterator iter = |
| std::lower_bound( |
| run.begin(), run.end(), r, |
| range_compare<CharT>() |
| ); |
| if (iter != run.end() && iter->includes(r) || |
| ((iter != run.begin()) && (iter - 1)->includes(r))) |
| return; |
| if (iter != run.begin() && (iter - 1)->overlaps(r)) |
| merge(--iter, r); |
| else if (iter != run.end() && iter->overlaps(r)) |
| merge(iter, r); |
| else |
| run.insert(iter, r); |
| } |
| else |
| { |
| run.push_back(r); |
| } |
| } |
| template <typename CharT> |
| void |
| range_run<CharT>::clear(range<CharT> const& r) |
| { |
| ; |
| if (!run.empty()) |
| { |
| iterator iter = |
| std::lower_bound( |
| run.begin(), run.end(), r, |
| range_compare<CharT>() |
| ); |
| iterator left_iter; |
| if ((iter != run.begin()) && |
| (left_iter = (iter - 1))->includes(r.first)) |
| if (left_iter->last > r.last) |
| { |
| CharT save_last = left_iter->last; |
| left_iter->last = r.first-1; |
| run.insert(iter, range<CharT>(r.last+1, save_last)); |
| return; |
| } |
| else |
| { |
| left_iter->last = r.first-1; |
| } |
| iterator i = iter; |
| while (i != run.end() && r.includes(*i)) |
| i++; |
| if (i != run.end() && i->includes(r.last)) |
| i->first = r.last+1; |
| run.erase(iter, i); |
| } |
| } |
| template <typename CharT> |
| inline void |
| range_run<CharT>::clear() |
| { run.clear(); } |
| template <typename CharT> |
| inline typename range_run<CharT>::const_iterator |
| range_run<CharT>::begin() const |
| { return run.begin(); } |
| template <typename CharT> |
| inline typename range_run<CharT>::const_iterator |
| range_run<CharT>::end() const |
| { return run.end(); } |
| }} |
| }} |
| namespace boost { namespace spirit { |
| template <typename CharT> |
| class basic_chset |
| { |
| public: |
| basic_chset(); |
| basic_chset(basic_chset const& arg_); |
| bool test(CharT v) const; |
| void set(CharT from, CharT to); |
| void set(CharT c); |
| void clear(CharT from, CharT to); |
| void clear(CharT c); |
| void clear(); |
| void inverse(); |
| void swap(basic_chset& x); |
| basic_chset& operator|=(basic_chset const& x); |
| basic_chset& operator&=(basic_chset const& x); |
| basic_chset& operator-=(basic_chset const& x); |
| basic_chset& operator^=(basic_chset const& x); |
| private: utility::impl::range_run<CharT> rr; |
| }; |
| template <typename CharT> |
| class basic_chset_8bit { |
| public: |
| basic_chset_8bit(); |
| basic_chset_8bit(basic_chset_8bit const& arg_); |
| bool test(CharT v) const; |
| void set(CharT from, CharT to); |
| void set(CharT c); |
| void clear(CharT from, CharT to); |
| void clear(CharT c); |
| void clear(); |
| void inverse(); |
| void swap(basic_chset_8bit& x); |
| basic_chset_8bit& operator|=(basic_chset_8bit const& x); |
| basic_chset_8bit& operator&=(basic_chset_8bit const& x); |
| basic_chset_8bit& operator-=(basic_chset_8bit const& x); |
| basic_chset_8bit& operator^=(basic_chset_8bit const& x); |
| private: std::bitset<256> bset; |
| }; |
| template <> |
| class basic_chset<char> |
| : public basic_chset_8bit<char> {}; |
| template <> |
| class basic_chset<signed char> |
| : public basic_chset_8bit<signed char> {}; |
| template <> |
| class basic_chset<unsigned char> |
| : public basic_chset_8bit<unsigned char> {}; |
| }} |
| namespace boost { namespace spirit { |
| template <typename CharT> |
| inline basic_chset<CharT>::basic_chset() {} |
| template <typename CharT> |
| inline basic_chset<CharT>::basic_chset(basic_chset const& arg_) |
| : rr(arg_.rr) {} |
| template <typename CharT> |
| inline bool |
| basic_chset<CharT>::test(CharT v) const |
| { return rr.test(v); } |
| template <typename CharT> |
| inline void |
| basic_chset<CharT>::set(CharT from, CharT to) |
| { rr.set(utility::impl::range<CharT>(from, to)); } |
| template <typename CharT> |
| inline void |
| basic_chset<CharT>::set(CharT c) |
| { rr.set(utility::impl::range<CharT>(c, c)); } |
| template <typename CharT> |
| inline void |
| basic_chset<CharT>::clear(CharT from, CharT to) |
| { rr.clear(utility::impl::range<CharT>(from, to)); } |
| template <typename CharT> |
| inline void |
| basic_chset<CharT>::clear() |
| { rr.clear(); } |
| template <typename CharT> |
| inline void |
| basic_chset<CharT>::inverse() |
| { |
| basic_chset inv; |
| inv.set( |
| std::numeric_limits<CharT>::min(), |
| std::numeric_limits<CharT>::max() |
| ); |
| inv -= *this; |
| swap(inv); |
| } |
| template <typename CharT> |
| inline void |
| basic_chset<CharT>::swap(basic_chset& x) |
| { rr.swap(x.rr); } |
| template <typename CharT> |
| inline basic_chset<CharT>& |
| basic_chset<CharT>::operator|=(basic_chset<CharT> const& x) |
| { |
| typedef typename utility::impl::range_run<CharT>::const_iterator const_iterator; |
| for (const_iterator iter = x.rr.begin(); iter != x.rr.end(); ++iter) |
| rr.set(*iter); |
| return *this; |
| } |
| template <typename CharT> |
| inline basic_chset<CharT>& |
| basic_chset<CharT>::operator&=(basic_chset<CharT> const& x) |
| { |
| basic_chset inv; |
| inv.set( |
| std::numeric_limits<CharT>::min(), |
| std::numeric_limits<CharT>::max() |
| ); |
| inv -= x; |
| *this -= inv; |
| return *this; |
| } |
| template <typename CharT> |
| inline basic_chset<CharT>& |
| basic_chset<CharT>::operator-=(basic_chset<CharT> const& x) |
| { |
| typedef typename utility::impl::range_run<CharT>::const_iterator const_iterator; |
| for (const_iterator iter = x.rr.begin(); iter != x.rr.end(); ++iter) |
| rr.clear(*iter); |
| return *this; |
| } |
| template <typename CharT> |
| inline basic_chset<CharT>& |
| basic_chset<CharT>::operator^=(basic_chset<CharT> const& x) |
| { |
| basic_chset bma = x; |
| bma -= *this; |
| *this -= x; |
| *this |= bma; |
| return *this; |
| } |
| template <typename CharT> |
| inline basic_chset_8bit<CharT>::basic_chset_8bit() {} |
| template <typename CharT> |
| inline basic_chset_8bit<CharT>::basic_chset_8bit(basic_chset_8bit const& arg_) |
| : bset(arg_.bset) {} |
| template <typename CharT> |
| inline bool |
| basic_chset_8bit<CharT>::test(CharT v) const |
| { return bset.test((unsigned char)v); } |
| template <typename CharT> |
| inline void |
| basic_chset_8bit<CharT>::set(CharT from, CharT to) |
| { |
| for (int i = from; i <= to; ++i) |
| bset.set((unsigned char)i); |
| } |
| template <typename CharT> |
| inline void |
| basic_chset_8bit<CharT>::set(CharT c) |
| { bset.set((unsigned char)c); } |
| template <typename CharT> |
| inline void |
| basic_chset_8bit<CharT>::clear(CharT from, CharT to) |
| { |
| for (int i = from; i <= to; ++i) |
| bset.reset((unsigned char)i); |
| } |
| template <typename CharT> |
| inline void |
| basic_chset_8bit<CharT>::clear(CharT c) |
| { bset.reset((unsigned char)c); } |
| template <typename CharT> |
| inline void |
| basic_chset_8bit<CharT>::clear() |
| { bset.reset(); } |
| template <typename CharT> |
| inline void |
| basic_chset_8bit<CharT>::inverse() |
| { bset.flip(); } |
| template <typename CharT> |
| inline void |
| basic_chset_8bit<CharT>::swap(basic_chset_8bit& x) |
| { std::swap(bset, x.bset); } |
| template <typename CharT> |
| inline basic_chset_8bit<CharT>& |
| basic_chset_8bit<CharT>::operator|=(basic_chset_8bit const& x) |
| { |
| bset |= x.bset; |
| return *this; |
| } |
| template <typename CharT> |
| inline basic_chset_8bit<CharT>& |
| basic_chset_8bit<CharT>::operator&=(basic_chset_8bit const& x) |
| { |
| bset &= x.bset; |
| return *this; |
| } |
| template <typename CharT> |
| inline basic_chset_8bit<CharT>& |
| basic_chset_8bit<CharT>::operator-=(basic_chset_8bit const& x) |
| { |
| bset &= ~x.bset; |
| return *this; |
| } |
| template <typename CharT> |
| inline basic_chset_8bit<CharT>& |
| basic_chset_8bit<CharT>::operator^=(basic_chset_8bit const& x) |
| { |
| bset ^= x.bset; |
| return *this; |
| } |
| }} |
| namespace boost { namespace spirit { |
| namespace utility { namespace impl { |
| template <typename CharT, typename CharT2> |
| void construct_chset(boost::shared_ptr<basic_chset<CharT> >& ptr, |
| CharT2 const* definition); |
| }} |
| template <typename CharT = char> |
| class chset: public char_parser<chset<CharT> > { |
| public: |
| chset(); |
| chset(chset const& arg_); |
| explicit chset(CharT arg_); |
| explicit chset(anychar_parser arg_); |
| explicit chset(nothing_parser arg_); |
| explicit chset(chlit<CharT> const& arg_); |
| explicit chset(range<CharT> const& arg_); |
| explicit chset(negated_char_parser<chlit<CharT> > const& arg_); |
| explicit chset(negated_char_parser<range<CharT> > const& arg_); |
| template <typename CharT2> |
| explicit chset(CharT2 const* definition) |
| : ptr(new basic_chset<CharT>()) |
| { |
| utility::impl::construct_chset(ptr, definition); |
| } |
| ~chset(); |
| chset& operator=(chset const& rhs); |
| chset& operator=(CharT rhs); |
| chset& operator=(anychar_parser rhs); |
| chset& operator=(nothing_parser rhs); |
| chset& operator=(chlit<CharT> const& rhs); |
| chset& operator=(range<CharT> const& rhs); |
| chset& operator=(negated_char_parser<chlit<CharT> > const& rhs); |
| chset& operator=(negated_char_parser<range<CharT> > const& rhs); |
| void set(range<CharT> const& arg_); |
| void set(negated_char_parser<chlit<CharT> > const& arg_); |
| void set(negated_char_parser<range<CharT> > const& arg_); |
| void clear(range<CharT> const& arg_); |
| void clear(negated_char_parser<range<CharT> > const& arg_); |
| bool test(CharT ch) const; |
| chset& inverse(); |
| void swap(chset& x); |
| chset& operator|=(chset const& x); |
| chset& operator&=(chset const& x); |
| chset& operator-=(chset const& x); |
| chset& operator^=(chset const& x); |
| private: |
| boost::shared_ptr<basic_chset<CharT> > ptr; |
| }; |
| template <typename CharT> |
| inline chset<CharT> |
| chset_p(chlit<CharT> const& arg_) |
| { return chset<CharT>(arg_); } |
| template <typename CharT> |
| inline chset<CharT> |
| chset_p(range<CharT> const& arg_) |
| { return chset<CharT>(arg_); } |
| template <typename CharT> |
| inline chset<CharT> |
| chset_p(negated_char_parser<chlit<CharT> > const& arg_) |
| { return chset<CharT>(arg_); } |
| template <typename CharT> |
| inline chset<CharT> |
| chset_p(negated_char_parser<range<CharT> > const& arg_) |
| { return chset<CharT>(arg_); } |
| inline chset<char> |
| chset_p(char const* init) |
| { return chset<char>(init); } |
| inline chset<wchar_t> |
| chset_p(wchar_t const* init) |
| { return chset<wchar_t>(init); } |
| inline chset<char> |
| chset_p(char ch) |
| { return chset<char>(ch); } |
| inline chset<wchar_t> |
| chset_p(wchar_t ch) |
| { return chset<wchar_t>(ch); } |
| inline chset<int> |
| chset_p(int ch) |
| { return chset<int>(ch); } |
| inline chset<unsigned int> |
| chset_p(unsigned int ch) |
| { return chset<unsigned int>(ch); } |
| inline chset<short> |
| chset_p(short ch) |
| { return chset<short>(ch); } |
| inline chset<unsigned short> |
| chset_p(unsigned short ch) |
| { return chset<unsigned short>(ch); } |
| inline chset<long> |
| chset_p(long ch) |
| { return chset<long>(ch); } |
| inline chset<unsigned long> |
| chset_p(unsigned long ch) |
| { return chset<unsigned long>(ch); } |
| inline chset<long long> |
| chset_p(long long ch) |
| { return chset<long long>(ch); } |
| inline chset<unsigned long long> |
| chset_p(unsigned long long ch) |
| { return chset<unsigned long long>(ch); } |
| }} |
| namespace boost { namespace spirit { |
| template <typename CharT> |
| inline chset<CharT> |
| operator|(chset<CharT> const& a, chset<CharT> const& b) |
| { |
| return chset<CharT>(a) |= b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator-(chset<CharT> const& a, chset<CharT> const& b) |
| { |
| return chset<CharT>(a) -= b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator~(chset<CharT> const& a) |
| { |
| return chset<CharT>(a).inverse(); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator&(chset<CharT> const& a, chset<CharT> const& b) |
| { |
| return chset<CharT>(a) &= b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator^(chset<CharT> const& a, chset<CharT> const& b) |
| { |
| return chset<CharT>(a) ^= b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator|(chset<CharT> const& a, range<CharT> const& b) |
| { |
| chset<CharT> a_(a); |
| a_.set(b); |
| return a_; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator&(chset<CharT> const& a, range<CharT> const& b) |
| { |
| chset<CharT> a_(a); |
| if(b.first != std::numeric_limits<CharT>::min()) { |
| a_.clear(range<CharT>(std::numeric_limits<CharT>::min(), b.first - 1)); |
| } |
| if(b.last != std::numeric_limits<CharT>::max()) { |
| a_.clear(range<CharT>(b.last + 1, std::numeric_limits<CharT>::max())); |
| } |
| return a_; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator-(chset<CharT> const& a, range<CharT> const& b) |
| { |
| chset<CharT> a_(a); |
| a_.clear(b); |
| return a_; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator^(chset<CharT> const& a, range<CharT> const& b) |
| { |
| return a ^ chset<CharT>(b); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator|(range<CharT> const& a, chset<CharT> const& b) |
| { |
| chset<CharT> b_(b); |
| b_.set(a); |
| return b_; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator&(range<CharT> const& a, chset<CharT> const& b) |
| { |
| chset<CharT> b_(b); |
| if(a.first != std::numeric_limits<CharT>::min()) { |
| b_.clear(range<CharT>(std::numeric_limits<CharT>::min(), a.first - 1)); |
| } |
| if(a.last != std::numeric_limits<CharT>::max()) { |
| b_.clear(range<CharT>(a.last + 1, std::numeric_limits<CharT>::max())); |
| } |
| return b_; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator-(range<CharT> const& a, chset<CharT> const& b) |
| { |
| return chset<CharT>(a) - b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator^(range<CharT> const& a, chset<CharT> const& b) |
| { |
| return chset<CharT>(a) ^ b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator|(chset<CharT> const& a, CharT b) |
| { |
| return a | chset<CharT>(b); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator&(chset<CharT> const& a, CharT b) |
| { |
| return a & chset<CharT>(b); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator-(chset<CharT> const& a, CharT b) |
| { |
| return a - chset<CharT>(b); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator^(chset<CharT> const& a, CharT b) |
| { |
| return a ^ chset<CharT>(b); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator|(CharT a, chset<CharT> const& b) |
| { |
| return chset<CharT>(a) | b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator&(CharT a, chset<CharT> const& b) |
| { |
| return chset<CharT>(a) & b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator-(CharT a, chset<CharT> const& b) |
| { |
| return chset<CharT>(a) - b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator^(CharT a, chset<CharT> const& b) |
| { |
| return chset<CharT>(a) ^ b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator|(chset<CharT> const& a, chlit<CharT> const& b) |
| { |
| return a | chset<CharT>(b.ch); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator&(chset<CharT> const& a, chlit<CharT> const& b) |
| { |
| return a & chset<CharT>(b.ch); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator-(chset<CharT> const& a, chlit<CharT> const& b) |
| { |
| return a - chset<CharT>(b.ch); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator^(chset<CharT> const& a, chlit<CharT> const& b) |
| { |
| return a ^ chset<CharT>(b.ch); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator|(chlit<CharT> const& a, chset<CharT> const& b) |
| { |
| return chset<CharT>(a.ch) | b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator&(chlit<CharT> const& a, chset<CharT> const& b) |
| { |
| return chset<CharT>(a.ch) & b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator-(chlit<CharT> const& a, chset<CharT> const& b) |
| { |
| return chset<CharT>(a.ch) - b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator^(chlit<CharT> const& a, chset<CharT> const& b) |
| { |
| return chset<CharT>(a.ch) ^ b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator|(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b) |
| { |
| return a | chset<CharT>(b); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator&(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b) |
| { |
| return a & chset<CharT>(b); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator-(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b) |
| { |
| return a - chset<CharT>(b); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator^(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b) |
| { |
| return a ^ chset<CharT>(b); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator|(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b) |
| { |
| return chset<CharT>(a) | b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator&(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b) |
| { |
| return chset<CharT>(a) & b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator-(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b) |
| { |
| return chset<CharT>(a) - b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator^(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b) |
| { |
| return chset<CharT>(a) ^ b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator|(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b) |
| { |
| return a | chset<CharT>(b); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator&(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b) |
| { |
| return a & chset<CharT>(b); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator-(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b) |
| { |
| return a - chset<CharT>(b); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator^(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b) |
| { |
| return a ^ chset<CharT>(b); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator|(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b) |
| { |
| return chset<CharT>(a) | b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator&(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b) |
| { |
| return chset<CharT>(a) & b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator-(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b) |
| { |
| return chset<CharT>(a) - b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator^(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b) |
| { |
| return chset<CharT>(a) ^ b; |
| } |
| namespace impl { |
| template <typename CharT> |
| inline boost::spirit::range<CharT> const& |
| full() |
| { |
| static boost::spirit::range<CharT> full_( |
| std::numeric_limits<CharT>::min(), |
| std::numeric_limits<CharT>::max()); |
| return full_; |
| } |
| template <typename CharT> |
| inline boost::spirit::range<CharT> const& |
| empty() |
| { |
| static boost::spirit::range<CharT> empty_; |
| return empty_; |
| } |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator|(chset<CharT> const&, anychar_parser) |
| { |
| return chset<CharT>(impl::full<CharT>()); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator&(chset<CharT> const& a, anychar_parser) |
| { |
| return a; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator-(chset<CharT> const&, anychar_parser) |
| { |
| return chset<CharT>(); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator^(chset<CharT> const& a, anychar_parser) |
| { |
| return ~a; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator|(anychar_parser, chset<CharT> const& ) |
| { |
| return chset<CharT>(impl::full<CharT>()); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator&(anychar_parser, chset<CharT> const& b) |
| { |
| return b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator-(anychar_parser, chset<CharT> const& b) |
| { |
| return ~b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator^(anychar_parser, chset<CharT> const& b) |
| { |
| return ~b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator|(chset<CharT> const& a, nothing_parser) |
| { |
| return a; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator&(chset<CharT> const& , nothing_parser) |
| { |
| return impl::empty<CharT>(); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator-(chset<CharT> const& a, nothing_parser) |
| { |
| return a; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator^(chset<CharT> const& a, nothing_parser) |
| { |
| return a; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator|(nothing_parser, chset<CharT> const& b) |
| { |
| return b; |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator&(nothing_parser, chset<CharT> const& ) |
| { |
| return impl::empty<CharT>(); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator-(nothing_parser, chset<CharT> const& ) |
| { |
| return impl::empty<CharT>(); |
| } |
| template <typename CharT> |
| inline chset<CharT> |
| operator^(nothing_parser, chset<CharT> const& b) |
| { |
| return b; |
| } |
| }} |
| namespace boost { namespace spirit { |
| template <typename CharT> |
| chset<CharT> |
| operator~(chset<CharT> const& a); |
| template <typename CharT> |
| chset<CharT> |
| operator|(chset<CharT> const& a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator&(chset<CharT> const& a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator-(chset<CharT> const& a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator^(chset<CharT> const& a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator|(chset<CharT> const& a, range<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator&(chset<CharT> const& a, range<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator-(chset<CharT> const& a, range<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator^(chset<CharT> const& a, range<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator|(range<CharT> const& a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator&(range<CharT> const& a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator-(range<CharT> const& a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator^(range<CharT> const& a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator|(chset<CharT> const& a, chlit<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator&(chset<CharT> const& a, chlit<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator-(chset<CharT> const& a, chlit<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator^(chset<CharT> const& a, chlit<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator|(chlit<CharT> const& a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator&(chlit<CharT> const& a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator-(chlit<CharT> const& a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator^(chlit<CharT> const& a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator|(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator&(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator-(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator^(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator|(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator&(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator-(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator^(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator|(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator&(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator-(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator^(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator|(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator&(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator-(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator^(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator|(chset<CharT> const& a, CharT b); |
| template <typename CharT> |
| chset<CharT> |
| operator&(chset<CharT> const& a, CharT b); |
| template <typename CharT> |
| chset<CharT> |
| operator-(chset<CharT> const& a, CharT b); |
| template <typename CharT> |
| chset<CharT> |
| operator^(chset<CharT> const& a, CharT b); |
| template <typename CharT> |
| chset<CharT> |
| operator|(CharT a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator&(CharT a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator-(CharT a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator^(CharT a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator|(chset<CharT> const& a, anychar_parser b); |
| template <typename CharT> |
| chset<CharT> |
| operator&(chset<CharT> const& a, anychar_parser b); |
| template <typename CharT> |
| chset<CharT> |
| operator-(chset<CharT> const& a, anychar_parser b); |
| template <typename CharT> |
| chset<CharT> |
| operator^(chset<CharT> const& a, anychar_parser b); |
| template <typename CharT> |
| chset<CharT> |
| operator|(anychar_parser a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator&(anychar_parser a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator-(anychar_parser a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator^(anychar_parser a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator|(chset<CharT> const& a, nothing_parser b); |
| template <typename CharT> |
| chset<CharT> |
| operator&(chset<CharT> const& a, nothing_parser b); |
| template <typename CharT> |
| chset<CharT> |
| operator-(chset<CharT> const& a, nothing_parser b); |
| template <typename CharT> |
| chset<CharT> |
| operator^(chset<CharT> const& a, nothing_parser b); |
| template <typename CharT> |
| chset<CharT> |
| operator|(nothing_parser a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator&(nothing_parser a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator-(nothing_parser a, chset<CharT> const& b); |
| template <typename CharT> |
| chset<CharT> |
| operator^(nothing_parser a, chset<CharT> const& b); |
| }} |
| namespace boost { namespace spirit { |
| namespace utility { namespace impl { |
| template <typename CharT> |
| inline void |
| detach(boost::shared_ptr<basic_chset<CharT> >& ptr) |
| { |
| if (!ptr.unique()) |
| ptr = boost::shared_ptr<basic_chset<CharT> > |
| (new basic_chset<CharT>(*ptr)); |
| } |
| template <typename CharT> |
| inline void |
| detach_clear(boost::shared_ptr<basic_chset<CharT> >& ptr) |
| { |
| if (ptr.unique()) |
| ptr->clear(); |
| else |
| ptr.reset(new basic_chset<CharT>()); |
| } |
| template <typename CharT, typename CharT2> |
| void construct_chset(boost::shared_ptr<basic_chset<CharT> >& ptr, |
| CharT2 const* definition) |
| { |
| CharT2 ch = *definition++; |
| while (ch) |
| { |
| CharT2 next = *definition++; |
| if (next == '-') |
| { |
| next = *definition++; |
| if (next == 0) |
| { |
| ptr->set(ch); |
| ptr->set('-'); |
| break; |
| } |
| ptr->set(ch, next); |
| } |
| else |
| { |
| ptr->set(ch); |
| } |
| ch = next; |
| } |
| } |
| }} |
| template <typename CharT> |
| inline chset<CharT>::chset() |
| : ptr(new basic_chset<CharT>()) {} |
| template <typename CharT> |
| inline chset<CharT>::chset(chset const& arg_) |
| : ptr(new basic_chset<CharT>(*arg_.ptr)) {} |
| template <typename CharT> |
| inline chset<CharT>::chset(CharT arg_) |
| : ptr(new basic_chset<CharT>()) |
| { ptr->set(arg_); } |
| template <typename CharT> |
| inline chset<CharT>::chset(anychar_parser arg_) |
| : ptr(new basic_chset<CharT>()) |
| { |
| ptr->set( |
| std::numeric_limits<CharT>::min(), |
| std::numeric_limits<CharT>::max() |
| ); |
| } |
| template <typename CharT> |
| inline chset<CharT>::chset(nothing_parser arg_) |
| : ptr(new basic_chset<CharT>()) {} |
| template <typename CharT> |
| inline chset<CharT>::chset(chlit<CharT> const& arg_) |
| : ptr(new basic_chset<CharT>()) |
| { ptr->set(arg_.ch); } |
| template <typename CharT> |
| inline chset<CharT>::chset(range<CharT> const& arg_) |
| : ptr(new basic_chset<CharT>()) |
| { ptr->set(arg_.first, arg_.last); } |
| template <typename CharT> |
| inline chset<CharT>::chset(negated_char_parser<chlit<CharT> > const& arg_) |
| : ptr(new basic_chset<CharT>()) |
| { |
| set(arg_); |
| } |
| template <typename CharT> |
| inline chset<CharT>::chset(negated_char_parser<range<CharT> > const& arg_) |
| : ptr(new basic_chset<CharT>()) |
| { |
| set(arg_); |
| } |
| template <typename CharT> |
| inline chset<CharT>::~chset() {} |
| template <typename CharT> |
| inline chset<CharT>& |
| chset<CharT>::operator=(chset const& rhs) |
| { |
| ptr = rhs.ptr; |
| return *this; |
| } |
| template <typename CharT> |
| inline chset<CharT>& |
| chset<CharT>::operator=(CharT rhs) |
| { |
| utility::impl::detach_clear(ptr); |
| ptr->set(rhs); |
| return *this; |
| } |
| template <typename CharT> |
| inline chset<CharT>& |
| chset<CharT>::operator=(anychar_parser rhs) |
| { |
| utility::impl::detach_clear(ptr); |
| ptr->set( |
| std::numeric_limits<CharT>::min(), |
| std::numeric_limits<CharT>::max() |
| ); |
| return *this; |
| } |
| template <typename CharT> |
| inline chset<CharT>& |
| chset<CharT>::operator=(nothing_parser rhs) |
| { |
| utility::impl::detach_clear(ptr); |
| return *this; |
| } |
| template <typename CharT> |
| inline chset<CharT>& |
| chset<CharT>::operator=(chlit<CharT> const& rhs) |
| { |
| utility::impl::detach_clear(ptr); |
| ptr->set(rhs.ch); |
| return *this; |
| } |
| template <typename CharT> |
| inline chset<CharT>& |
| chset<CharT>::operator=(range<CharT> const& rhs) |
| { |
| utility::impl::detach_clear(ptr); |
| ptr->set(rhs.first, rhs.last); |
| return *this; |
| } |
| template <typename CharT> |
| inline chset<CharT>& |
| chset<CharT>::operator=(negated_char_parser<chlit<CharT> > const& rhs) |
| { |
| utility::impl::detach_clear(ptr); |
| set(rhs); |
| return *this; |
| } |
| template <typename CharT> |
| inline chset<CharT>& |
| chset<CharT>::operator=(negated_char_parser<range<CharT> > const& rhs) |
| { |
| utility::impl::detach_clear(ptr); |
| set(rhs); |
| return *this; |
| } |
| template <typename CharT> |
| inline void |
| chset<CharT>::set(range<CharT> const& arg_) |
| { |
| utility::impl::detach(ptr); |
| ptr->set(arg_.first, arg_.last); |
| } |
| template <typename CharT> |
| inline void |
| chset<CharT>::set(negated_char_parser<chlit<CharT> > const& arg_) |
| { |
| utility::impl::detach(ptr); |
| if(arg_.positive.ch != std::numeric_limits<CharT>::min()) { |
| ptr->set(std::numeric_limits<CharT>::min(), arg_.positive.ch - 1); |
| } |
| if(arg_.positive.ch != std::numeric_limits<CharT>::max()) { |
| ptr->set(arg_.positive.ch + 1, std::numeric_limits<CharT>::max()); |
| } |
| } |
| template <typename CharT> |
| inline void |
| chset<CharT>::set(negated_char_parser<range<CharT> > const& arg_) |
| { |
| utility::impl::detach(ptr); |
| if(arg_.positive.first != std::numeric_limits<CharT>::min()) { |
| ptr->set(std::numeric_limits<CharT>::min(), arg_.positive.first - 1); |
| } |
| if(arg_.positive.last != std::numeric_limits<CharT>::max()) { |
| ptr->set(arg_.positive.last + 1, std::numeric_limits<CharT>::max()); |
| } |
| } |
| template <typename CharT> |
| inline void |
| chset<CharT>::clear(range<CharT> const& arg_) |
| { |
| utility::impl::detach(ptr); |
| ptr->clear(arg_.first, arg_.last); |
| } |
| template <typename CharT> |
| inline void |
| chset<CharT>::clear(negated_char_parser<range<CharT> > const& arg_) |
| { |
| utility::impl::detach(ptr); |
| if(arg_.positive.first != std::numeric_limits<CharT>::min()) { |
| ptr->clear(std::numeric_limits<CharT>::min(), arg_.positive.first - 1); |
| } |
| if(arg_.positive.last != std::numeric_limits<CharT>::max()) { |
| ptr->clear(arg_.positive.last + 1, std::numeric_limits<CharT>::max()); |
| } |
| } |
| template <typename CharT> |
| inline bool |
| chset<CharT>::test(CharT ch) const |
| { return ptr->test(ch); } |
| template <typename CharT> |
| inline chset<CharT>& |
| chset<CharT>::inverse() |
| { |
| utility::impl::detach(ptr); |
| ptr->inverse(); |
| return *this; |
| } |
| template <typename CharT> |
| inline void |
| chset<CharT>::swap(chset& x) |
| { ptr.swap(x.ptr); } |
| template <typename CharT> |
| inline chset<CharT>& |
| chset<CharT>::operator|=(chset const& x) |
| { |
| utility::impl::detach(ptr); |
| *ptr |= *x.ptr; |
| return *this; |
| } |
| template <typename CharT> |
| inline chset<CharT>& |
| chset<CharT>::operator&=(chset const& x) |
| { |
| utility::impl::detach(ptr); |
| *ptr &= *x.ptr; |
| return *this; |
| } |
| template <typename CharT> |
| inline chset<CharT>& |
| chset<CharT>::operator-=(chset const& x) |
| { |
| utility::impl::detach(ptr); |
| *ptr -= *x.ptr; |
| return *this; |
| } |
| template <typename CharT> |
| inline chset<CharT>& |
| chset<CharT>::operator^=(chset const& x) |
| { |
| utility::impl::detach(ptr); |
| *ptr ^= *x.ptr; |
| return *this; |
| } |
| }} |
| namespace boost { namespace spirit { |
| const unsigned long c_escapes = 1; |
| const unsigned long lex_escapes = c_escapes << 1; |
| namespace impl { |
| template <unsigned long Flags, typename CharT> |
| struct escape_char_action_parse { |
| template <typename ParserT, typename ScannerT> |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ScannerT const& scan, ParserT const &p) |
| { |
| typedef CharT char_t; |
| typedef typename ScannerT::iterator_t iterator_t; |
| typedef typename parser_result<ParserT, ScannerT>::type result_t; |
| if (scan.first != scan.last) { |
| iterator_t save = scan.first; |
| if (result_t hit = p.subject().parse(scan)) { |
| char_t unescaped; |
| scan.first = save; |
| if (*scan.first == '\\') { |
| ++scan.first; |
| switch (*scan.first) { |
| case 'b': unescaped = '\b'; ++scan.first; break; |
| case 't': unescaped = '\t'; ++scan.first; break; |
| case 'n': unescaped = '\n'; ++scan.first; break; |
| case 'f': unescaped = '\f'; ++scan.first; break; |
| case 'r': unescaped = '\r'; ++scan.first; break; |
| case '"': unescaped = '"'; ++scan.first; break; |
| case '\'': unescaped = '\''; ++scan.first; break; |
| case '\\': unescaped = '\\'; ++scan.first; break; |
| case 'x': case 'X': |
| { |
| char_t hex = 0; |
| char_t const lim = |
| std::numeric_limits<char_t>::max() >> 4; |
| ++scan.first; |
| while (scan.first != scan.last) |
| { |
| char_t c = *scan.first; |
| if (hex > lim && impl::isxdigit_(c)) |
| { |
| scan.first = save; |
| return scan.no_match(); |
| } |
| if (impl::isdigit_(c)) |
| { |
| hex <<= 4; |
| hex |= c - '0'; |
| ++scan.first; |
| } |
| else if (impl::isxdigit_(c)) |
| { |
| hex <<= 4; |
| c = impl::toupper_(c); |
| hex |= c - 'A' + 0xA; |
| ++scan.first; |
| } |
| else |
| { |
| break; |
| } |
| } |
| unescaped = hex; |
| } |
| break; |
| case '0': case '1': case '2': case '3': |
| case '4': case '5': case '6': case '7': |
| { |
| char_t oct = 0; |
| char_t const lim = |
| std::numeric_limits<char_t>::max() >> 3; |
| while (scan.first != scan.last) |
| { |
| char_t c = *scan.first; |
| if (oct > lim && (c >= '0' && c <= '7')) |
| { |
| scan.first = save; |
| return scan.no_match(); |
| } |
| if (c >= '0' && c <= '7') |
| { |
| oct <<= 3; |
| oct |= c - '0'; |
| ++scan.first; |
| } |
| else |
| { |
| break; |
| } |
| } |
| unescaped = oct; |
| } |
| break; |
| default: |
| if (Flags & c_escapes) |
| { |
| scan.first = save; |
| return scan.no_match(); |
| } |
| else |
| { |
| unescaped = *scan.first; |
| ++scan.first; |
| } |
| break; |
| } |
| } |
| else { |
| unescaped = *scan.first; |
| ++scan.first; |
| } |
| scan.do_action(p.predicate(), unescaped, save, scan.first); |
| return hit; |
| } |
| } |
| return scan.no_match(); |
| } |
| }; |
| template <typename CharT> |
| struct escape_char_parse { |
| template <typename ScannerT, typename ParserT> |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ScannerT const &scan, ParserT const & ) |
| { |
| typedef |
| uint_parser<CharT, 8, 1, |
| std::numeric_limits<CharT>::digits / 3 + 1 |
| > |
| oct_parser_t; |
| typedef |
| uint_parser<CharT, 16, 1, |
| std::numeric_limits<CharT>::digits / 4 + 1 |
| > |
| hex_parser_t; |
| typedef alternative<difference<anychar_parser, chlit<CharT> >, |
| sequence<chlit<CharT>, alternative<alternative<oct_parser_t, |
| sequence<inhibit_case<chlit<CharT> >, hex_parser_t > >, |
| difference<difference<anychar_parser, |
| inhibit_case<chlit<CharT> > >, oct_parser_t > > > > |
| parser_t; |
| static parser_t p = |
| ( (anychar_p - CharT('\\')) |
| | (CharT('\\') >> |
| ( oct_parser_t() |
| | as_lower_d[CharT('x')] >> hex_parser_t() |
| | (anychar_p - as_lower_d[CharT('x')] - oct_parser_t()) |
| ) |
| )); |
| ; |
| return p.parse(scan); |
| } |
| }; |
| } |
| }} |
| namespace boost { namespace spirit { |
| template < |
| typename ParserT, typename ActionT, |
| unsigned long Flags, typename CharT |
| > |
| struct escape_char_action |
| : public unary<ParserT, |
| parser<escape_char_action<ParserT, ActionT, Flags, CharT> > > |
| { |
| typedef escape_char_action |
| <ParserT, ActionT, Flags, CharT> self_t; |
| typedef action_parser_category parser_category_t; |
| typedef unary<ParserT, parser<self_t> > base_t; |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename match_result<ScannerT, CharT>::type type; |
| }; |
| escape_char_action(ParserT const& p, ActionT const& a) |
| : base_t(p), actor(a) {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| return impl::escape_char_action_parse<Flags, CharT>:: |
| parse(scan, *this); |
| } |
| ActionT const& predicate() const { return actor; } |
| private: |
| ActionT actor; |
| }; |
| template <unsigned long Flags, typename CharT> |
| struct escape_char_action_parser_gen; |
| template <unsigned long Flags, typename CharT = char> |
| struct escape_char_parser : |
| public parser<escape_char_parser<Flags, CharT> > { |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( Flags == c_escapes || Flags == lex_escapes ) >)> boost_static_assert_typedef_118; |
| typedef escape_char_parser<Flags, CharT> self_t; |
| typedef |
| escape_char_action_parser_gen<Flags, CharT> |
| action_parser_generator_t; |
| template <typename ScannerT> |
| struct result { |
| typedef typename match_result<ScannerT, CharT>::type type; |
| }; |
| template <typename ActionT> |
| escape_char_action<self_t, ActionT, Flags, CharT> |
| operator[](ActionT const& actor) const |
| { |
| return escape_char_action<self_t, ActionT, Flags, CharT>(*this, actor); |
| } |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const &scan) const |
| { |
| return impl::escape_char_parse<CharT>::parse(scan, *this); |
| } |
| }; |
| template <unsigned long Flags, typename CharT> |
| struct escape_char_action_parser_gen { |
| template <typename ParserT, typename ActionT> |
| static escape_char_action<ParserT, ActionT, Flags, CharT> |
| generate (ParserT const &p, ActionT const &actor) |
| { |
| typedef |
| escape_char_action<ParserT, ActionT, Flags, CharT> |
| action_parser_t; |
| return action_parser_t(p, actor); |
| } |
| }; |
| const escape_char_parser<lex_escapes> lex_escape_ch_p = |
| escape_char_parser<lex_escapes>(); |
| const escape_char_parser<c_escapes> c_escape_ch_p = |
| escape_char_parser<c_escapes>(); |
| }} |
| namespace boost { namespace spirit { |
| template < class FunctorT > |
| struct functor_parser : public parser<functor_parser<FunctorT> > |
| { |
| FunctorT functor; |
| functor_parser(): functor() {} |
| functor_parser(FunctorT const& functor_): functor(functor_) {} |
| typedef typename FunctorT::result_t functor_result_t; |
| typedef functor_parser<FunctorT> self_t; |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename match_result<ScannerT, functor_result_t>::type |
| type; |
| }; |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| typedef typename parser_result<self_t, ScannerT>::type result_t; |
| typedef typename ScannerT::value_t value_t; |
| typedef typename ScannerT::iterator_t iterator_t; |
| iterator_t const s(scan.first); |
| functor_result_t result; |
| std::ptrdiff_t len = functor(scan, result); |
| if (len < 0) |
| return scan.no_match(); |
| else |
| return scan.create_match(std::size_t(len), result, s, scan.first); |
| } |
| }; |
| }} |
| namespace boost { namespace spirit { |
| template <typename ParserT, typename ExactT> |
| class fixed_loop |
| : public unary<ParserT, parser <fixed_loop <ParserT, ExactT> > > |
| { |
| public: |
| typedef fixed_loop<ParserT, ExactT> self_t; |
| typedef unary<ParserT, parser<self_t> > base_t; |
| fixed_loop (ParserT const & subject, ExactT const & exact) |
| : base_t(subject), m_exact(exact) {} |
| template <typename ScannerT> |
| typename parser_result <self_t, ScannerT>::type |
| parse (ScannerT const & scan) const |
| { |
| typename parser_result<self_t, ScannerT>::type hit(0); |
| std::size_t n = m_exact; |
| for (std::size_t i = 0; i < n; ++i) |
| { |
| typename parser_result<self_t, ScannerT>::type next |
| = this->subject().parse(scan); |
| if (!next) |
| return scan.no_match(); |
| hit.concat(next); |
| } |
| return hit; |
| } |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename match_result<ScannerT, nil_t>::type type; |
| }; |
| private: |
| ExactT m_exact; |
| }; |
| template <typename ParserT, typename MinT, typename MaxT> |
| class finite_loop |
| : public unary<ParserT, parser<finite_loop<ParserT, MinT, MaxT> > > |
| { |
| public: |
| typedef finite_loop <ParserT, MinT, MaxT> self_t; |
| typedef unary<ParserT, parser<self_t> > base_t; |
| finite_loop (ParserT const & subject, MinT const & min, MaxT const & max) |
| : base_t(subject), m_min(min), m_max(max) {} |
| template <typename ScannerT> |
| typename parser_result <self_t, ScannerT>::type |
| parse(ScannerT const & scan) const |
| { |
| ; |
| typename parser_result<self_t, ScannerT>::type hit(0); |
| std::size_t n1 = m_min; |
| std::size_t n2 = m_max; |
| for (std::size_t i = 0; i < n2; ++i) |
| { |
| typename ScannerT::iterator_t save = scan.first; |
| typename parser_result<self_t, ScannerT>::type next |
| = this->subject().parse(scan); |
| if (!next) |
| { |
| if (i >= n1) |
| { |
| scan.first = save; |
| break; |
| } |
| else |
| { |
| return scan.no_match(); |
| } |
| } |
| hit.concat(next); |
| } |
| return hit; |
| } |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename match_result<ScannerT, nil_t>::type type; |
| }; |
| private: |
| MinT m_min; |
| MaxT m_max; |
| }; |
| struct more_t {}; |
| more_t const more = more_t (); |
| template <typename ParserT, typename MinT> |
| class infinite_loop |
| : public unary<ParserT, parser<infinite_loop<ParserT, MinT> > > |
| { |
| public: |
| typedef infinite_loop <ParserT, MinT> self_t; |
| typedef unary<ParserT, parser<self_t> > base_t; |
| infinite_loop ( |
| ParserT const& subject, |
| MinT const& min, |
| more_t const& |
| ) |
| : base_t(subject), m_min(min) {} |
| template <typename ScannerT> |
| typename parser_result <self_t, ScannerT>::type |
| parse(ScannerT const & scan) const |
| { |
| typename parser_result<self_t, ScannerT>::type hit(0); |
| std::size_t n = m_min; |
| for (std::size_t i = 0; ; ++i) |
| { |
| typename ScannerT::iterator_t save = scan.first; |
| typename parser_result<self_t, ScannerT>::type next |
| = this->subject().parse(scan); |
| if (!next) |
| { |
| if (i >= n) |
| { |
| scan.first = save; |
| break; |
| } |
| else |
| { |
| return scan.no_match(); |
| } |
| } |
| hit.concat(next); |
| } |
| return hit; |
| } |
| template <typename ScannerT> |
| struct result |
| { |
| typedef typename match_result<ScannerT, nil_t>::type type; |
| }; |
| private: |
| MinT m_min; |
| }; |
| template <typename ExactT> |
| struct fixed_loop_gen |
| { |
| fixed_loop_gen (ExactT const & exact) |
| : m_exact (exact) {} |
| template <typename ParserT> |
| fixed_loop <ParserT, ExactT> |
| operator[](parser <ParserT> const & subject) const |
| { |
| return fixed_loop <ParserT, ExactT> (subject.derived (), m_exact); |
| } |
| ExactT m_exact; |
| }; |
| namespace impl { |
| template <typename ParserT, typename MinT, typename MaxT> |
| struct loop_traits |
| { |
| typedef typename mpl::if_< |
| boost::is_same<MaxT, more_t>, |
| infinite_loop<ParserT, MinT>, |
| finite_loop<ParserT, MinT, MaxT> |
| >::type type; |
| }; |
| } |
| template <typename MinT, typename MaxT> |
| struct nonfixed_loop_gen |
| { |
| nonfixed_loop_gen (MinT min, MaxT max) |
| : m_min (min), m_max (max) {} |
| template <typename ParserT> |
| typename impl::loop_traits<ParserT, MinT, MaxT>::type |
| operator[](parser <ParserT> const & subject) const |
| { |
| typedef typename impl::loop_traits<ParserT, MinT, MaxT>::type ret_t; |
| return ret_t( |
| subject.derived(), |
| m_min, |
| m_max); |
| } |
| MinT m_min; |
| MaxT m_max; |
| }; |
| template <typename ExactT> |
| fixed_loop_gen <ExactT> |
| repeat_p(ExactT const & exact) |
| { |
| return fixed_loop_gen <ExactT> (exact); |
| } |
| template <typename MinT, typename MaxT> |
| nonfixed_loop_gen <MinT, MaxT> |
| repeat_p(MinT const & min, MaxT const & max) |
| { |
| return nonfixed_loop_gen <MinT, MaxT> (min, max); |
| } |
| }} |
| namespace boost { namespace spirit { |
| struct non_nested_refactoring { typedef non_nested_refactoring embed_t; }; |
| struct self_nested_refactoring { typedef self_nested_refactoring embed_t; }; |
| namespace impl { |
| template <typename CategoryT> |
| struct refactor_unary_nested { |
| template < |
| typename ParserT, typename NestedT, |
| typename ScannerT, typename BinaryT |
| > |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const &, ScannerT const& scan, BinaryT const& binary, |
| NestedT const& ) |
| { |
| return binary.parse(scan); |
| } |
| }; |
| template <> |
| struct refactor_unary_nested<unary_parser_category> { |
| template < |
| typename ParserT, typename ScannerT, typename BinaryT, |
| typename NestedT |
| > |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const &, ScannerT const& scan, BinaryT const& binary, |
| NestedT const& nested_d) |
| { |
| typedef typename BinaryT::parser_generator_t op_t; |
| typedef |
| typename BinaryT::left_t::parser_generator_t |
| unary_t; |
| return |
| unary_t::generate( |
| nested_d[ |
| op_t::generate(binary.left().subject(), binary.right()) |
| ] |
| ).parse(scan); |
| } |
| }; |
| template <typename CategoryT> |
| struct refactor_unary_non_nested { |
| template <typename ParserT, typename ScannerT, typename BinaryT> |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const &, ScannerT const& scan, BinaryT const& binary) |
| { |
| return binary.parse(scan); |
| } |
| }; |
| template <> |
| struct refactor_unary_non_nested<unary_parser_category> { |
| template <typename ParserT, typename ScannerT, typename BinaryT> |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const &, ScannerT const& scan, BinaryT const& binary) |
| { |
| typedef typename BinaryT::parser_generator_t op_t; |
| typedef |
| typename BinaryT::left_t::parser_generator_t |
| unary_t; |
| return unary_t::generate( |
| op_t::generate(binary.left().subject(), binary.right()) |
| ).parse(scan); |
| } |
| }; |
| template <typename NestedT> |
| struct refactor_unary_type { |
| template <typename ParserT, typename ScannerT, typename BinaryT> |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const &p, ScannerT const& scan, BinaryT const& binary, |
| NestedT const& nested_d) |
| { |
| typedef |
| typename BinaryT::left_t::parser_category_t |
| parser_category_t; |
| return refactor_unary_nested<parser_category_t>:: |
| parse(p, scan, binary, nested_d); |
| } |
| }; |
| template <> |
| struct refactor_unary_type<non_nested_refactoring> { |
| template <typename ParserT, typename ScannerT, typename BinaryT> |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const &p, ScannerT const& scan, BinaryT const& binary, |
| non_nested_refactoring const&) |
| { |
| typedef |
| typename BinaryT::left_t::parser_category_t |
| parser_category_t; |
| return refactor_unary_non_nested<parser_category_t>:: |
| parse(p, scan, binary); |
| } |
| }; |
| template <> |
| struct refactor_unary_type<self_nested_refactoring> { |
| template <typename ParserT, typename ScannerT, typename BinaryT> |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const &p, ScannerT const& scan, BinaryT const& binary, |
| self_nested_refactoring const &nested_tag) |
| { |
| typedef |
| typename BinaryT::left_t::parser_category_t |
| parser_category_t; |
| typedef typename ParserT::parser_generator_t parser_generator_t; |
| parser_generator_t nested_d(nested_tag); |
| return refactor_unary_nested<parser_category_t>:: |
| parse(p, scan, binary, nested_d); |
| } |
| }; |
| template <typename CategoryT> |
| struct refactor_action_nested { |
| template < |
| typename ParserT, typename ScannerT, typename BinaryT, |
| typename NestedT |
| > |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const &, ScannerT const& scan, BinaryT const& binary, |
| NestedT const& nested_d) |
| { |
| return nested_d[binary].parse(scan); |
| } |
| }; |
| template <> |
| struct refactor_action_nested<action_parser_category> { |
| template < |
| typename ParserT, typename ScannerT, typename BinaryT, |
| typename NestedT |
| > |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const &, ScannerT const& scan, BinaryT const& binary, |
| NestedT const& nested_d) |
| { |
| typedef typename BinaryT::parser_generator_t binary_gen_t; |
| return ( |
| nested_d[ |
| binary_gen_t::generate( |
| binary.left().subject(), |
| binary.right() |
| ) |
| ][binary.left().predicate()] |
| ).parse(scan); |
| } |
| }; |
| template <typename CategoryT> |
| struct refactor_action_non_nested { |
| template <typename ParserT, typename ScannerT, typename BinaryT> |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const &, ScannerT const& scan, BinaryT const& binary) |
| { |
| return binary.parse(scan); |
| } |
| }; |
| template <> |
| struct refactor_action_non_nested<action_parser_category> { |
| template <typename ParserT, typename ScannerT, typename BinaryT> |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const &, ScannerT const& scan, BinaryT const& binary) |
| { |
| typedef typename BinaryT::parser_generator_t binary_gen_t; |
| return ( |
| binary_gen_t::generate( |
| binary.left().subject(), |
| binary.right() |
| )[binary.left().predicate()] |
| ).parse(scan); |
| } |
| }; |
| template <typename NestedT> |
| struct refactor_action_type { |
| template <typename ParserT, typename ScannerT, typename BinaryT> |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const &p, ScannerT const& scan, BinaryT const& binary, |
| NestedT const& nested_d) |
| { |
| typedef |
| typename BinaryT::left_t::parser_category_t |
| parser_category_t; |
| return refactor_action_nested<parser_category_t>:: |
| parse(p, scan, binary, nested_d); |
| } |
| }; |
| template <> |
| struct refactor_action_type<non_nested_refactoring> { |
| template <typename ParserT, typename ScannerT, typename BinaryT> |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const &p, ScannerT const& scan, BinaryT const& binary, |
| non_nested_refactoring const&) |
| { |
| typedef |
| typename BinaryT::left_t::parser_category_t |
| parser_category_t; |
| return refactor_action_non_nested<parser_category_t>:: |
| parse(p, scan, binary); |
| } |
| }; |
| template <> |
| struct refactor_action_type<self_nested_refactoring> { |
| template <typename ParserT, typename ScannerT, typename BinaryT> |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const &p, ScannerT const& scan, BinaryT const& binary, |
| self_nested_refactoring const &nested_tag) |
| { |
| typedef typename ParserT::parser_generator_t parser_generator_t; |
| typedef |
| typename BinaryT::left_t::parser_category_t |
| parser_category_t; |
| parser_generator_t nested_d(nested_tag); |
| return refactor_action_nested<parser_category_t>:: |
| parse(p, scan, binary, nested_d); |
| } |
| }; |
| template <typename CategoryT> |
| struct attach_action_nested { |
| template < |
| typename ParserT, typename ScannerT, typename ActionT, |
| typename NestedT |
| > |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const &, ScannerT const& scan, ActionT const &action, |
| NestedT const& nested_d) |
| { |
| return action.parse(scan); |
| } |
| }; |
| template <> |
| struct attach_action_nested<binary_parser_category> { |
| template < |
| typename ParserT, typename ScannerT, typename ActionT, |
| typename NestedT |
| > |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const &, ScannerT const& scan, ActionT const &action, |
| NestedT const& nested_d) |
| { |
| typedef |
| typename ActionT::subject_t::parser_generator_t |
| binary_gen_t; |
| return ( |
| binary_gen_t::generate( |
| nested_d[action.subject().left()[action.predicate()]], |
| nested_d[action.subject().right()[action.predicate()]] |
| ) |
| ).parse(scan); |
| } |
| }; |
| template <typename CategoryT> |
| struct attach_action_non_nested { |
| template <typename ParserT, typename ScannerT, typename ActionT> |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const &, ScannerT const& scan, ActionT const &action) |
| { |
| return action.parse(scan); |
| } |
| }; |
| template <> |
| struct attach_action_non_nested<binary_parser_category> { |
| template <typename ParserT, typename ScannerT, typename ActionT> |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const &, ScannerT const& scan, ActionT const &action) |
| { |
| typedef |
| typename ActionT::subject_t::parser_generator_t |
| binary_gen_t; |
| return ( |
| binary_gen_t::generate( |
| action.subject().left()[action.predicate()], |
| action.subject().right()[action.predicate()] |
| ) |
| ).parse(scan); |
| } |
| }; |
| template <typename NestedT> |
| struct attach_action_type { |
| template <typename ParserT, typename ScannerT, typename ActionT> |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const &p, ScannerT const& scan, ActionT const& action, |
| NestedT const& nested_d) |
| { |
| typedef |
| typename ActionT::subject_t::parser_category_t |
| parser_category_t; |
| return attach_action_nested<parser_category_t>:: |
| parse(p, scan, action, nested_d); |
| } |
| }; |
| template <> |
| struct attach_action_type<non_nested_refactoring> { |
| template <typename ParserT, typename ScannerT, typename ActionT> |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const &p, ScannerT const& scan, ActionT const &action, |
| non_nested_refactoring const&) |
| { |
| typedef |
| typename ActionT::subject_t::parser_category_t |
| parser_category_t; |
| return attach_action_non_nested<parser_category_t>:: |
| parse(p, scan, action); |
| } |
| }; |
| template <> |
| struct attach_action_type<self_nested_refactoring> { |
| template <typename ParserT, typename ScannerT, typename ActionT> |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const &p, ScannerT const& scan, ActionT const &action, |
| self_nested_refactoring const& nested_tag) |
| { |
| typedef typename ParserT::parser_generator_t parser_generator_t; |
| typedef |
| typename ActionT::subject_t::parser_category_t |
| parser_category_t; |
| parser_generator_t nested_d(nested_tag); |
| return attach_action_nested<parser_category_t>:: |
| parse(p, scan, action, nested_d); |
| } |
| }; |
| } |
| }} |
| namespace boost { namespace spirit { |
| template <typename NestedT = non_nested_refactoring> |
| class refactor_unary_gen; |
| template <typename BinaryT, typename NestedT = non_nested_refactoring> |
| class refactor_unary_parser : |
| public parser<refactor_unary_parser<BinaryT, NestedT> > { |
| public: |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( ( boost::is_convertible<typename BinaryT::parser_category_t, binary_parser_category>::value ) ) >)> boost_static_assert_typedef_59; |
| refactor_unary_parser(BinaryT const& binary_, NestedT const& nested_) |
| : binary(binary_), nested(nested_) {} |
| typedef refactor_unary_parser<BinaryT, NestedT> self_t; |
| typedef refactor_unary_gen<NestedT> parser_generator_t; |
| typedef typename BinaryT::left_t::parser_category_t parser_category_t; |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| return impl::refactor_unary_type<NestedT>:: |
| parse(*this, scan, binary, nested); |
| } |
| private: |
| typename as_parser<BinaryT>::type::embed_t binary; |
| typename NestedT::embed_t nested; |
| }; |
| template <typename NestedT> |
| class refactor_unary_gen { |
| public: |
| typedef refactor_unary_gen<NestedT> embed_t; |
| refactor_unary_gen(NestedT const& nested_ = non_nested_refactoring()) |
| : nested(nested_) {} |
| template <typename ParserT> |
| refactor_unary_parser<ParserT, NestedT> |
| operator[](parser<ParserT> const& subject) const |
| { |
| return refactor_unary_parser<ParserT, NestedT> |
| (subject.derived(), nested); |
| } |
| private: |
| typename NestedT::embed_t nested; |
| }; |
| const refactor_unary_gen<> refactor_unary_d = refactor_unary_gen<>(); |
| template <typename NestedT = non_nested_refactoring> |
| class refactor_action_gen; |
| template <typename BinaryT, typename NestedT = non_nested_refactoring> |
| class refactor_action_parser : |
| public parser<refactor_action_parser<BinaryT, NestedT> > { |
| public: |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( ( boost::is_convertible<typename BinaryT::parser_category_t, binary_parser_category>::value ) ) >)> boost_static_assert_typedef_142; |
| refactor_action_parser(BinaryT const& binary_, NestedT const& nested_) |
| : binary(binary_), nested(nested_) {} |
| typedef refactor_action_parser<BinaryT, NestedT> self_t; |
| typedef refactor_action_gen<NestedT> parser_generator_t; |
| typedef typename BinaryT::left_t::parser_category_t parser_category_t; |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| return impl::refactor_action_type<NestedT>:: |
| parse(*this, scan, binary, nested); |
| } |
| private: |
| typename as_parser<BinaryT>::type::embed_t binary; |
| typename NestedT::embed_t nested; |
| }; |
| template <typename NestedT> |
| class refactor_action_gen { |
| public: |
| typedef refactor_action_gen<NestedT> embed_t; |
| refactor_action_gen(NestedT const& nested_ = non_nested_refactoring()) |
| : nested(nested_) {} |
| template <typename ParserT> |
| refactor_action_parser<ParserT, NestedT> |
| operator[](parser<ParserT> const& subject) const |
| { |
| return refactor_action_parser<ParserT, NestedT> |
| (subject.derived(), nested); |
| } |
| private: |
| typename NestedT::embed_t nested; |
| }; |
| const refactor_action_gen<> refactor_action_d = refactor_action_gen<>(); |
| template <typename NestedT = non_nested_refactoring> |
| class attach_action_gen; |
| template <typename ActionT, typename NestedT = non_nested_refactoring> |
| class attach_action_parser : |
| public parser<attach_action_parser<ActionT, NestedT> > { |
| public: |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( ( boost::is_convertible<typename ActionT::parser_category_t, action_parser_category>::value ) ) >)> boost_static_assert_typedef_224; |
| attach_action_parser(ActionT const& actor_, NestedT const& nested_) |
| : actor(actor_), nested(nested_) {} |
| typedef attach_action_parser<ActionT, NestedT> self_t; |
| typedef attach_action_gen<NestedT> parser_generator_t; |
| typedef typename ActionT::parser_category_t parser_category_t; |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| return impl::attach_action_type<NestedT>:: |
| parse(*this, scan, actor, nested); |
| } |
| private: |
| typename as_parser<ActionT>::type::embed_t actor; |
| typename NestedT::embed_t nested; |
| }; |
| template <typename NestedT> |
| class attach_action_gen { |
| public: |
| typedef attach_action_gen<NestedT> embed_t; |
| attach_action_gen(NestedT const& nested_ = non_nested_refactoring()) |
| : nested(nested_) {} |
| template <typename ParserT, typename ActionT> |
| attach_action_parser<action<ParserT, ActionT>, NestedT> |
| operator[](action<ParserT, ActionT> const& actor) const |
| { |
| return attach_action_parser<action<ParserT, ActionT>, NestedT> |
| (actor, nested); |
| } |
| private: |
| typename NestedT::embed_t nested; |
| }; |
| const attach_action_gen<> attach_action_d = attach_action_gen<>(); |
| }} |
| namespace boost { namespace spirit { |
| struct is_nested {}; |
| struct non_nested {}; |
| struct is_lexeme {}; |
| struct non_lexeme {}; |
| namespace impl { |
| template <typename LexemeT> |
| struct select_confix_parse_lexeme; |
| template <> |
| struct select_confix_parse_lexeme<is_lexeme> { |
| template <typename ParserT, typename ScannerT> |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const& p, ScannerT const& scan) |
| { |
| typedef typename parser_result<ParserT, ScannerT>::type result_t; |
| return contiguous_parser_parse<result_t>(p, scan, scan); |
| } |
| }; |
| template <> |
| struct select_confix_parse_lexeme<non_lexeme> { |
| template <typename ParserT, typename ScannerT> |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ParserT const& p, ScannerT const& scan) |
| { |
| return p.parse(scan); |
| } |
| }; |
| template <typename NestedT> |
| struct select_confix_parse_refactor; |
| template <> |
| struct select_confix_parse_refactor<is_nested> { |
| template < |
| typename LexemeT, typename ParserT, typename ScannerT, |
| typename OpenT, typename ExprT, typename CloseT |
| > |
| static typename parser_result<ParserT, ScannerT>::type |
| parse( |
| LexemeT const &, ParserT const& this_, ScannerT const& scan, |
| OpenT const& open, ExprT const& expr, CloseT const& close) |
| { |
| typedef refactor_action_gen<refactor_unary_gen<> > refactor_t; |
| const refactor_t refactor_body_d = refactor_t(refactor_unary_d); |
| return select_confix_parse_lexeme<LexemeT>::parse(( |
| open |
| >> (this_ | refactor_body_d[expr - close]) |
| >> close |
| ), scan); |
| } |
| }; |
| template <> |
| struct select_confix_parse_refactor<non_nested> { |
| template < |
| typename LexemeT, typename ParserT, typename ScannerT, |
| typename OpenT, typename ExprT, typename CloseT |
| > |
| static typename parser_result<ParserT, ScannerT>::type |
| parse( |
| LexemeT const &, ParserT const& , ScannerT const& scan, |
| OpenT const& open, ExprT const& expr, CloseT const& close) |
| { |
| typedef refactor_action_gen<refactor_unary_gen<> > refactor_t; |
| const refactor_t refactor_body_d = refactor_t(refactor_unary_d); |
| return select_confix_parse_lexeme<LexemeT>::parse(( |
| open |
| >> refactor_body_d[expr - close] |
| >> close |
| ), scan); |
| } |
| }; |
| template <typename NestedT> |
| struct select_confix_parse_no_refactor; |
| template <> |
| struct select_confix_parse_no_refactor<is_nested> { |
| template < |
| typename LexemeT, typename ParserT, typename ScannerT, |
| typename OpenT, typename ExprT, typename CloseT |
| > |
| static typename parser_result<ParserT, ScannerT>::type |
| parse( |
| LexemeT const &, ParserT const& this_, ScannerT const& scan, |
| OpenT const& open, ExprT const& expr, CloseT const& close) |
| { |
| return select_confix_parse_lexeme<LexemeT>::parse(( |
| open |
| >> (this_ | (expr - close)) |
| >> close |
| ), scan); |
| } |
| }; |
| template <> |
| struct select_confix_parse_no_refactor<non_nested> { |
| template < |
| typename LexemeT, typename ParserT, typename ScannerT, |
| typename OpenT, typename ExprT, typename CloseT |
| > |
| static typename parser_result<ParserT, ScannerT>::type |
| parse( |
| LexemeT const &, ParserT const & , ScannerT const& scan, |
| OpenT const& open, ExprT const& expr, CloseT const& close) |
| { |
| return select_confix_parse_lexeme<LexemeT>::parse(( |
| open |
| >> (expr - close) |
| >> close |
| ), scan); |
| } |
| }; |
| template <typename CategoryT> |
| struct confix_parser_type { |
| template < |
| typename NestedT, typename LexemeT, |
| typename ParserT, typename ScannerT, |
| typename OpenT, typename ExprT, typename CloseT |
| > |
| static typename parser_result<ParserT, ScannerT>::type |
| parse( |
| NestedT const &, LexemeT const &lexeme, |
| ParserT const& this_, ScannerT const& scan, |
| OpenT const& open, ExprT const& expr, CloseT const& close) |
| { |
| return select_confix_parse_refactor<NestedT>:: |
| parse(lexeme, this_, scan, open, expr, close); |
| } |
| }; |
| template <> |
| struct confix_parser_type<plain_parser_category> { |
| template < |
| typename NestedT, typename LexemeT, |
| typename ParserT, typename ScannerT, |
| typename OpenT, typename ExprT, typename CloseT |
| > |
| static typename parser_result<ParserT, ScannerT>::type |
| parse( |
| NestedT const &, LexemeT const &lexeme, |
| ParserT const& this_, ScannerT const& scan, |
| OpenT const& open, ExprT const& expr, CloseT const& close) |
| { |
| return select_confix_parse_no_refactor<NestedT>:: |
| parse(lexeme, this_, scan, open, expr, close); |
| } |
| }; |
| } |
| }} |
| namespace boost { namespace spirit { |
| template<typename NestedT = non_nested, typename LexemeT = non_lexeme> |
| struct confix_parser_gen; |
| template < |
| typename OpenT, typename ExprT, typename CloseT, typename CategoryT, |
| typename NestedT = non_nested, typename LexemeT = non_lexeme |
| > |
| struct confix_parser : |
| public parser< |
| confix_parser<OpenT, ExprT, CloseT, CategoryT, NestedT, LexemeT> |
| > |
| { |
| typedef |
| confix_parser<OpenT, ExprT, CloseT, CategoryT, NestedT, LexemeT> |
| self_t; |
| confix_parser(OpenT const &open_, ExprT const &expr_, CloseT const &close_) |
| : open(open_), expr(expr_), close(close_) |
| {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| return impl::confix_parser_type<CategoryT>:: |
| parse(NestedT(), LexemeT(), *this, scan, open, expr, close); |
| } |
| private: |
| typename as_parser<OpenT>::type::embed_t open; |
| typename as_parser<ExprT>::type::embed_t expr; |
| typename as_parser<CloseT>::type::embed_t close; |
| }; |
| template<typename NestedT, typename LexemeT> |
| struct confix_parser_gen |
| { |
| template<typename StartT, typename ExprT, typename EndT> |
| confix_parser< |
| typename as_parser<StartT>::type, |
| typename as_parser<ExprT>::type, |
| typename as_parser<EndT>::type, |
| typename as_parser<ExprT>::type::parser_category_t, |
| NestedT, |
| LexemeT |
| > |
| operator()( |
| StartT const &start_, ExprT const &expr_, EndT const &end_) const |
| { |
| typedef typename as_parser<StartT>::type start_t; |
| typedef typename as_parser<ExprT>::type expr_t; |
| typedef typename as_parser<EndT>::type end_t; |
| typedef |
| typename as_parser<ExprT>::type::parser_category_t |
| parser_category_t; |
| typedef |
| confix_parser< |
| start_t, expr_t, end_t, parser_category_t, NestedT, LexemeT |
| > |
| return_t; |
| return return_t( |
| as_parser<StartT>::convert(start_), |
| as_parser<ExprT>::convert(expr_), |
| as_parser<EndT>::convert(end_) |
| ); |
| } |
| template<typename StartT, typename ExprT, typename EndT> |
| confix_parser< |
| typename as_parser<StartT>::type, |
| typename as_parser<ExprT>::type, |
| typename as_parser<EndT>::type, |
| plain_parser_category, |
| NestedT, |
| LexemeT |
| > |
| direct(StartT const &start_, ExprT const &expr_, EndT const &end_) const |
| { |
| typedef typename as_parser<StartT>::type start_t; |
| typedef typename as_parser<ExprT>::type expr_t; |
| typedef typename as_parser<EndT>::type end_t; |
| typedef plain_parser_category parser_category_t; |
| typedef |
| confix_parser< |
| start_t, expr_t, end_t, parser_category_t, NestedT, LexemeT |
| > |
| return_t; |
| return return_t( |
| as_parser<StartT>::convert(start_), |
| as_parser<ExprT>::convert(expr_), |
| as_parser<EndT>::convert(end_) |
| ); |
| } |
| }; |
| const confix_parser_gen<non_nested, non_lexeme> confix_p = |
| confix_parser_gen<non_nested, non_lexeme>(); |
| template<typename NestedT> |
| struct comment_parser_gen |
| { |
| template<typename StartT> |
| confix_parser< |
| typename as_parser<StartT>::type, |
| kleene_star<anychar_parser>, |
| alternative<eol_parser, end_parser>, |
| unary_parser_category, |
| NestedT, |
| is_lexeme |
| > |
| operator() (StartT const &start_) const |
| { |
| typedef typename as_parser<StartT>::type start_t; |
| typedef kleene_star<anychar_parser> expr_t; |
| typedef alternative<eol_parser, end_parser> end_t; |
| typedef unary_parser_category parser_category_t; |
| typedef |
| confix_parser< |
| start_t, expr_t, end_t, parser_category_t, NestedT, is_lexeme |
| > |
| return_t; |
| return return_t( |
| as_parser<StartT>::convert(start_), |
| *anychar_p, |
| eol_p | end_p |
| ); |
| } |
| template<typename StartT, typename EndT> |
| confix_parser< |
| typename as_parser<StartT>::type, |
| kleene_star<anychar_parser>, |
| typename as_parser<EndT>::type, |
| unary_parser_category, |
| NestedT, |
| is_lexeme |
| > |
| operator() (StartT const &start_, EndT const &end_) const |
| { |
| typedef typename as_parser<StartT>::type start_t; |
| typedef kleene_star<anychar_parser> expr_t; |
| typedef typename as_parser<EndT>::type end_t; |
| typedef unary_parser_category parser_category_t; |
| typedef |
| confix_parser< |
| start_t, expr_t, end_t, parser_category_t, NestedT, is_lexeme |
| > |
| return_t; |
| return return_t( |
| as_parser<StartT>::convert(start_), |
| *anychar_p, |
| as_parser<EndT>::convert(end_) |
| ); |
| } |
| }; |
| const comment_parser_gen<non_nested> comment_p = |
| comment_parser_gen<non_nested>(); |
| template<typename OpenT, typename CloseT> |
| struct comment_nest_parser: |
| public parser<comment_nest_parser<OpenT, CloseT> > |
| { |
| typedef comment_nest_parser<OpenT, CloseT> self_t; |
| comment_nest_parser(OpenT const &open_, CloseT const &close_): |
| open(open_), close(close_) |
| {} |
| template<typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const &scan) const |
| { |
| return do_parse( |
| open >> *(*this | (anychar_p - close)) >> close, |
| scan); |
| } |
| private: |
| template<typename ParserT, typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| do_parse(ParserT const &p, ScannerT const &scan) const |
| { |
| return |
| impl::contiguous_parser_parse< |
| typename parser_result<ParserT, ScannerT>::type |
| >(p, scan, scan); |
| } |
| typename as_parser<OpenT>::type::embed_t open; |
| typename as_parser<CloseT>::type::embed_t close; |
| }; |
| template<typename OpenT, typename CloseT> |
| inline |
| comment_nest_parser< |
| typename as_parser<OpenT>::type, |
| typename as_parser<CloseT>::type |
| > |
| comment_nest_p(OpenT const &open, CloseT const &close) |
| { |
| return |
| comment_nest_parser< |
| typename as_parser<OpenT>::type, |
| typename as_parser<CloseT>::type |
| >( |
| as_parser<OpenT>::convert(open), |
| as_parser<CloseT>::convert(close) |
| ); |
| } |
| }} |
| namespace boost { namespace spirit { |
| struct no_list_endtoken { typedef no_list_endtoken embed_t; }; |
| namespace impl { |
| template <typename EndT> |
| struct select_list_parse_refactor { |
| template < |
| typename ParserT, typename ScannerT, |
| typename ItemT, typename DelimT |
| > |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ScannerT const& scan, ParserT const& , |
| ItemT const &item, DelimT const &delim, EndT const &end) |
| { |
| typedef refactor_action_gen<refactor_unary_gen<> > refactor_t; |
| const refactor_t refactor_item_d = refactor_t(refactor_unary_d); |
| return ( |
| refactor_item_d[item - (end | delim)] |
| >> *(delim >> refactor_item_d[item - (end | delim)]) |
| >> !(delim >> end) |
| ).parse(scan); |
| } |
| }; |
| template <> |
| struct select_list_parse_refactor<no_list_endtoken> { |
| template < |
| typename ParserT, typename ScannerT, |
| typename ItemT, typename DelimT |
| > |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ScannerT const& scan, ParserT const& , |
| ItemT const &item, DelimT const &delim, no_list_endtoken const&) |
| { |
| typedef refactor_action_gen<refactor_unary_gen<> > refactor_t; |
| const refactor_t refactor_item_d = refactor_t(refactor_unary_d); |
| return ( |
| refactor_item_d[item - delim] |
| >> *(delim >> refactor_item_d[item - delim]) |
| ).parse(scan); |
| } |
| }; |
| template <typename EndT> |
| struct select_list_parse_no_refactor { |
| template < |
| typename ParserT, typename ScannerT, |
| typename ItemT, typename DelimT |
| > |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ScannerT const& scan, ParserT const& , |
| ItemT const &item, DelimT const &delim, EndT const &end) |
| { |
| return ( |
| (item - (end | delim)) |
| >> *(delim >> (item - (end | delim))) |
| >> !(delim >> end) |
| ).parse(scan); |
| } |
| }; |
| template <> |
| struct select_list_parse_no_refactor<no_list_endtoken> { |
| template < |
| typename ParserT, typename ScannerT, |
| typename ItemT, typename DelimT |
| > |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ScannerT const& scan, ParserT const& , |
| ItemT const &item, DelimT const &delim, no_list_endtoken const&) |
| { |
| return ( |
| (item - delim) |
| >> *(delim >> (item - delim)) |
| ).parse(scan); |
| } |
| }; |
| template <typename CategoryT> |
| struct list_parser_type { |
| template < |
| typename ParserT, typename ScannerT, |
| typename ItemT, typename DelimT, typename EndT |
| > |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ScannerT const& scan, ParserT const& p, |
| ItemT const &item, DelimT const &delim, EndT const &end) |
| { |
| return select_list_parse_refactor<EndT>:: |
| parse(scan, p, item, delim, end); |
| } |
| }; |
| template <> |
| struct list_parser_type<plain_parser_category> { |
| template < |
| typename ParserT, typename ScannerT, |
| typename ItemT, typename DelimT, typename EndT |
| > |
| static typename parser_result<ParserT, ScannerT>::type |
| parse(ScannerT const& scan, ParserT const& p, |
| ItemT const &item, DelimT const &delim, EndT const &end) |
| { |
| return select_list_parse_no_refactor<EndT>:: |
| parse(scan, p, item, delim, end); |
| } |
| }; |
| } |
| }} |
| namespace boost { namespace spirit { |
| template < |
| typename ItemT, typename DelimT, typename EndT = no_list_endtoken, |
| typename CategoryT = plain_parser_category |
| > |
| struct list_parser : |
| public parser<list_parser<ItemT, DelimT, EndT, CategoryT> > { |
| typedef list_parser<ItemT, DelimT, EndT, CategoryT> self_t; |
| typedef CategoryT parser_category_t; |
| list_parser(ItemT const &item_, DelimT const &delim_, |
| EndT const& end_ = no_list_endtoken()) |
| : item(item_), delim(delim_), end(end_) |
| {} |
| template <typename ScannerT> |
| typename parser_result<self_t, ScannerT>::type |
| parse(ScannerT const& scan) const |
| { |
| return impl::list_parser_type<CategoryT> |
| ::parse(scan, *this, item, delim, end); |
| } |
| private: |
| typename as_parser<ItemT>::type::embed_t item; |
| typename as_parser<DelimT>::type::embed_t delim; |
| typename as_parser<EndT>::type::embed_t end; |
| }; |
| template <typename CharT = char> |
| struct list_parser_gen : |
| public list_parser<kleene_star<anychar_parser>, chlit<CharT> > |
| { |
| typedef list_parser_gen<CharT> self_t; |
| list_parser_gen() |
| : list_parser<kleene_star<anychar_parser>, chlit<CharT> > |
| (*anychar_p, chlit<CharT>(',')) |
| {} |
| template<typename DelimT> |
| list_parser< |
| kleene_star<anychar_parser>, |
| typename as_parser<DelimT>::type, |
| no_list_endtoken, |
| unary_parser_category |
| > |
| operator()(DelimT const &delim_) const |
| { |
| typedef kleene_star<anychar_parser> item_t; |
| typedef typename as_parser<DelimT>::type delim_t; |
| typedef |
| list_parser<item_t, delim_t, no_list_endtoken, unary_parser_category> |
| return_t; |
| return return_t(*anychar_p, as_parser<DelimT>::convert(delim_)); |
| } |
| template<typename ItemT, typename DelimT> |
| list_parser< |
| typename as_parser<ItemT>::type, |
| typename as_parser<DelimT>::type, |
| no_list_endtoken, |
| typename as_parser<ItemT>::type::parser_category_t |
| > |
| operator()(ItemT const &item_, DelimT const &delim_) const |
| { |
| typedef typename as_parser<ItemT>::type item_t; |
| typedef typename as_parser<DelimT>::type delim_t; |
| typedef list_parser<item_t, delim_t, no_list_endtoken, |
| typename item_t::parser_category_t> |
| return_t; |
| return return_t( |
| as_parser<ItemT>::convert(item_), |
| as_parser<DelimT>::convert(delim_) |
| ); |
| } |
| template<typename ItemT, typename DelimT, typename EndT> |
| list_parser< |
| typename as_parser<ItemT>::type, |
| typename as_parser<DelimT>::type, |
| typename as_parser<EndT>::type |
| > |
| operator()( |
| ItemT const &item_, DelimT const &delim_, EndT const &end_) const |
| { |
| typedef typename as_parser<ItemT>::type item_t; |
| typedef typename as_parser<DelimT>::type delim_t; |
| typedef typename as_parser<EndT>::type end_t; |
| typedef list_parser<item_t, delim_t, end_t, |
| typename item_t::parser_category_t> |
| return_t; |
| return return_t( |
| as_parser<ItemT>::convert(item_), |
| as_parser<DelimT>::convert(delim_), |
| as_parser<EndT>::convert(end_) |
| ); |
| } |
| template<typename ItemT, typename DelimT> |
| list_parser< |
| typename as_parser<ItemT>::type, |
| typename as_parser<DelimT>::type, |
| no_list_endtoken, |
| plain_parser_category |
| > |
| direct(ItemT const &item_, DelimT const &delim_) const |
| { |
| typedef typename as_parser<ItemT>::type item_t; |
| typedef typename as_parser<DelimT>::type delim_t; |
| typedef list_parser<item_t, delim_t, no_list_endtoken, |
| plain_parser_category> |
| return_t; |
| return return_t( |
| as_parser<ItemT>::convert(item_), |
| as_parser<DelimT>::convert(delim_) |
| ); |
| } |
| template<typename ItemT, typename DelimT, typename EndT> |
| list_parser< |
| typename as_parser<ItemT>::type, |
| typename as_parser<DelimT>::type, |
| typename as_parser<EndT>::type, |
| plain_parser_category |
| > |
| direct( |
| ItemT const &item_, DelimT const &delim_, EndT const &end_) const |
| { |
| typedef typename as_parser<ItemT>::type item_t; |
| typedef typename as_parser<DelimT>::type delim_t; |
| typedef typename as_parser<EndT>::type end_t; |
| typedef |
| list_parser<item_t, delim_t, end_t, plain_parser_category> |
| return_t; |
| return return_t( |
| as_parser<ItemT>::convert(item_), |
| as_parser<DelimT>::convert(delim_), |
| as_parser<EndT>::convert(end_) |
| ); |
| } |
| }; |
| const list_parser_gen<> list_p = list_parser_gen<>(); |
| }} |
| namespace boost { |
| namespace spirit { |
| template <typename CharT = char, typename TailT = chset<CharT> > |
| class distinct_parser |
| { |
| public: |
| typedef |
| contiguous< |
| sequence< |
| chseq<CharT const*>, |
| negated_empty_match_parser< |
| TailT |
| > |
| > |
| > |
| result_t; |
| distinct_parser() |
| : tail(chset<CharT>()) |
| { |
| } |
| explicit distinct_parser(parser<TailT> const & tail_) |
| : tail(tail_.derived()) |
| { |
| } |
| explicit distinct_parser(CharT const* letters) |
| : tail(chset_p(letters)) |
| { |
| } |
| result_t operator()(CharT const* str) const |
| { |
| return lexeme_d[chseq_p(str) >> ~epsilon_p(tail)]; |
| } |
| TailT tail; |
| }; |
| template <typename CharT = char, typename TailT = chset<CharT> > |
| class distinct_directive |
| { |
| public: |
| template<typename ParserT> |
| struct result { |
| typedef |
| contiguous< |
| sequence< |
| ParserT, |
| negated_empty_match_parser< |
| TailT |
| > |
| > |
| > |
| type; |
| }; |
| distinct_directive() |
| : tail(chset<CharT>()) |
| { |
| } |
| explicit distinct_directive(CharT const* letters) |
| : tail(chset_p(letters)) |
| { |
| } |
| explicit distinct_directive(parser<TailT> const & tail_) |
| : tail(tail_.derived()) |
| { |
| } |
| template<typename ParserT> |
| typename result<typename as_parser<ParserT>::type>::type |
| operator[](ParserT const &subject) const |
| { |
| return |
| lexeme_d[as_parser<ParserT>::convert(subject) >> ~epsilon_p(tail)]; |
| } |
| TailT tail; |
| }; |
| template <typename ScannerT = scanner<> > |
| class dynamic_distinct_parser |
| { |
| public: |
| typedef typename ScannerT::value_t char_t; |
| typedef |
| rule<typename lexeme_scanner<ScannerT>::type> |
| tail_t; |
| typedef |
| contiguous< |
| sequence< |
| chseq<char_t const*>, |
| negated_empty_match_parser< |
| tail_t |
| > |
| > |
| > |
| result_t; |
| dynamic_distinct_parser() |
| : tail(nothing_p) |
| { |
| } |
| template<typename ParserT> |
| explicit dynamic_distinct_parser(parser<ParserT> const & tail_) |
| : tail(tail_.derived()) |
| { |
| } |
| explicit dynamic_distinct_parser(char_t const* letters) |
| : tail(chset_p(letters)) |
| { |
| } |
| result_t operator()(char_t const* str) const |
| { |
| return lexeme_d[chseq_p(str) >> ~epsilon_p(tail)]; |
| } |
| tail_t tail; |
| }; |
| template <typename ScannerT = scanner<> > |
| class dynamic_distinct_directive |
| { |
| public: |
| typedef typename ScannerT::value_t char_t; |
| typedef |
| rule<typename lexeme_scanner<ScannerT>::type> |
| tail_t; |
| template<typename ParserT> |
| struct result { |
| typedef |
| contiguous< |
| sequence< |
| ParserT, |
| negated_empty_match_parser< |
| tail_t |
| > |
| > |
| > |
| type; |
| }; |
| dynamic_distinct_directive() |
| : tail(nothing_p) |
| { |
| } |
| template<typename ParserT> |
| explicit dynamic_distinct_directive(parser<ParserT> const & tail_) |
| : tail(tail_.derived()) |
| { |
| } |
| explicit dynamic_distinct_directive(char_t const* letters) |
| : tail(chset_p(letters)) |
| { |
| } |
| template<typename ParserT> |
| typename result<typename as_parser<ParserT>::type>::type |
| operator[](ParserT const &subject) const |
| { |
| return |
| lexeme_d[as_parser<ParserT>::convert(subject) >> ~epsilon_p(tail)]; |
| } |
| tail_t tail; |
| }; |
| } |
| } |
| #include <deque> |
| namespace boost |
| { |
| namespace detail { |
| template <class Category, class T, class Distance, class Pointer, class Reference> |
| struct iterator_base : std::iterator<Category, T, Distance, Pointer, Reference> {}; |
| } |
| template <class Category, class T, class Distance = std::ptrdiff_t, |
| class Pointer = T*, class Reference = T&> |
| struct iterator : detail::iterator_base<Category, T, Distance, Pointer, Reference> {}; |
| } |
| namespace boost { |
| namespace mpl { |
| template< |
| typename C = void_ |
| , typename F1 = void_ |
| , typename F2 = void_ |
| > |
| struct apply_if |
| { |
| private: |
| typedef typename if_<C,F1,F2>::type nullary_func_; |
| public: |
| typedef typename nullary_func_::type type; |
| |
| }; |
| template< |
| bool C |
| , typename F1 |
| , typename F2 |
| > |
| struct apply_if_c |
| { |
| private: |
| typedef typename if_c<C,F1,F2>::type nullary_func_; |
| public: |
| typedef typename nullary_func_::type type; |
| }; |
| template<> struct apply_if< void_,void_,void_ > { template< typename T1,typename T2,typename T3 , typename T4 =void_ ,typename T5 =void_ > struct apply : apply_if< T1,T2,T3 > { }; }; template<> struct lambda< apply_if< void_,void_,void_ > , void_ , int_<-1> > { typedef apply_if< void_,void_,void_ > type; }; namespace aux { template< typename T1,typename T2,typename T3 > struct template_arity< apply_if< T1,T2,T3 > > { static const int value = 3; }; template<> struct template_arity< apply_if< void_,void_,void_ > > { static const int value = -1; }; } |
| } |
| } |
| namespace boost { |
| namespace mpl { |
| template< |
| typename T = void_ |
| > |
| struct identity |
| { |
| typedef T type; |
| |
| }; |
| template< |
| typename T = void_ |
| > |
| struct make_identity |
| { |
| typedef identity<T> type; |
| |
| }; |
| template<> struct identity< void_ > { template< typename T1 , typename T2 =void_ ,typename T3 =void_ ,typename T4 =void_ ,typename T5 =void_ > struct apply : identity< T1 > { }; }; template<> struct lambda< identity< void_ > , void_ , int_<-1> > { typedef identity< void_ > type; }; namespace aux { template< typename T1 > struct template_arity< identity< T1 > > { static const int value = 1; }; template<> struct template_arity< identity< void_ > > { static const int value = -1; }; } |
| template<> struct make_identity< void_ > { template< typename T1 , typename T2 =void_ ,typename T3 =void_ ,typename T4 =void_ ,typename T5 =void_ > struct apply : make_identity< T1 > { }; }; template<> struct lambda< make_identity< void_ > , void_ , int_<-1> > { typedef make_identity< void_ > type; }; namespace aux { template< typename T1 > struct template_arity< make_identity< T1 > > { static const int value = 1; }; template<> struct template_arity< make_identity< void_ > > { static const int value = -1; }; } |
| } |
| } |
| namespace boost { |
| namespace mpl { |
| template<> struct arg<-1> |
| { |
| static int const value = -1; |
| |
| template< |
| typename U1 = void_, typename U2 = void_, typename U3 = void_ |
| , typename U4 = void_, typename U5 = void_ |
| > |
| struct apply |
| { |
| typedef U1 type; |
| private: |
| static bool const nv = !is_void_<type>::value; |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( nv ) >)> boost_static_assert_typedef_22; |
| }; |
| }; |
| template<> struct arg<1> |
| { |
| static int const value = 1; |
| typedef arg<2> next; |
| |
| template< |
| typename U1 = void_, typename U2 = void_, typename U3 = void_ |
| , typename U4 = void_, typename U5 = void_ |
| > |
| struct apply |
| { |
| typedef U1 type; |
| private: |
| static bool const nv = !is_void_<type>::value; |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( nv ) >)> boost_static_assert_typedef_43; |
| }; |
| }; |
| template<> struct arg<2> |
| { |
| static int const value = 2; |
| typedef arg<3> next; |
| |
| template< |
| typename U1 = void_, typename U2 = void_, typename U3 = void_ |
| , typename U4 = void_, typename U5 = void_ |
| > |
| struct apply |
| { |
| typedef U2 type; |
| private: |
| static bool const nv = !is_void_<type>::value; |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( nv ) >)> boost_static_assert_typedef_64; |
| }; |
| }; |
| template<> struct arg<3> |
| { |
| static int const value = 3; |
| typedef arg<4> next; |
| |
| template< |
| typename U1 = void_, typename U2 = void_, typename U3 = void_ |
| , typename U4 = void_, typename U5 = void_ |
| > |
| struct apply |
| { |
| typedef U3 type; |
| private: |
| static bool const nv = !is_void_<type>::value; |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( nv ) >)> boost_static_assert_typedef_85; |
| }; |
| }; |
| template<> struct arg<4> |
| { |
| static int const value = 4; |
| typedef arg<5> next; |
| |
| template< |
| typename U1 = void_, typename U2 = void_, typename U3 = void_ |
| , typename U4 = void_, typename U5 = void_ |
| > |
| struct apply |
| { |
| typedef U4 type; |
| private: |
| static bool const nv = !is_void_<type>::value; |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( nv ) >)> boost_static_assert_typedef_106; |
| }; |
| }; |
| template<> struct arg<5> |
| { |
| static int const value = 5; |
| typedef arg<6> next; |
| |
| template< |
| typename U1 = void_, typename U2 = void_, typename U3 = void_ |
| , typename U4 = void_, typename U5 = void_ |
| > |
| struct apply |
| { |
| typedef U5 type; |
| private: |
| static bool const nv = !is_void_<type>::value; |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( nv ) >)> boost_static_assert_typedef_127; |
| }; |
| }; |
| } |
| } |
| namespace boost { |
| namespace mpl { |
| typedef arg< -1 > _; |
| namespace placeholders { |
| using boost::mpl::_; |
| } |
| typedef arg<1> _1; |
| namespace placeholders { |
| using boost::mpl::_1; |
| } |
| typedef arg<2> _2; |
| namespace placeholders { |
| using boost::mpl::_2; |
| } |
| typedef arg<3> _3; |
| namespace placeholders { |
| using boost::mpl::_3; |
| } |
| typedef arg<4> _4; |
| namespace placeholders { |
| using boost::mpl::_4; |
| } |
| typedef arg<5> _5; |
| namespace placeholders { |
| using boost::mpl::_5; |
| } |
| typedef arg<6> _6; |
| namespace placeholders { |
| using boost::mpl::_6; |
| } |
| } |
| } |
| namespace boost { |
| struct no_traversal_tag {}; |
| struct incrementable_traversal_tag {}; |
| struct single_pass_traversal_tag |
| : incrementable_traversal_tag {}; |
| struct forward_traversal_tag |
| : single_pass_traversal_tag {}; |
| struct bidirectional_traversal_tag |
| : forward_traversal_tag {}; |
| struct random_access_traversal_tag |
| : bidirectional_traversal_tag {}; |
| namespace detail |
| { |
| template <class Cat> |
| struct old_category_to_traversal |
| : mpl::apply_if< |
| is_convertible<Cat,std::random_access_iterator_tag> |
| , mpl::identity<random_access_traversal_tag> |
| , mpl::apply_if< |
| is_convertible<Cat,std::bidirectional_iterator_tag> |
| , mpl::identity<bidirectional_traversal_tag> |
| , mpl::apply_if< |
| is_convertible<Cat,std::forward_iterator_tag> |
| , mpl::identity<forward_traversal_tag> |
| , mpl::apply_if< |
| is_convertible<Cat,std::input_iterator_tag> |
| , mpl::identity<single_pass_traversal_tag> |
| , mpl::apply_if< |
| is_convertible<Cat,std::output_iterator_tag> |
| , mpl::identity<incrementable_traversal_tag> |
| , void |
| > |
| > |
| > |
| > |
| > |
| {}; |
| template <class Traversal> |
| struct pure_traversal_tag |
| : mpl::apply_if< |
| is_convertible<Traversal,random_access_traversal_tag> |
| , mpl::identity<random_access_traversal_tag> |
| , mpl::apply_if< |
| is_convertible<Traversal,bidirectional_traversal_tag> |
| , mpl::identity<bidirectional_traversal_tag> |
| , mpl::apply_if< |
| is_convertible<Traversal,forward_traversal_tag> |
| , mpl::identity<forward_traversal_tag> |
| , mpl::apply_if< |
| is_convertible<Traversal,single_pass_traversal_tag> |
| , mpl::identity<single_pass_traversal_tag> |
| , mpl::apply_if< |
| is_convertible<Traversal,incrementable_traversal_tag> |
| , mpl::identity<incrementable_traversal_tag> |
| , void |
| > |
| > |
| > |
| > |
| > |
| { |
| }; |
| } |
| template <class Cat> |
| struct iterator_category_to_traversal |
| : mpl::apply_if< |
| is_convertible<Cat,incrementable_traversal_tag> |
| , mpl::identity<Cat> |
| , detail::old_category_to_traversal<Cat> |
| > |
| {}; |
| template <class Iterator = mpl::_1> |
| struct iterator_traversal |
| : iterator_category_to_traversal< |
| typename boost::detail::iterator_traits<Iterator>::iterator_category |
| > |
| {}; |
| } |
| namespace boost { namespace mpl { |
| namespace aux { |
| template< bool C_, typename T1, typename T2, typename T3, typename T4 > |
| struct or_impl |
| : true_ |
| { |
| }; |
| template< typename T1, typename T2, typename T3, typename T4 > |
| struct or_impl< false,T1,T2,T3,T4 > |
| : or_impl< |
| ::boost::mpl::aux::nested_type_wknd<T1>::value |
| , T2, T3, T4 |
| , false_ |
| > |
| { |
| }; |
| template<> |
| struct or_impl< |
| false |
| , false_, false_, false_, false_ |
| > |
| : false_ |
| { |
| }; |
| } |
| template< |
| typename T1 = void_ |
| , typename T2 = void_ |
| , typename T3 = false_, typename T4 = false_, typename T5 = false_ |
| > |
| struct or_ |
| : aux::or_impl< |
| ::boost::mpl::aux::nested_type_wknd<T1>::value |
| , T2, T3, T4, T5 |
| > |
| { |
| |
| }; |
| template<> struct or_< void_,void_ > { template< typename T1,typename T2 , typename T3 =void_ ,typename T4 =void_ ,typename T5 =void_ > struct apply : or_< T1,T2 > { }; }; template<> struct lambda< or_< void_,void_ > , void_ , int_<-1> > { typedef or_< void_,void_ > type; }; namespace aux { template< typename T1,typename T2,typename T3,typename T4,typename T5 > struct template_arity< or_< T1,T2,T3,T4,T5 > > { static const int value = 5; }; template<> struct template_arity< or_< void_,void_ > > { static const int value = -1; }; } |
| }} |
| namespace boost |
| { |
| template <typename A, typename B> |
| struct is_interoperable |
| : mpl::or_< |
| is_convertible< A, B > |
| , is_convertible< B, A > > |
| { |
| }; |
| } |
| namespace boost { namespace mpl { |
| namespace aux { |
| template< bool C_, typename T1, typename T2, typename T3, typename T4 > |
| struct and_impl |
| : false_ |
| { |
| }; |
| template< typename T1, typename T2, typename T3, typename T4 > |
| struct and_impl< true,T1,T2,T3,T4 > |
| : and_impl< |
| ::boost::mpl::aux::nested_type_wknd<T1>::value |
| , T2, T3, T4 |
| , true_ |
| > |
| { |
| }; |
| template<> |
| struct and_impl< |
| true |
| , true_, true_, true_, true_ |
| > |
| : true_ |
| { |
| }; |
| } |
| template< |
| typename T1 = void_ |
| , typename T2 = void_ |
| , typename T3 = true_, typename T4 = true_, typename T5 = true_ |
| > |
| struct and_ |
| : aux::and_impl< |
| ::boost::mpl::aux::nested_type_wknd<T1>::value |
| , T2, T3, T4, T5 |
| > |
| { |
| |
| }; |
| template<> struct and_< void_,void_ > { template< typename T1,typename T2 , typename T3 =void_ ,typename T4 =void_ ,typename T5 =void_ > struct apply : and_< T1,T2 > { }; }; template<> struct lambda< and_< void_,void_ > , void_ , int_<-1> > { typedef and_< void_,void_ > type; }; namespace aux { template< typename T1,typename T2,typename T3,typename T4,typename T5 > struct template_arity< and_< T1,T2,T3,T4,T5 > > { static const int value = 5; }; template<> struct template_arity< and_< void_,void_ > > { static const int value = -1; }; } |
| }} |
| namespace boost { struct use_default; } |
| namespace boost { namespace detail { |
| struct input_output_iterator_tag |
| : std::input_iterator_tag |
| { |
| operator std::output_iterator_tag() const |
| { |
| return std::output_iterator_tag(); |
| } |
| }; |
| template <class ValueParam, class Reference> |
| struct iterator_writability_disabled |
| : is_const<ValueParam> |
| {}; |
| template <class Traversal, class ValueParam, class Reference> |
| struct iterator_facade_default_category |
| : mpl::apply_if< |
| mpl::and_< |
| is_reference<Reference> |
| , is_convertible<Traversal,forward_traversal_tag> |
| > |
| , mpl::apply_if< |
| is_convertible<Traversal,random_access_traversal_tag> |
| , mpl::identity<std::random_access_iterator_tag> |
| , mpl::if_< |
| is_convertible<Traversal,bidirectional_traversal_tag> |
| , std::bidirectional_iterator_tag |
| , std::forward_iterator_tag |
| > |
| > |
| , typename mpl::apply_if< |
| mpl::and_< |
| is_convertible<Traversal, single_pass_traversal_tag> |
| , is_convertible<Reference, ValueParam> |
| > |
| , mpl::identity<std::input_iterator_tag> |
| , mpl::identity<Traversal> |
| > |
| > |
| { |
| }; |
| template <class T> |
| struct is_iterator_category |
| : mpl::or_< |
| is_convertible<T,std::input_iterator_tag> |
| , is_convertible<T,std::output_iterator_tag> |
| > |
| { |
| }; |
| template <class T> |
| struct is_iterator_traversal |
| : is_convertible<T,incrementable_traversal_tag> |
| {}; |
| template <class Category, class Traversal> |
| struct iterator_category_with_traversal |
| : Category, Traversal |
| { |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( !(is_convertible< typename iterator_category_to_traversal<Category>::type , Traversal >::value) ) >)> boost_static_assert_typedef_158; |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( is_iterator_category<Category>::value ) >)> boost_static_assert_typedef_160; |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( !is_iterator_category<Traversal>::value ) >)> boost_static_assert_typedef_161; |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( !is_iterator_traversal<Category>::value ) >)> boost_static_assert_typedef_162; |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( is_iterator_traversal<Traversal>::value ) >)> boost_static_assert_typedef_164; |
| }; |
| template <class Traversal, class ValueParam, class Reference> |
| struct facade_iterator_category_impl |
| { |
| typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( !is_iterator_category<Traversal>::value ) >)> boost_static_assert_typedef_175; |
| typedef typename iterator_facade_default_category< |
| Traversal,ValueParam,Reference |
| >::type category; |
| typedef typename mpl::if_< |
| is_same< |
| Traversal |
| , typename iterator_category_to_traversal<category>::type |
| > |
| , category |
| , iterator_category_with_traversal<category,Traversal> |
| >::type type; |
| }; |
| template <class CategoryOrTraversal, class ValueParam, class Reference> |
| struct facade_iterator_category |
| : mpl::apply_if< |
| is_iterator_category<CategoryOrTraversal> |
| , mpl::identity<CategoryOrTraversal> |
| , facade_iterator_category_impl<CategoryOrTraversal,ValueParam,Reference> |
| > |
| { |
| }; |
| }} |
| namespace boost |
| { |
| namespace iterators |
| { |
| template<bool> |
| struct enabled |
| { |
| template<typename T> |
| struct base |
| { |
| typedef T type; |
| }; |
| }; |
| template<> |
| struct enabled<false> |
| { |
| template<typename T> |
| struct base |
| { |
| }; |
| }; |
| template <class Cond, |
| class Return> |
| struct enable_if |
| : enabled<(Cond::value)>::template base<Return> |
| { |
| }; |
| } |
| } |
| namespace boost { |
| namespace detail { |
| template <typename T> |
| struct add_pointer_impl |
| { |
| typedef typename remove_reference<T>::type no_ref_type; |
| typedef no_ref_type* type; |
| }; |
| } |
| template< typename T > struct add_pointer { typedef typename detail::add_pointer_impl<T>::type type; }; |
| } |
| namespace boost { |
| namespace detail { |
| template <typename T, bool is_vol> |
| struct remove_const_helper |
| { |
| typedef T type; |
| }; |
| template <typename T> |
| struct remove_const_helper<T, true> |
| { |
| typedef T volatile type; |
| }; |
| template <typename T> |
| struct remove_const_impl |
| { |
| typedef typename remove_const_helper< |
| typename cv_traits_imp<T*>::unqualified_type |
| , ::boost::is_volatile<T>::value |
| >::type type; |
| }; |
| } |
| template< typename T > struct remove_const { typedef typename detail::remove_const_impl<T>::type type; }; |
| template< typename T > struct remove_const<T&> { typedef T& type; }; |
| template< typename T, std::size_t N > struct remove_const<T const[N]> { typedef T type[N]; }; |
| template< typename T, std::size_t N > struct remove_const<T const volatile[N]> { typedef T volatile type[N]; }; |
| } |
| namespace boost |
| { |
| template <class I, class V, class TC, class R, class D> class iterator_facade; |
| namespace detail |
| { |
| template < |
| class Facade1 |
| , class Facade2 |
| , class Return |
| > |
| struct enable_if_interoperable |
| : ::boost::iterators::enable_if< |
| mpl::or_< |
| is_convertible<Facade1, Facade2> |
| , is_convertible<Facade2, Facade1> |
| > |
| , Return |
| > |
| { |
| }; |
| template < |
| class ValueParam |
| , class CategoryOrTraversal |
| , class Reference |
| , class Difference |
| > |
| struct iterator_facade_types |
| { |
| typedef typename facade_iterator_category< |
| CategoryOrTraversal, ValueParam, Reference |
| >::type iterator_category; |
| typedef typename remove_const<ValueParam>::type value_type; |
| typedef typename mpl::apply_if< |
| detail::iterator_writability_disabled<ValueParam,Reference> |
| , add_pointer<typename add_const<value_type>::type> |
| , add_pointer<value_type> |
| >::type pointer; |
| }; |
| template <class T> |
| struct operator_arrow_proxy |
| { |
| operator_arrow_proxy(T const* px) : m_value(*px) {} |
| const T* operator->() const { return &m_value; } |
| operator const T*() const { return &m_value; } |
| T m_value; |
| }; |
| template <class Value, class Reference, class Pointer> |
| struct operator_arrow_result |
| { |
| typedef typename mpl::if_< |
| is_reference<Reference> |
| , Pointer |
| , operator_arrow_proxy<Value> |
| >::type type; |
| static type make(Reference x) |
| { |
| return type(&x); |
| } |
| }; |
| template <class Iterator> |
| class operator_brackets_proxy |
| { |
| typedef typename Iterator::reference reference; |
| typedef typename Iterator::value_type value_type; |
| public: |
| operator_brackets_proxy(Iterator const& iter) |
| : m_iter(iter) |
| {} |
| operator reference() const |
| { |
| return *m_iter; |
| } |
| operator_brackets_proxy& operator=(value_type const& val) |
| { |
| *m_iter = val; |
| return *this; |
| } |
| private: |
| Iterator m_iter; |
| }; |
| template <class Value, class Reference> |
| struct use_operator_brackets_proxy |
| : mpl::and_< |
| boost::is_POD<Value> |
| , iterator_writability_disabled<Value,Reference> |
| > |
| {}; |
| template <class Iterator, class Value, class Reference> |
| struct operator_brackets_result |
| { |
| typedef typename mpl::if_< |
| use_operator_brackets_proxy<Value,Reference> |
| , Value |
| , operator_brackets_proxy<Iterator> |
| >::type type; |
| }; |
| template <class Iterator> |
| operator_brackets_proxy<Iterator> make_operator_brackets_result(Iterator const& iter, mpl::false_) |
| { |
| return operator_brackets_proxy<Iterator>(iter); |
| } |
| template <class Iterator> |
| typename Iterator::value_type make_operator_brackets_result(Iterator const& iter, mpl::true_) |
| { |
| return *iter; |
| } |
| } |
| class iterator_core_access |
| { |
| template <class I, class V, class TC, class R, class D> friend class iterator_facade; |
| template < class Derived1, class V1, class TC1, class R1, class D1 , class Derived2, class V2, class TC2, class R2, class D2 > friend typename detail::enable_if_interoperable< Derived1, Derived2, bool >::type operator ==( iterator_facade<Derived1, V1, TC1, R1, D1> const& lhs , iterator_facade<Derived2, V2, TC2, R2, D2> const& rhs); |
| template < class Derived1, class V1, class TC1, class R1, class D1 , class Derived2, class V2, class TC2, class R2, class D2 > friend typename detail::enable_if_interoperable< Derived1, Derived2, bool >::type operator !=( iterator_facade<Derived1, V1, TC1, R1, D1> const& lhs , iterator_facade<Derived2, V2, TC2, R2, D2> const& rhs); |
| template < class Derived1, class V1, class TC1, class R1, class D1 , class Derived2, class V2, class TC2, class R2, class D2 > friend typename detail::enable_if_interoperable< Derived1, Derived2, bool >::type operator <( iterator_facade<Derived1, V1, TC1, R1, D1> const& lhs , iterator_facade<Derived2, V2, TC2, R2, D2> const& rhs); |
| template < class Derived1, class V1, class TC1, class R1, class D1 , class Derived2, class V2, class TC2, class R2, class D2 > friend typename detail::enable_if_interoperable< Derived1, Derived2, bool >::type operator >( iterator_facade<Derived1, V1, TC1, R1, D1> const& lhs , iterator_facade<Derived2, V2, TC2, R2, D2> const& rhs); |
| template < class Derived1, class V1, class TC1, class R1, class D1 , class Derived2, class V2, class TC2, class R2, class D2 > friend typename detail::enable_if_interoperable< Derived1, Derived2, bool >::type operator <=( iterator_facade<Derived1, V1, TC1, R1, D1> const& lhs , iterator_facade<Derived2, V2, TC2, R2, D2> const& rhs); |
| template < class Derived1, class V1, class TC1, class R1, class D1 , class Derived2, class V2, class TC2, class R2, class D2 > friend typename detail::enable_if_interoperable< Derived1, Derived2, bool >::type operator >=( iterator_facade<Derived1, V1, TC1, R1, D1> const& lhs , iterator_facade<Derived2, V2, TC2, R2, D2> const& rhs); |
| template < class Derived1, class V1, class TC1, class R1, class D1 , class Derived2, class V2, class TC2, class R2, class D2 > friend typename detail::enable_if_interoperable< Derived1, Derived2, typename Derived1::difference_type >::type operator -( iterator_facade<Derived1, V1, TC1, R1, D1> const& lhs , iterator_facade<Derived2, V2, TC2, R2, D2> const& rhs) |
| ; |
| template <class Derived, class V, class TC, class R, class D> friend Derived operator+ (iterator_facade<Derived, V, TC, R, D> const& , typename Derived::difference_type) |
| ; |
| template <class Derived, class V, class TC, class R, class D> friend Derived operator+ (typename Derived::difference_type , iterator_facade<Derived, V, TC, R, D> const&) |
| ; |
| template <class Facade> |
| static typename Facade::reference dereference(Facade const& f) |
| { |
| return f.dereference(); |
| } |
| template <class Facade> |
| static void increment(Facade& f) |
| { |
| f.increment(); |
| } |
| template <class Facade> |
| static void decrement(Facade& f) |
| { |
| f.decrement(); |
| } |
| template <class Facade1, class Facade2> |
| static bool equal(Facade1 const& f1, Facade2 const& f2) |
| { |
| return f1.equal(f2); |
| } |
| template <class Facade> |
| static void advance(Facade& f, typename Facade::difference_type n) |
| { |
| f.advance(n); |
| } |
| template <class Facade1, class Facade2> |
| static typename Facade1::difference_type distance_to( |
| Facade1 const& f1, Facade2 const& f2) |
| { |
| return f1.distance_to(f2); |
| } |
| private: |
| iterator_core_access(); |
| }; |
| template < |
| class Derived |
| , class Value |
| , class CategoryOrTraversal |
| , class Reference = Value& |
| , class Difference = std::ptrdiff_t |
| > |
| class iterator_facade |
| { |
| private: |
| typedef Derived derived_t; |
| Derived& derived() |
| { |
| return static_cast<Derived&>(*this); |
| } |
| Derived const& derived() const |
| { |
| return static_cast<Derived const&>(*this); |
| } |
| typedef detail::iterator_facade_types< |
| Value, CategoryOrTraversal, Reference, Difference |
| > associated_types; |
| public: |
| typedef typename associated_types::value_type value_type; |
| typedef Reference reference; |
| typedef Difference difference_type; |
| typedef typename associated_types::pointer pointer; |
| typedef typename associated_types::iterator_category iterator_category; |
| reference operator*() const |
| { |
| return iterator_core_access::dereference(this->derived()); |
| } |
| typename detail::operator_arrow_result< |
| value_type |
| , reference |
| , pointer |
| >::type |
| operator->() const |
| { |
| return detail::operator_arrow_result< |
| value_type |
| , reference |
| , pointer |
| >::make(*this->derived()); |
| } |
| typename detail::operator_brackets_result<Derived,Value,Reference>::type |
| operator[](difference_type n) const |
| { |
| typedef detail::use_operator_brackets_proxy<Value,Reference> use_proxy; |
| return detail::make_operator_brackets_result<Derived>( |
| this->derived() + n |
| , use_proxy() |
| ); |
| } |
|