attr_end_matcher.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // attr_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_ATTR_END_MATCHER_HPP_EAN_06_09_2007
  8. #define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ATTR_END_MATCHER_HPP_EAN_06_09_2007
  9. // MS compatible compilers support #pragma once
  10. #if defined(_MSC_VER)
  11. # pragma once
  12. #endif
  13. #include <boost/xpressive/detail/detail_fwd.hpp>
  14. #include <boost/xpressive/detail/core/quant_style.hpp>
  15. #include <boost/xpressive/detail/core/state.hpp>
  16. namespace boost { namespace xpressive { namespace detail
  17. {
  18. ///////////////////////////////////////////////////////////////////////////////
  19. // attr_end_matcher
  20. //
  21. struct attr_end_matcher
  22. : quant_style<quant_none, 0, false>
  23. {
  24. template<typename BidiIter, typename Next>
  25. static bool match(match_state<BidiIter> &state, Next const &next)
  26. {
  27. attr_context old_attr_context = state.attr_context_;
  28. state.attr_context_ = *old_attr_context.prev_attr_context_;
  29. if(next.match(state))
  30. {
  31. return true;
  32. }
  33. state.attr_context_ = old_attr_context;
  34. return false;
  35. }
  36. };
  37. }}}
  38. #endif