Update of /cvsroot/boost/boost/boost/xpressive/detail/static
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19839/detail/static

Modified Files:
        grammar.hpp is_pure.hpp modifier.hpp placeholders.hpp 
        static.hpp width_of.hpp 
Removed Files:
        as_xpr.hpp regex_operators.hpp 
Log Message:
basic_regex uses proto::extends<>, eliminate regex_operators.hpp and 
as_matcher(), as_xpr() is simply proto::as_expr()

Index: grammar.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/detail/static/grammar.hpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- grammar.hpp 3 Feb 2007 00:14:32 -0000       1.13
+++ grammar.hpp 12 Mar 2007 22:11:29 -0000      1.14
@@ -70,12 +70,7 @@
         {};
 
         template<typename Char>
-        struct is_xpressive_literal_impl<Char, string_placeholder<Char> >
-          : mpl::true_
-        {};
-
-        template<typename Char, typename Not>
-        struct is_xpressive_literal_impl<Char, literal_placeholder<Char, Not> >
+        struct is_xpressive_literal_impl<Char, not_literal_placeholder<Char> >
           : mpl::true_
         {};
 
@@ -164,13 +159,13 @@
           : mpl::true_
         {};
 
-        template<typename Char, typename BidiIter, typename ByRef>
-        struct is_xpressive_terminal<Char, regex_placeholder<BidiIter, ByRef> >
+        template<typename Char, typename BidiIter>
+        struct is_xpressive_terminal<Char, regex_byref_placeholder<BidiIter> >
           : mpl::true_
         {};
 
         template<typename Char, typename BidiIter>
-        struct is_xpressive_terminal<Char, xpressive::basic_regex<BidiIter> >
+        struct is_xpressive_terminal<Char, tracking_ptr<regex_impl<BidiIter> > 
>
           : mpl::true_
         {};
     }
@@ -230,14 +225,14 @@
     template<typename Char>
     struct XpressiveComplementedCharacterLiteral
       : proto::or_<
-            
proto::complement<proto::terminal<detail::literal_placeholder<Char, proto::_> > 
>
-          , 
proto::complement<proto::terminal<detail::literal_placeholder<char, proto::_> > 
>
+            
proto::complement<proto::terminal<detail::not_literal_placeholder<Char> > >
+          , 
proto::complement<proto::terminal<detail::not_literal_placeholder<char> > >
         >
     {};
 
     template<>
     struct XpressiveComplementedCharacterLiteral<char>
-      : proto::complement<proto::terminal<detail::literal_placeholder<char, 
proto::_> > >
+      : 
proto::complement<proto::terminal<detail::not_literal_placeholder<char> > >
     {};
 
     template<typename Char>

Index: is_pure.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/detail/static/is_pure.hpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- is_pure.hpp 3 Feb 2007 00:14:32 -0000       1.13
+++ is_pure.hpp 12 Mar 2007 22:11:29 -0000      1.14
@@ -17,7 +17,6 @@
 #include <boost/mpl/bool.hpp>
 #include <boost/mpl/assert.hpp>
 #include <boost/xpressive/detail/detail_fwd.hpp>
-#include <boost/xpressive/detail/static/as_xpr.hpp>
 #include <boost/xpressive/detail/static/width_of.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -34,6 +33,34 @@
     struct use_simple_repeat;
 
     
///////////////////////////////////////////////////////////////////////////////
+    // is_terminal_pure
+    //
+    template<typename Expr>
+    struct is_terminal_pure
+      : mpl::true_      // char literals
+    {};
+
+    template<typename Expr>
+    struct is_terminal_pure<Expr *>
+      : mpl::true_      // string literals
+    {};
+
+    template<typename Char, std::size_t N>
+    struct is_terminal_pure<Char (&) [N]>
+      : mpl::true_      // string literals
+    {};
+
+    template<typename Char, std::size_t N>
+    struct is_terminal_pure<Char const (&) [N]>
+      : mpl::true_      // string literals
+    {};
+
+    template<typename BidiIter>
+    struct is_terminal_pure<tracking_ptr<regex_impl<BidiIter> > >
+      : mpl::false_     // basic_regex
+    {};
+
+    
///////////////////////////////////////////////////////////////////////////////
     // is_pure
     //
     template<typename Expr, typename Tag = typename Expr::tag_type>
@@ -41,7 +68,7 @@
 
     template<typename Expr>
     struct is_pure<Expr, proto::tag::terminal>
-      : mpl::bool_<as_matcher_type<typename 
proto::result_of::arg<Expr>::type>::type::pure>
+      : is_terminal_pure<typename proto::result_of::arg<Expr>::type>
     {};
 
     template<typename Expr>
@@ -113,9 +140,6 @@
 
     // The subscript operator[] is used for sets, as in set['a' | 
range('b','h')]
     // It is also used for actions, which by definition have side-effects and 
thus are impure
-
-    // The subscript operator[] is used for sets, as in set['a' | 
range('b','h')],
-    // or for actions as in (any >> expr)[ action ]
     template<typename Expr, typename Left>
     struct is_pure_subscript
       : mpl::false_
@@ -160,38 +184,49 @@
       : is_pure<typename proto::result_of::arg<Expr>::type>
     {};
 
-    // simple_repeat_helper
-    template<bool B, quant_enum Q>
-    struct use_simple_repeat_helper
-      : mpl::false_
+    
///////////////////////////////////////////////////////////////////////////////
+    // use_simple_repeat_terminal
+    //
+    template<typename Char>
+    struct use_simple_repeat_terminal
+      : mpl::true_      // char literals
     {};
 
-    template<>
-    struct use_simple_repeat_helper<true, quant_fixed_width>
-      : mpl::true_
+    template<typename Char>
+    struct use_simple_repeat_terminal<Char *>
+      : mpl::true_      // string literals
+    {};
+
+    template<typename Char, std::size_t N>
+    struct use_simple_repeat_terminal<Char (&) [N]>
+      : mpl::true_      // string literals
+    {};
+
+    template<typename Char, std::size_t N>
+    struct use_simple_repeat_terminal<Char const (&) [N]>
+      : mpl::true_      // string literals
+    {};
+
+    template<typename BidiIter>
+    struct use_simple_repeat_terminal<tracking_ptr<regex_impl<BidiIter> > >
+      : mpl::false_     // basic_regex
     {};
 
     
///////////////////////////////////////////////////////////////////////////////
     // use_simple_repeat
-    //  TODO this doesn't optimize +(_ >> "hello")
+    //
     template<typename Expr, typename Tag>
     struct use_simple_repeat
       : mpl::bool_<width_of<Expr>::value != unknown_width::value && 
is_pure<Expr>::value>
     {
         // should never try to repeat something of 0-width
-        //BOOST_MPL_ASSERT_RELATION(0, !=, width_of<Expr>::value);
-        BOOST_STATIC_ASSERT(0 != width_of<Expr>::value);
+        BOOST_MPL_ASSERT_RELATION(0, !=, width_of<Expr>::value);
     };
 
     template<typename Expr>
     struct use_simple_repeat<Expr, proto::tag::terminal>
-      : use_simple_repeat_helper<
-            as_matcher_type<typename 
proto::result_of::arg<Expr>::type>::type::pure
-          , as_matcher_type<typename 
proto::result_of::arg<Expr>::type>::type::quant
-        >
+      : use_simple_repeat_terminal<typename proto::result_of::arg<Expr>::type>
     {
-        //BOOST_MPL_ASSERT_RELATION(0, !=, as_matcher_type<typename 
proto::result_of::arg<Expr>::type>::type::width);
-        BOOST_STATIC_ASSERT(0 != as_matcher_type<typename 
proto::result_of::arg<Expr>::type>::type::width);
     };
 
 }}} // namespace boost::xpressive::detail

Index: modifier.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/detail/static/modifier.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- modifier.hpp        3 Feb 2007 00:14:32 -0000       1.7
+++ modifier.hpp        12 Mar 2007 22:11:29 -0000      1.8
@@ -17,8 +17,8 @@
 #endif
 
 #include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/proto/traits.hpp>
 #include <boost/xpressive/regex_constants.hpp>
-#include <boost/xpressive/detail/static/as_xpr.hpp>
 
 namespace boost { namespace xpressive { namespace detail
 {
@@ -36,7 +36,7 @@
             typedef typename proto::binary_expr<
                 modifier_tag
               , typename proto::terminal<Modifier>::type
-              , typename as_xpr_type<Xpr>::type
+              , typename proto::result_of::as_expr<Xpr>::type
             >::type type;
         };
 
@@ -44,7 +44,7 @@
         typename apply<Xpr>::type const
         operator ()(Xpr const &xpr) const
         {
-            typename apply<Xpr>::type that = {{this->mod_}, as_xpr(xpr)};
+            typename apply<Xpr>::type that = {{this->mod_}, 
proto::as_expr(xpr)};
             return that;
         }
 

Index: placeholders.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/detail/static/placeholders.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- placeholders.hpp    13 Nov 2006 15:53:45 -0000      1.5
+++ placeholders.hpp    12 Mar 2007 22:11:29 -0000      1.6
@@ -22,29 +22,17 @@
 {
 
 ///////////////////////////////////////////////////////////////////////////////
-// literal_placeholder
+// not_literal_placeholder
 //
-template<typename Char, typename Not>
-struct literal_placeholder
+template<typename Char>
+struct not_literal_placeholder
 {
     BOOST_XPR_QUANT_STYLE(quant_fixed_width, 1, true)
 
-    typedef Not not_type;
     Char ch_;
 };
 
 ///////////////////////////////////////////////////////////////////////////////
-// string_placeholder
-//
-template<typename Char>
-struct string_placeholder
-{
-    BOOST_XPR_QUANT_STYLE(quant_fixed_width, unknown_width::value, true)
-
-    std::basic_string<Char> str_;
-};
-
-///////////////////////////////////////////////////////////////////////////////
 // mark_placeholder
 //
 struct mark_placeholder
@@ -55,16 +43,16 @@
 };
 
 ///////////////////////////////////////////////////////////////////////////////
-// regex_placeholder
+// regex_byref_placeholder
 //
-template<typename BidiIter, typename ByRef>
-struct regex_placeholder
+template<typename BidiIter>
+struct regex_byref_placeholder
 {
     BOOST_XPR_QUANT_STYLE(quant_variable_width, unknown_width::value, false)
 
     shared_ptr<regex_impl<BidiIter> > impl_;
 
-    regex_placeholder(shared_ptr<regex_impl<BidiIter> > const &impl)
+    regex_byref_placeholder(shared_ptr<regex_impl<BidiIter> > const &impl)
       : impl_(impl)
     {
     }

Index: static.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/detail/static/static.hpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- static.hpp  21 Dec 2006 03:51:41 -0000      1.13
+++ static.hpp  12 Mar 2007 22:11:29 -0000      1.14
@@ -18,6 +18,7 @@
 #include <boost/xpressive/detail/core/state.hpp>
 #include <boost/xpressive/detail/core/linker.hpp>
 #include <boost/xpressive/detail/core/peeker.hpp>
+#include <boost/xpressive/detail/static/placeholders.hpp>
 #include <boost/xpressive/detail/utility/width.hpp>
 
 // Random thoughts:

Index: width_of.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/detail/static/width_of.hpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- width_of.hpp        3 Feb 2007 00:14:32 -0000       1.13
+++ width_of.hpp        12 Mar 2007 22:11:29 -0000      1.14
@@ -17,7 +17,7 @@
 #include <boost/mpl/size_t.hpp>
 #include <boost/type_traits/is_same.hpp>
 #include <boost/xpressive/detail/detail_fwd.hpp>
-#include <boost/xpressive/detail/static/as_xpr.hpp>
+#include <boost/xpressive/proto/traits.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////
 // add widths
@@ -51,6 +51,35 @@
 
 namespace boost { namespace xpressive { namespace detail
 {
+
+    
///////////////////////////////////////////////////////////////////////////////
+    // width_of_terminal
+    //
+    template<typename Expr>
+    struct width_of_terminal
+      : mpl::size_t<1>      // char literals
+    {};
+
+    template<typename Expr>
+    struct width_of_terminal<Expr *>
+      : unknown_width       // string literals
+    {};
+
+    template<typename Char, std::size_t N>
+    struct width_of_terminal<Char (&) [N]>
+      : mpl::size_t<N-1>    // string literals
+    {};
+
+    template<typename Char, std::size_t N>
+    struct width_of_terminal<Char const (&) [N]>
+      : mpl::size_t<N-1>    // string literals
+    {};
+
+    template<typename BidiIter>
+    struct width_of_terminal<tracking_ptr<regex_impl<BidiIter> > >
+      : unknown_width       // basic_regex
+    {};
+
     
///////////////////////////////////////////////////////////////////////////////
     // width_of
     //
@@ -59,7 +88,7 @@
 
     template<typename Expr>
     struct width_of<Expr, proto::tag::terminal>
-      : mpl::size_t<as_matcher_type<typename 
proto::result_of::arg<Expr>::type>::type::width>
+      : width_of_terminal<typename proto::result_of::arg<Expr>::type>
     {};
 
     template<typename Expr>

--- as_xpr.hpp DELETED ---

--- regex_operators.hpp DELETED ---


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to