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_LITERAL_MATCHER_HPP_EAN_10_04_2005
9 #define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_LITERAL_MATCHER_HPP_EAN_10_04_2005
11 // MS compatible compilers support #pragma once
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 #include <boost/xpressive/detail/utility/traits_utils.hpp>
21 namespace boost { namespace xpressive { namespace detail
24 ///////////////////////////////////////////////////////////////////////////////
27 template<typename Traits, typename ICase, typename Not>
28 struct literal_matcher
29 : quant_style_fixed_width<1>
31 typedef typename Traits::char_type char_type;
33 typedef ICase icase_type;
36 explicit literal_matcher(char_type ch)
40 literal_matcher(char_type ch, Traits const &tr)
41 : ch_(detail::translate(ch, tr, icase_type()))
44 template<typename BidiIter, typename Next>
45 bool match(match_state<BidiIter> &state, Next const &next) const
47 if(state.eos() || Not::value ==
48 (detail::translate(*state.cur_, traits_cast<Traits>(state), icase_type()) == this->ch_))