Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:48

0001 ///////////////////////////////////////////////////////////////////////////////
0002 // mark_end_matcher.hpp
0003 //
0004 //  Copyright 2008 Eric Niebler. Distributed under the Boost
0005 //  Software License, Version 1.0. (See accompanying file
0006 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 
0008 #ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_MARK_END_MATCHER_HPP_EAN_10_04_2005
0009 #define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_MARK_END_MATCHER_HPP_EAN_10_04_2005
0010 
0011 // MS compatible compilers support #pragma once
0012 #if defined(_MSC_VER)
0013 # pragma once
0014 #endif
0015 
0016 #include <boost/xpressive/detail/detail_fwd.hpp>
0017 #include <boost/xpressive/detail/core/quant_style.hpp>
0018 #include <boost/xpressive/detail/core/state.hpp>
0019 
0020 namespace boost { namespace xpressive { namespace detail
0021 {
0022 
0023     ///////////////////////////////////////////////////////////////////////////////
0024     // mark_end_matcher
0025     //
0026     struct mark_end_matcher
0027       : quant_style<quant_none, 0, false>
0028     {
0029         int mark_number_;
0030 
0031         mark_end_matcher(int mark_number)
0032           : mark_number_(mark_number)
0033         {
0034         }
0035 
0036         template<typename BidiIter, typename Next>
0037         bool match(match_state<BidiIter> &state, Next const &next) const
0038         {
0039             sub_match_impl<BidiIter> &br = state.sub_match(this->mark_number_);
0040 
0041             BidiIter old_first = br.first;
0042             BidiIter old_second = br.second;
0043             bool old_matched = br.matched;
0044 
0045             br.first = br.begin_;
0046             br.second = state.cur_;
0047             br.matched = true;
0048 
0049             if(next.match(state))
0050             {
0051                 return true;
0052             }
0053 
0054             br.first = old_first;
0055             br.second = old_second;
0056             br.matched = old_matched;
0057 
0058             return false;
0059         }
0060     };
0061 
0062 }}}
0063 
0064 #endif