/*============================================================================= Copyright (c) 2001-2014 Joel de Guzman Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(BOOST_SPIRIT_X3_SKIP_APRIL_16_2006_0625PM) #define BOOST_SPIRIT_X3_SKIP_APRIL_16_2006_0625PM #include #include #include #include #include #include #include #include namespace boost { namespace spirit { namespace x3 { /////////////////////////////////////////////////////////////////////////// // Move the /first/ iterator to the first non-matching position // given a skip-parser. The function is a no-op if unused_type or // unused_skipper is passed as the skip-parser. /////////////////////////////////////////////////////////////////////////// template struct unused_skipper : unused_type { unused_skipper(Skipper const& skipper) : skipper(skipper) {} Skipper const& skipper; }; namespace detail { template struct is_unused_skipper : mpl::false_ {}; template struct is_unused_skipper> : mpl::true_ {}; template <> struct is_unused_skipper : mpl::true_ {}; template inline Skipper const& get_unused_skipper(Skipper const& skipper) { return skipper; } template inline Skipper const& get_unused_skipper(unused_skipper const& unused_skipper) { return unused_skipper.skipper; } template inline void skip_over( Iterator& first, Iterator const& last, Skipper const& skipper) { while (skipper.parse(first, last, unused, unused, unused)) /***/; } template inline void skip_over(Iterator&, Iterator const&, unused_type) { } template inline void skip_over( Iterator&, Iterator const&, unused_skipper const&) { } } // this tag is used to find the skipper from the context struct skipper_tag; template struct has_skipper : mpl::not_(boost::declval())) >::type>::type >> {}; template inline void skip_over( Iterator& first, Iterator const& last, Context const& context) { detail::skip_over(first, last, x3::get(context)); } }}} #endif