1 ///////////////////////////////////////////////////////////////////////////////
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)
8 #ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_MARK_MATCHER_HPP_EAN_10_04_2005
9 #define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_MARK_MATCHER_HPP_EAN_10_04_2005
11 // MS compatible compilers support #pragma once
16 #include <boost/assert.hpp>
17 #include <boost/xpressive/detail/detail_fwd.hpp>
18 #include <boost/xpressive/detail/core/quant_style.hpp>
19 #include <boost/xpressive/detail/core/state.hpp>
20 #include <boost/xpressive/detail/utility/traits_utils.hpp>
22 namespace boost { namespace xpressive { namespace detail
25 // TODO: the mark matcher is acually a fixed-width matcher, but the width is
26 // not known until pattern match time.
28 ///////////////////////////////////////////////////////////////////////////////
31 template<typename Traits, typename ICase>
33 : quant_style_variable_width
35 typedef ICase icase_type;
38 mark_matcher(int mark_number, Traits const &)
39 : mark_number_(mark_number)
43 template<typename BidiIter, typename Next>
44 bool match(match_state<BidiIter> &state, Next const &next) const
46 BOOST_ASSERT(this->mark_number_ < static_cast<int>(state.mark_count_));
47 sub_match_impl<BidiIter> const &br = state.sub_match(this->mark_number_);
54 BidiIter const tmp = state.cur_;
55 for(BidiIter begin = br.first, end = br.second; begin != end; ++begin, ++state.cur_)
58 || detail::translate(*state.cur_, traits_cast<Traits>(state), icase_type())
59 != detail::translate(*begin, traits_cast<Traits>(state), icase_type()))