any_matcher.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // any_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_ANY_MATCHER_HPP_EAN_10_04_2005
  8. #define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ANY_MATCHER_HPP_EAN_10_04_2005
  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. // any_matcher
  20. //
  21. struct any_matcher
  22. {
  23. BOOST_XPR_QUANT_STYLE(quant_fixed_width, 1, true)
  24. template<typename BidiIter, typename Next>
  25. static bool match(match_state<BidiIter> &state, Next const &next)
  26. {
  27. if(state.eos())
  28. {
  29. return false;
  30. }
  31. ++state.cur_;
  32. if(next.match(state))
  33. {
  34. return true;
  35. }
  36. --state.cur_;
  37. return false;
  38. }
  39. };
  40. }}}
  41. #endif