File indexing completed on 2025-01-18 09:53:51
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_XPRESSIVE_DETAIL_STATIC_COMPILE_HPP_EAN_10_04_2005
0009 #define BOOST_XPRESSIVE_DETAIL_STATIC_COMPILE_HPP_EAN_10_04_2005
0010
0011
0012 #if defined(_MSC_VER)
0013 # pragma once
0014 #endif
0015
0016 #include <boost/mpl/bool.hpp>
0017 #include <boost/iterator/iterator_traits.hpp>
0018 #include <boost/proto/core.hpp>
0019 #include <boost/xpressive/regex_traits.hpp>
0020 #include <boost/xpressive/detail/core/regex_impl.hpp>
0021 #include <boost/xpressive/detail/core/linker.hpp>
0022 #include <boost/xpressive/detail/core/optimize.hpp>
0023 #include <boost/xpressive/detail/core/adaptor.hpp>
0024 #include <boost/xpressive/detail/core/matcher/end_matcher.hpp>
0025 #include <boost/xpressive/detail/static/static.hpp>
0026 #include <boost/xpressive/detail/static/visitor.hpp>
0027 #include <boost/xpressive/detail/static/grammar.hpp>
0028
0029 namespace boost { namespace xpressive { namespace detail
0030 {
0031
0032
0033
0034 template<typename Xpr, typename BidiIter, typename Traits>
0035 void static_compile_impl2(Xpr const &xpr, shared_ptr<regex_impl<BidiIter> > const &impl, Traits const &tr)
0036 {
0037 typedef typename iterator_value<BidiIter>::type char_type;
0038 impl->tracking_clear();
0039 impl->traits_ = new traits_holder<Traits>(tr);
0040
0041
0042 typedef xpression_visitor<BidiIter, mpl::false_, Traits> visitor_type;
0043 visitor_type visitor(tr, impl);
0044 intrusive_ptr<matchable_ex<BidiIter> const> adxpr = make_adaptor<matchable_ex<BidiIter> >(
0045 typename Grammar<char_type>::template impl<Xpr const &, end_xpression, visitor_type &>()(
0046 xpr
0047 , end_xpression()
0048 , visitor
0049 )
0050 );
0051
0052
0053 common_compile(adxpr, *impl, visitor.traits());
0054
0055
0056 impl->tracking_update();
0057 }
0058
0059
0060
0061 struct XpressiveLocaleModifier
0062 : proto::binary_expr<
0063 modifier_tag
0064 , proto::terminal<locale_modifier<proto::_> >
0065 , proto::_
0066 >
0067 {};
0068
0069
0070
0071 template<typename Xpr, typename BidiIter>
0072 typename disable_if<proto::matches<Xpr, XpressiveLocaleModifier> >::type
0073 static_compile_impl1(Xpr const &xpr, shared_ptr<regex_impl<BidiIter> > const &impl)
0074 {
0075
0076 typedef typename iterator_value<BidiIter>::type char_type;
0077 typedef typename default_regex_traits<char_type>::type traits_type;
0078 traits_type tr;
0079 static_compile_impl2(xpr, impl, tr);
0080 }
0081
0082
0083
0084 template<typename Xpr, typename BidiIter>
0085 typename enable_if<proto::matches<Xpr, XpressiveLocaleModifier> >::type
0086 static_compile_impl1(Xpr const &xpr, shared_ptr<regex_impl<BidiIter> > const &impl)
0087 {
0088
0089 typedef typename proto::result_of::value<typename proto::result_of::left<Xpr>::type>::type::locale_type locale_type;
0090 typedef typename regex_traits_type<locale_type, BidiIter>::type traits_type;
0091 static_compile_impl2(proto::right(xpr), impl, traits_type(proto::value(proto::left(xpr)).getloc()));
0092 }
0093
0094
0095
0096 template<typename Xpr, typename BidiIter>
0097 void static_compile(Xpr const &xpr, shared_ptr<regex_impl<BidiIter> > const &impl)
0098 {
0099 static_compile_impl1(xpr, impl);
0100 }
0101
0102 }}}
0103
0104 #endif