File indexing completed on 2025-01-31 10:02:35
0001
0002
0003
0004
0005
0006
0007 #if !defined(BOOST_SPIRIT_X3_SKIP_APRIL_16_2006_0625PM)
0008 #define BOOST_SPIRIT_X3_SKIP_APRIL_16_2006_0625PM
0009
0010 #include <boost/spirit/home/x3/support/unused.hpp>
0011 #include <boost/spirit/home/x3/support/context.hpp>
0012 #include <boost/spirit/home/x3/support/traits/attribute_category.hpp>
0013 #include <boost/mpl/bool.hpp>
0014 #include <boost/mpl/not.hpp>
0015 #include <boost/type_traits/remove_cv.hpp>
0016 #include <boost/type_traits/remove_reference.hpp>
0017 #include <boost/utility/declval.hpp>
0018
0019 namespace boost { namespace spirit { namespace x3
0020 {
0021
0022
0023
0024
0025
0026 template <typename Skipper>
0027 struct unused_skipper : unused_type
0028 {
0029 unused_skipper(Skipper const& skipper)
0030 : skipper(skipper) {}
0031 Skipper const& skipper;
0032 };
0033
0034 namespace detail
0035 {
0036 template <typename Skipper>
0037 struct is_unused_skipper
0038 : mpl::false_ {};
0039
0040 template <typename Skipper>
0041 struct is_unused_skipper<unused_skipper<Skipper>>
0042 : mpl::true_ {};
0043
0044 template <>
0045 struct is_unused_skipper<unused_type>
0046 : mpl::true_ {};
0047
0048 template <typename Skipper>
0049 inline Skipper const&
0050 get_unused_skipper(Skipper const& skipper)
0051 {
0052 return skipper;
0053 }
0054 template <typename Skipper>
0055 inline Skipper const&
0056 get_unused_skipper(unused_skipper<Skipper> const& unused_skipper)
0057 {
0058 return unused_skipper.skipper;
0059 }
0060
0061 template <typename Iterator, typename Skipper>
0062 inline void skip_over(
0063 Iterator& first, Iterator const& last, Skipper const& skipper)
0064 {
0065 while (skipper.parse(first, last, unused, unused, unused))
0066 ;
0067 }
0068
0069 template <typename Iterator>
0070 inline void skip_over(Iterator&, Iterator const&, unused_type)
0071 {
0072 }
0073
0074 template <typename Iterator, typename Skipper>
0075 inline void skip_over(
0076 Iterator&, Iterator const&, unused_skipper<Skipper> const&)
0077 {
0078 }
0079 }
0080
0081
0082 struct skipper_tag;
0083
0084 template <typename Context>
0085 struct has_skipper
0086 : mpl::not_<detail::is_unused_skipper<
0087 typename remove_cv<typename remove_reference<
0088 decltype(x3::get<skipper_tag>(boost::declval<Context>()))
0089 >::type>::type
0090 >> {};
0091
0092 template <typename Iterator, typename Context>
0093 inline void skip_over(
0094 Iterator& first, Iterator const& last, Context const& context)
0095 {
0096 detail::skip_over(first, last, x3::get<skipper_tag>(context));
0097 }
0098 }}}
0099
0100 #endif