skip_over.hpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. ==============================================================================*/
  6. #if !defined(BOOST_SPIRIT_SKIP_APRIL_16_2006_0625PM)
  7. #define BOOST_SPIRIT_SKIP_APRIL_16_2006_0625PM
  8. #if defined(_MSC_VER)
  9. #pragma once
  10. #endif
  11. #include <boost/spirit/home/support/unused.hpp>
  12. #include <boost/spirit/home/qi/detail/unused_skipper.hpp>
  13. namespace boost { namespace spirit { namespace qi
  14. {
  15. ///////////////////////////////////////////////////////////////////////////
  16. // Move the /first/ iterator to the first non-matching position
  17. // given a skip-parser. The function is a no-op if unused_type is
  18. // passed as the skip-parser.
  19. ///////////////////////////////////////////////////////////////////////////
  20. template <typename Iterator, typename T>
  21. inline void skip_over(Iterator& first, Iterator const& last, T const& skipper)
  22. {
  23. while (skipper.parse(first, last, unused, unused, unused))
  24. /***/;
  25. }
  26. template <typename Iterator>
  27. inline void skip_over(Iterator&, Iterator const&, unused_type)
  28. {
  29. }
  30. template <typename Iterator, typename Skipper>
  31. inline void skip_over(Iterator&, Iterator const&
  32. , detail::unused_skipper<Skipper> const&)
  33. {
  34. }
  35. }}}
  36. #endif