Boost logo

Boost-Commit :

From: eric_at_[hidden]
Date: 2007-11-29 17:16:09


Author: eric_niebler
Date: 2007-11-29 17:16:08 EST (Thu, 29 Nov 2007)
New Revision: 41476
URL: http://svn.boost.org/trac/boost/changeset/41476

Log:
support ~range('a','z')
Text files modified:
   branches/proto/v3/boost/xpressive/detail/core/matcher/range_matcher.hpp | 11 ++++++-----
   branches/proto/v3/boost/xpressive/detail/core/peeker.hpp | 4 ++--
   branches/proto/v3/boost/xpressive/detail/detail_fwd.hpp | 2 +-
   branches/proto/v3/boost/xpressive/detail/static/grammar2.hpp | 5 +++++
   branches/proto/v3/boost/xpressive/detail/static/placeholders.hpp | 1 -
   branches/proto/v3/boost/xpressive/detail/static/transforms/as_set.hpp | 2 +-
   branches/proto/v3/boost/xpressive/detail/static/transmogrify.hpp | 4 ++--
   branches/proto/v3/boost/xpressive/regex_primitives.hpp | 2 +-
   branches/proto/v3/boost/xpressive/xpressive_typeof.hpp | 2 +-
   9 files changed, 19 insertions(+), 14 deletions(-)

Modified: branches/proto/v3/boost/xpressive/detail/core/matcher/range_matcher.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/core/matcher/range_matcher.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/core/matcher/range_matcher.hpp 2007-11-29 17:16:08 EST (Thu, 29 Nov 2007)
@@ -19,6 +19,7 @@
 #include <boost/xpressive/detail/detail_fwd.hpp>
 #include <boost/xpressive/detail/core/quant_style.hpp>
 #include <boost/xpressive/detail/core/state.hpp>
+#include <boost/xpressive/detail/static/placeholders.hpp>
 
 namespace boost { namespace xpressive { namespace detail
 {
@@ -26,19 +27,19 @@
     ///////////////////////////////////////////////////////////////////////////////
     // range_matcher
     //
- template<typename Traits, bool ICase>
+ template<typename Traits, typename ICase>
     struct range_matcher
       : quant_style_fixed_width<1>
     {
         typedef typename Traits::char_type char_type;
- typedef mpl::bool_<ICase> icase_type;
+ typedef ICase icase_type;
         char_type ch_min_;
         char_type ch_max_;
         bool not_;
 
- range_matcher(char_type ch_min, char_type ch_max, bool no, Traits const &)
- : ch_min_(ch_min)
- , ch_max_(ch_max)
+ range_matcher(range_placeholder<char_type> const &rng, bool no)
+ : ch_min_(rng.ch_min_)
+ , ch_max_(rng.ch_max_)
           , not_(no)
         {
         }

Modified: branches/proto/v3/boost/xpressive/detail/core/peeker.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/core/peeker.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/core/peeker.hpp 2007-11-29 17:16:08 EST (Thu, 29 Nov 2007)
@@ -218,10 +218,10 @@
         return mpl::false_();
     }
 
- template<typename Traits, bool ICase>
+ template<typename Traits, typename ICase>
     mpl::false_ accept(range_matcher<Traits, ICase> const &xpr)
     {
- this->bset_.set_range(xpr.ch_min_, xpr.ch_max_, xpr.not_, ICase, this->get_traits_<Traits>());
+ this->bset_.set_range(xpr.ch_min_, xpr.ch_max_, xpr.not_, ICase::value, this->get_traits_<Traits>());
         return mpl::false_();
     }
 

Modified: branches/proto/v3/boost/xpressive/detail/detail_fwd.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/detail_fwd.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/detail_fwd.hpp 2007-11-29 17:16:08 EST (Thu, 29 Nov 2007)
@@ -114,7 +114,7 @@
     template<typename Traits, bool ICase, typename CharSet = compound_charset<Traits> >
     struct charset_matcher;
 
- template<typename Traits, bool ICase>
+ template<typename Traits, typename ICase>
     struct range_matcher;
 
     template<typename Traits, typename Size>

Modified: branches/proto/v3/boost/xpressive/detail/static/grammar2.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/static/grammar2.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/static/grammar2.hpp 2007-11-29 17:16:08 EST (Thu, 29 Nov 2007)
@@ -637,6 +637,11 @@
                         complement<terminal<posix_charset_placeholder> >
                       , as_posix_charset(_arg(_arg), _visitor, false_())
>
+ // ~range('a','z')
+ , when<
+ complement<terminal<range_placeholder<_> > >
+ , range_matcher<traits(_visitor), icase<_visitor> >(_arg(_arg), true_())
+ >
                     // ~before(...)
                   , when<
                         complement<unary_expr<lookahead_tag, Gram> >

Modified: branches/proto/v3/boost/xpressive/detail/static/placeholders.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/static/placeholders.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/static/placeholders.hpp 2007-11-29 17:16:08 EST (Thu, 29 Nov 2007)
@@ -64,7 +64,6 @@
 
     Char ch_min_;
     Char ch_max_;
- bool not_;
 };
 
 ///////////////////////////////////////////////////////////////////////////////

Modified: branches/proto/v3/boost/xpressive/detail/static/transforms/as_set.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/static/transforms/as_set.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/static/transforms/as_set.hpp 2007-11-29 17:16:08 EST (Thu, 29 Nov 2007)
@@ -204,7 +204,7 @@
             set_char(this->charset_.charset_, ch.ch_, this->visitor_.traits(), icase_type());
         }
 
- void set(range_matcher<traits_type, icase_type::value> const &rg) const
+ void set(range_matcher<traits_type, icase_type> const &rg) const
         {
             // BUGBUG fixme!
             BOOST_ASSERT(!rg.not_);

Modified: branches/proto/v3/boost/xpressive/detail/static/transmogrify.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/static/transmogrify.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/static/transmogrify.hpp 2007-11-29 17:16:08 EST (Thu, 29 Nov 2007)
@@ -128,12 +128,12 @@
         // By design, we don't widen character ranges.
         typedef typename iterator_value<BidiIter>::type char_type;
         BOOST_MPL_ASSERT((is_same<Char, char_type>));
- typedef range_matcher<Traits, ICase::value> type;
+ typedef range_matcher<Traits, ICase> type;
 
         template<typename Matcher2, typename Visitor>
         static type call(Matcher2 const &m, Visitor &visitor)
         {
- return type(m.ch_min_, m.ch_max_, m.not_, visitor.traits());
+ return type(m, false);
         }
     };
 

Modified: branches/proto/v3/boost/xpressive/regex_primitives.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/regex_primitives.hpp (original)
+++ branches/proto/v3/boost/xpressive/regex_primitives.hpp 2007-11-29 17:16:08 EST (Thu, 29 Nov 2007)
@@ -492,7 +492,7 @@
 inline typename proto::terminal<detail::range_placeholder<Char> >::type const
 range(Char ch_min, Char ch_max)
 {
- detail::range_placeholder<Char> that = {{ch_min, ch_max, false}};
+ detail::range_placeholder<Char> that = {ch_min, ch_max};
     return proto::terminal<detail::range_placeholder<Char> >::type::make(that);
 }
 

Modified: branches/proto/v3/boost/xpressive/xpressive_typeof.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/xpressive_typeof.hpp (original)
+++ branches/proto/v3/boost/xpressive/xpressive_typeof.hpp 2007-11-29 17:16:08 EST (Thu, 29 Nov 2007)
@@ -94,7 +94,7 @@
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::regex_matcher, (typename))
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::posix_charset_matcher, (typename))
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::assert_word_matcher, (typename)(typename))
-BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::range_matcher, (typename)(bool))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::range_matcher, (typename)(typename))
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::keeper_matcher, (typename))
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::lookahead_matcher, (typename))
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::lookbehind_matcher, (typename))


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk