alternate_end_matcher.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // alternate_end_matcher.hpp
  3. //
  4. // Copyright 2008 Eric Niebler. Distributed under the Boost
  5. // Software License, Version 1.0. (See accompanying file
  6. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. #ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ALTERNATE_END_MATCHER_HPP_EAN_10_04_2005
  8. #define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ALTERNATE_END_MATCHER_HPP_EAN_10_04_2005
  9. // MS compatible compilers support #pragma once
  10. #if defined(_MSC_VER)
  11. # pragma once
  12. # pragma warning(push)
  13. # pragma warning(disable : 4100) // unreferenced formal parameter
  14. #endif
  15. #include <boost/xpressive/detail/detail_fwd.hpp>
  16. #include <boost/xpressive/detail/core/quant_style.hpp>
  17. #include <boost/xpressive/detail/core/state.hpp>
  18. namespace boost { namespace xpressive { namespace detail
  19. {
  20. ///////////////////////////////////////////////////////////////////////////////
  21. // alternate_end_matcher
  22. //
  23. struct alternate_end_matcher
  24. : quant_style_assertion
  25. {
  26. mutable void const *back_;
  27. alternate_end_matcher()
  28. : back_(0)
  29. {
  30. }
  31. template<typename BidiIter, typename Next>
  32. bool match(match_state<BidiIter> &state, Next const &next) const
  33. {
  34. return next.pop_match(state, this->back_);
  35. }
  36. };
  37. }}}
  38. #if defined(_MSC_VER)
  39. # pragma warning(pop)
  40. #endif
  41. #endif