]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/xpressive/detail/core/matcher/mark_end_matcher.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / xpressive / detail / core / matcher / mark_end_matcher.hpp
CommitLineData
7c673cae
FG
1///////////////////////////////////////////////////////////////////////////////
2// mark_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
8#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_MARK_END_MATCHER_HPP_EAN_10_04_2005
9#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_MARK_END_MATCHER_HPP_EAN_10_04_2005
10
11// MS compatible compilers support #pragma once
12#if defined(_MSC_VER)
13# pragma once
14#endif
15
16#include <boost/xpressive/detail/detail_fwd.hpp>
17#include <boost/xpressive/detail/core/quant_style.hpp>
18#include <boost/xpressive/detail/core/state.hpp>
19
20namespace boost { namespace xpressive { namespace detail
21{
22
23 ///////////////////////////////////////////////////////////////////////////////
24 // mark_end_matcher
25 //
26 struct mark_end_matcher
27 : quant_style<quant_none, 0, false>
28 {
29 int mark_number_;
30
31 mark_end_matcher(int mark_number)
32 : mark_number_(mark_number)
33 {
34 }
35
36 template<typename BidiIter, typename Next>
37 bool match(match_state<BidiIter> &state, Next const &next) const
38 {
39 sub_match_impl<BidiIter> &br = state.sub_match(this->mark_number_);
40
41 BidiIter old_first = br.first;
42 BidiIter old_second = br.second;
43 bool old_matched = br.matched;
44
45 br.first = br.begin_;
46 br.second = state.cur_;
47 br.matched = true;
48
49 if(next.match(state))
50 {
51 return true;
52 }
53
54 br.first = old_first;
55 br.second = old_second;
56 br.matched = old_matched;
57
58 return false;
59 }
60 };
61
62}}}
63
64#endif