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

Modified Files:
        as_modifier.hpp transform.hpp 
Log Message:
xpressive transforms use new proto::switch_ for better compile times

Index: as_modifier.hpp
===================================================================
RCS file: 
/cvsroot/boost/boost/boost/xpressive/detail/static/transforms/as_modifier.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- as_modifier.hpp     6 Apr 2007 02:07:10 -0000       1.2
+++ as_modifier.hpp     6 Apr 2007 23:59:10 -0000       1.3
@@ -20,6 +20,8 @@
 #include <boost/xpressive/proto/context.hpp>
 #include <boost/xpressive/proto/transform/arg.hpp>
 
+#include <boost/xpressive/detail/static/productions/modify_compiler.hpp>
+
 namespace boost { namespace xpressive { namespace detail
 {
 

Index: transform.hpp
===================================================================
RCS file: 
/cvsroot/boost/boost/boost/xpressive/detail/static/transforms/transform.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- transform.hpp       6 Apr 2007 21:03:08 -0000       1.10
+++ transform.hpp       6 Apr 2007 23:59:10 -0000       1.11
@@ -32,124 +32,239 @@
 
 namespace boost { namespace xpressive { namespace detail
 {
-    template<typename Tag>
-    struct is_generic_quant_tag
-      : mpl::false_
+    struct Grammar;
+
+    ///////////////////////////////////////////////////////////////////////////
+    // ListSet
+    struct ListSet
+      : proto::or_<
+            proto::comma<ListSet, proto::terminal<char> >
+          , proto::assign<set_initializer_type, proto::terminal<char> >
+        >
     {};
 
-    template<unsigned Min, unsigned Max>
-    struct is_generic_quant_tag<generic_quant_tag<Min, Max> >
-      : mpl::true_
+    ///////////////////////////////////////////////////////////////////////////
+    // NonGreedyRepeatCases
+    struct NonGreedyRepeatCases
+    {
+        template<typename Tag>
+        struct case_
+          : proto::not_<proto::_>
+        {};
+    };
+
+    template<>
+    struct NonGreedyRepeatCases::case_<proto::tag::unary_star>
+      : proto::trans::conditional<
+            use_simple_repeat<proto::result_of::arg<mpl::_> >
+          , as_simple_quantifier<proto::trans::arg<proto::unary_star<Grammar> 
>, false>
+          , as_default_quantifier<proto::unary_star<Grammar>, false>
+        >
     {};
 
-    struct Grammar;
+    template<>
+    struct NonGreedyRepeatCases::case_<proto::tag::unary_plus>
+      : proto::trans::conditional<
+            use_simple_repeat<proto::result_of::arg<mpl::_> >
+          , as_simple_quantifier<proto::trans::arg<proto::unary_plus<Grammar> 
>, false>
+          , as_default_quantifier<proto::unary_plus<Grammar>, false>
+        >
+    {};
 
-    struct Sequence
-      : proto::right_shift<Grammar, Grammar>
+    template<>
+    struct NonGreedyRepeatCases::case_<proto::tag::logical_not>
+      : proto::trans::conditional<
+            use_simple_repeat<proto::result_of::arg<mpl::_> >
+          , as_simple_quantifier<proto::trans::arg<proto::logical_not<Grammar> 
>, false>
+          , as_default_quantifier<proto::logical_not<Grammar>, false>
+        >
     {};
 
-    struct Alternate
-      : proto::bitwise_or< Grammar, Grammar >
+    template<uint_t Min, uint_t Max>
+    struct NonGreedyRepeatCases::case_<generic_quant_tag<Min, Max> >
+      : proto::trans::conditional<
+            use_simple_repeat<proto::result_of::arg<mpl::_> >
+          , 
as_simple_quantifier<proto::trans::arg<proto::unary_expr<generic_quant_tag<Min, 
Max>, Grammar> >, false>
+          , as_default_quantifier<proto::unary_expr<generic_quant_tag<Min, 
Max>, Grammar>, false>
+        >
     {};
 
-    struct Terminal
-      : proto::terminal< proto::_ >
+    ///////////////////////////////////////////////////////////////////////////
+    // InvertibleCases
+    struct InvertibleCases
+    {
+        template<typename Tag>
+        struct case_
+          : proto::not_<proto::_>
+        {};
+    };
+
+    template<>
+    struct InvertibleCases::case_<proto::tag::comma>
+      : as_list_set<ListSet>
     {};
 
-    struct Mark
-      : proto::assign<basic_mark_tag, Grammar>
+    template<>
+    struct InvertibleCases::case_<proto::tag::assign>
+      : as_list_set<ListSet>
     {};
 
-    struct GreedyQuantifier
+    template<>
+    struct InvertibleCases::case_<proto::tag::subscript>
+      : proto::trans::right<proto::subscript<set_initializer_type, 
as_set<Grammar> > >
+    {};
+
+    template<>
+    struct InvertibleCases::case_<lookahead_tag<true> >
+      : proto::trans::arg<proto::unary_expr<lookahead_tag<true>, 
as_lookahead<Grammar> > >
+    {};
+
+    template<>
+    struct InvertibleCases::case_<lookbehind_tag<true> >
+      : proto::trans::arg<proto::unary_expr<lookbehind_tag<true>, 
as_lookbehind<Grammar> > >
+    {};
+
+    template<>
+    struct InvertibleCases::case_<proto::tag::terminal>
       : proto::or_<
-            proto::unary_plus<Grammar>
-          , proto::unary_star<Grammar>
-          , proto::logical_not<Grammar>
-          , proto::and_<
-                proto::if_<is_generic_quant_tag<proto::tag_of<mpl::_> > >
-              , proto::unary_expr<proto::_, Grammar>
-            >
+            as_matcher<proto::terminal<posix_charset_placeholder> >
+          , as_matcher<proto::terminal<range_placeholder<proto::_> > >
+          , as_matcher<proto::terminal<char> >
         >
     {};
 
-    typedef use_simple_repeat<proto::result_of::arg<mpl::_> > UseSimpleRepeat;
+    ///////////////////////////////////////////////////////////////////////////
+    // Cases
+    struct Cases
+    {
+        template<typename Tag>
+        struct case_
+          : proto::not_<proto::_>
+        {};
+    };
 
-    struct SimpleGreedyQuantifier
-      : proto::and_<
-            GreedyQuantifier
-          , proto::if_<UseSimpleRepeat>
-          , proto::trans::arg<GreedyQuantifier>
+    template<>
+    struct Cases::case_<proto::tag::right_shift>
+      : proto::trans::reverse_fold<proto::right_shift<Grammar, Grammar> >
+    {};
+
+    template<>
+    struct Cases::case_<proto::tag::terminal>
+      : in_sequence<as_matcher<proto::terminal<proto::_> > >
+    {};
+
+    template<>
+    struct Cases::case_<proto::tag::bitwise_or>
+      : in_sequence<as_alternate<proto::bitwise_or<Grammar, Grammar> > >
+    {};
+
+    template<bool Greedy>
+    struct Cases::case_<optional_tag<Greedy> >
+      : in_sequence<proto::trans::arg<proto::unary_expr<optional_tag<Greedy>, 
as_optional<Grammar, Greedy> > > >
+    {};
+
+    template<>
+    struct Cases::case_<proto::tag::unary_star>
+      : proto::trans::conditional<
+            use_simple_repeat<proto::result_of::arg<mpl::_> >
+          , 
in_sequence<as_simple_quantifier<proto::trans::arg<proto::unary_star<Grammar> 
>, true> >
+          , 
proto::trans::compose<as_default_quantifier<proto::unary_star<Grammar>, true>, 
Grammar>
         >
     {};
 
-    struct DefaultGreedyQuantifier
-      : proto::and_<
-            GreedyQuantifier
-          , proto::if_<mpl::not_<UseSimpleRepeat> >
+    template<>
+    struct Cases::case_<proto::tag::unary_plus>
+      : proto::trans::conditional<
+            use_simple_repeat<proto::result_of::arg<mpl::_> >
+          , 
in_sequence<as_simple_quantifier<proto::trans::arg<proto::unary_plus<Grammar> 
>, true> >
+          , 
proto::trans::compose<as_default_quantifier<proto::unary_plus<Grammar>, true>, 
Grammar>
         >
     {};
 
-    struct ListSet
-      : proto::or_<
-            proto::comma<ListSet, proto::terminal<char> >
-          , proto::assign<set_initializer_type, proto::terminal<char> >
+    template<>
+    struct Cases::case_<proto::tag::logical_not>
+      : proto::trans::conditional<
+            use_simple_repeat<proto::result_of::arg<mpl::_> >
+          , 
in_sequence<as_simple_quantifier<proto::trans::arg<proto::logical_not<Grammar> 
>, true> >
+          , 
proto::trans::compose<as_default_quantifier<proto::logical_not<Grammar>, true>, 
Grammar>
         >
     {};
 
-    struct InvertibleMatcher
-      : proto::or_<
-            as_list_set<ListSet>
-          , proto::trans::right<proto::subscript<set_initializer_type, 
as_set<Grammar> > >
-          , proto::trans::arg<proto::unary_expr<lookahead_tag<true>, 
as_lookahead<Grammar> > >
-          , proto::trans::arg<proto::unary_expr<lookbehind_tag<true>, 
as_lookbehind<Grammar> > >
-          , as_matcher<proto::terminal<posix_charset_placeholder> >
-          , as_matcher<proto::terminal<range_placeholder<proto::_> > >
-          , as_matcher<proto::terminal<char> >
+    template<uint_t Min, uint_t Max>
+    struct Cases::case_<generic_quant_tag<Min, Max> >
+      : proto::trans::conditional<
+            use_simple_repeat<proto::result_of::arg<mpl::_> >
+          , 
in_sequence<as_simple_quantifier<proto::trans::arg<proto::unary_expr<generic_quant_tag<Min,
 Max>, Grammar> >, true> >
+          , 
proto::trans::compose<as_default_quantifier<proto::unary_expr<generic_quant_tag<Min,
 Max>, Grammar>, true>, Grammar>
         >
     {};
 
-    // These sub-expressions generate simple matcher types
-    // that must be placed in sequence.
-    struct Matchers
-      : proto::or_<
-            as_matcher<Terminal>
-          , as_alternate<Alternate>
+    template<>
+    struct Cases::case_<proto::tag::unary_minus>
+      : proto::and_<
+            proto::unary_minus<proto::switch_<NonGreedyRepeatCases> >
+          , proto::trans::conditional<
+                
use_simple_repeat<proto::result_of::arg<proto::result_of::arg<mpl::_> > >
+              , 
in_sequence<proto::trans::arg<proto::unary_minus<proto::switch_<NonGreedyRepeatCases>
 > > >
+              , 
proto::trans::compose<proto::trans::arg<proto::unary_minus<proto::switch_<NonGreedyRepeatCases>
 > >, Grammar>
+            >
+        >
+    {};
 
-          , as_simple_quantifier<SimpleGreedyQuantifier, true>
-          , 
proto::trans::arg<proto::unary_minus<as_simple_quantifier<SimpleGreedyQuantifier,
 false> > >
+    template<>
+    struct Cases::case_<proto::tag::complement>
+      : 
in_sequence<as_inverse<proto::trans::arg<proto::complement<proto::switch_<InvertibleCases>
 > > > >
+    {};
 
-          , InvertibleMatcher
-          , as_inverse<proto::trans::arg<proto::complement<InvertibleMatcher> 
> >
+    template<>
+    struct Cases::case_<modifier_tag>
+      : as_modifier<proto::binary_expr<modifier_tag, proto::_, Grammar> >
+    {};
 
-          , proto::trans::arg<proto::unary_expr<keeper_tag, as_keeper<Grammar> 
> >
+    template<>
+    struct Cases::case_<lookahead_tag<true> >
+      : in_sequence<proto::trans::arg<proto::unary_expr<lookahead_tag<true>, 
as_lookahead<Grammar> > > >
+    {};
 
-          , proto::or_<
-                proto::trans::arg<proto::unary_expr<optional_tag<true>, 
as_optional<Grammar, true> > >
-              , proto::trans::arg<proto::unary_expr<optional_tag<false>, 
as_optional<Grammar, false> > >
-            >
-        >
+    template<>
+    struct Cases::case_<lookbehind_tag<true> >
+      : in_sequence<proto::trans::arg<proto::unary_expr<lookbehind_tag<true>, 
as_lookbehind<Grammar> > > >
     {};
 
-    // These sub-expressions require further processing.
-    struct Composites
-      : proto::or_<
-            as_default_quantifier<DefaultGreedyQuantifier, true>
-          , 
proto::trans::arg<proto::unary_minus<as_default_quantifier<DefaultGreedyQuantifier,
 false> > >
+    template<>
+    struct Cases::case_<keeper_tag>
+      : in_sequence<proto::trans::arg<proto::unary_expr<keeper_tag, 
as_keeper<Grammar> > > >
+    {};
 
-          , as_marker<Mark>
-          , as_action<proto::subscript<Grammar, proto::_> >
+    template<>
+    struct Cases::case_<proto::tag::comma>
+      : in_sequence<as_list_set<ListSet> >
+    {};
+
+    template<>
+    struct Cases::case_<proto::tag::assign>
+      : proto::or_<
+            proto::trans::compose<as_marker<proto::assign<basic_mark_tag, 
Grammar> >, Grammar>
+          , in_sequence<as_list_set<ListSet> >
         >
     {};
 
-    struct Grammar
+    template<>
+    struct Cases::case_<proto::tag::subscript>
       : proto::or_<
-            proto::trans::reverse_fold<Sequence>
-          , in_sequence<Matchers>
-          , proto::trans::compose<Composites, Grammar>
-          , as_modifier<proto::binary_expr<modifier_tag, proto::_, Grammar> >
+            
in_sequence<proto::trans::right<proto::subscript<set_initializer_type, 
as_set<Grammar> > > >
+          , proto::trans::compose<as_action<proto::subscript<Grammar, 
proto::_> >, Grammar>
         >
     {};
 
+    ///////////////////////////////////////////////////////////////////////////
+    // Grammar
+    struct Grammar
+      : proto::switch_<Cases>
+    {};
+
+    ///////////////////////////////////////////////////////////////////////////
+    // transform()
     template<typename Expr, typename Visitor>
     typename Grammar::apply<Expr, end_xpression, Visitor>::type
     transform(Expr const &expr, Visitor &visitor)


-------------------------------------------------------------------------
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