File indexing completed on 2025-01-18 09:53:48
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ASSERT_EOL_MATCHER_HPP_EAN_10_04_2005
0009 #define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ASSERT_EOL_MATCHER_HPP_EAN_10_04_2005
0010
0011
0012 #if defined(_MSC_VER)
0013 # pragma once
0014 #endif
0015
0016 #include <boost/next_prior.hpp>
0017 #include <boost/xpressive/detail/detail_fwd.hpp>
0018 #include <boost/xpressive/detail/core/quant_style.hpp>
0019 #include <boost/xpressive/detail/core/state.hpp>
0020 #include <boost/xpressive/detail/core/matcher/assert_line_base.hpp>
0021
0022 namespace boost { namespace xpressive { namespace detail
0023 {
0024
0025
0026
0027
0028 template<typename Traits>
0029 struct assert_eol_matcher
0030 : assert_line_base<Traits>
0031 {
0032 typedef typename Traits::char_type char_type;
0033
0034 assert_eol_matcher(Traits const &tr)
0035 : assert_line_base<Traits>(tr)
0036 {
0037 }
0038
0039 template<typename BidiIter, typename Next>
0040 bool match(match_state<BidiIter> &state, Next const &next) const
0041 {
0042 if(state.eos())
0043 {
0044 if(!state.flags_.match_eol_)
0045 {
0046 return false;
0047 }
0048 }
0049 else
0050 {
0051 char_type ch = *state.cur_;
0052
0053
0054 if(!traits_cast<Traits>(state).isctype(ch, this->newline_))
0055 {
0056 return false;
0057 }
0058
0059 else if(ch == this->nl_ && (!state.bos() || state.flags_.match_prev_avail_) && *boost::prior(state.cur_) == this->cr_)
0060 {
0061 return false;
0062 }
0063 }
0064
0065 return next.match(state);
0066 }
0067 };
0068
0069 }}}
0070
0071 #endif