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

Modified Files:
        grammar.hpp 
Log Message:
attribute assignments are only allowed when actions are attached

Index: grammar.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/detail/static/grammar.hpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- grammar.hpp 19 Jun 2007 06:03:25 -0000      1.25
+++ grammar.hpp 22 Jun 2007 00:37:08 -0000      1.26
@@ -58,6 +58,9 @@
     template<typename Char>
     struct Grammar;
 
+    template<typename Char>
+    struct ActionableGrammar;
+
     namespace detail
     {
         
///////////////////////////////////////////////////////////////////////////
@@ -72,18 +75,18 @@
 
         
///////////////////////////////////////////////////////////////////////////
         // as_repeat
-        template<typename Char, typename Tag, bool Greedy>
+        template<typename Char, typename Gram, typename Tag, bool Greedy>
         struct as_repeat
           : proto::if_<
                 use_simple_repeat<proto::result_of::arg<mpl::_>, Char>
-              , as_simple_quantifier<proto::unary_expr<Tag, Grammar<Char> >, 
Greedy>
-              , as_default_quantifier<proto::unary_expr<Tag, Grammar<Char> >, 
Greedy>
+              , as_simple_quantifier<proto::unary_expr<Tag, Gram>, Greedy>
+              , as_default_quantifier<proto::unary_expr<Tag, Gram>, Greedy>
             >
         {};
 
         
///////////////////////////////////////////////////////////////////////////
         // NonGreedyRepeatCases
-        template<typename Char>
+        template<typename Char, typename Gram>
         struct NonGreedyRepeatCases
         {
             template<typename Tag, typename Dummy = void>
@@ -93,28 +96,28 @@
 
             template<typename Dummy>
             struct case_<proto::tag::dereference, Dummy>
-              : as_repeat<Char, proto::tag::dereference, false>
+              : as_repeat<Char, Gram, proto::tag::dereference, false>
             {};
 
             template<typename Dummy>
             struct case_<proto::tag::posit, Dummy>
-              : as_repeat<Char, proto::tag::posit, false>
+              : as_repeat<Char, Gram, proto::tag::posit, false>
             {};
 
             template<typename Dummy>
             struct case_<proto::tag::logical_not, Dummy>
-              : as_repeat<Char, proto::tag::logical_not, false>
+              : as_repeat<Char, Gram, proto::tag::logical_not, false>
             {};
 
             template<uint_t Min, uint_t Max, typename Dummy>
             struct case_<generic_quant_tag<Min, Max>, Dummy>
-              : as_repeat<Char, generic_quant_tag<Min, Max>, false>
+              : as_repeat<Char, Gram, generic_quant_tag<Min, Max>, false>
             {};
         };
 
         
///////////////////////////////////////////////////////////////////////////
         // InvertibleCases
-        template<typename Char>
+        template<typename Char, typename Gram>
         struct InvertibleCases
         {
             template<typename Tag, typename Dummy = void>
@@ -134,17 +137,17 @@
 
             template<typename Dummy>
             struct case_<proto::tag::subscript, Dummy>
-              : proto::transform::right<proto::subscript<set_initializer_type, 
as_set<Grammar<Char> > > >
+              : proto::transform::right<proto::subscript<set_initializer_type, 
as_set<Gram> > >
             {};
 
             template<typename Dummy>
             struct case_<lookahead_tag, Dummy>
-              : proto::transform::arg<proto::unary_expr<lookahead_tag, 
as_lookahead<Grammar<Char> > > >
+              : proto::transform::arg<proto::unary_expr<lookahead_tag, 
as_lookahead<Gram> > >
             {};
 
             template<typename Dummy>
             struct case_<lookbehind_tag, Dummy>
-              : proto::transform::arg<proto::unary_expr<lookbehind_tag, 
as_lookbehind<Grammar<Char> > > >
+              : proto::transform::arg<proto::unary_expr<lookbehind_tag, 
as_lookbehind<Gram> > >
             {};
 
             template<typename Dummy>
@@ -161,7 +164,7 @@
 
         
///////////////////////////////////////////////////////////////////////////
         // Cases
-        template<typename Char>
+        template<typename Char, typename Gram>
         struct Cases
         {
             template<typename Tag, typename Dummy = void>
@@ -171,7 +174,7 @@
 
             template<typename Dummy>
             struct case_<proto::tag::shift_right, Dummy>
-              : 
proto::transform::reverse_fold<proto::shift_right<Grammar<Char>, Grammar<Char> 
> >
+              : proto::transform::reverse_fold<proto::shift_right<Gram, Gram> >
             {};
 
             template<typename Dummy>
@@ -181,67 +184,67 @@
 
             template<typename Dummy>
             struct case_<proto::tag::bitwise_or, Dummy>
-              : in_sequence<as_alternate<proto::bitwise_or<Grammar<Char>, 
Grammar<Char> > > >
+              : in_sequence<as_alternate<proto::bitwise_or<Gram, Gram> > >
             {};
 
             template<typename Dummy, bool Greedy>
             struct case_<optional_tag<Greedy> , Dummy>
-              : 
in_sequence<proto::transform::arg<proto::unary_expr<optional_tag<Greedy>, 
as_optional<Grammar<Char>, Greedy> > > >
+              : 
in_sequence<proto::transform::arg<proto::unary_expr<optional_tag<Greedy>, 
as_optional<Gram, Greedy> > > >
             {};
 
             template<typename Dummy>
             struct case_<proto::tag::dereference, Dummy>
-              : proto::transform::compose<as_repeat<Char, 
proto::tag::dereference, true>, Grammar<Char> >
+              : proto::transform::compose<as_repeat<Char, Gram, 
proto::tag::dereference, true>, Gram>
             {};
 
             template<typename Dummy>
             struct case_<proto::tag::posit, Dummy>
-              : proto::transform::compose<as_repeat<Char, proto::tag::posit, 
true>, Grammar<Char> >
+              : proto::transform::compose<as_repeat<Char, Gram, 
proto::tag::posit, true>, Gram>
             {};
 
             template<typename Dummy>
             struct case_<proto::tag::logical_not, Dummy>
-              : proto::transform::compose<as_repeat<Char, 
proto::tag::logical_not, true>, Grammar<Char> >
+              : proto::transform::compose<as_repeat<Char, Gram, 
proto::tag::logical_not, true>, Gram>
             {};
 
             template<uint_t Min, uint_t Max, typename Dummy>
             struct case_<generic_quant_tag<Min, Max> , Dummy>
-              : proto::transform::compose<as_repeat<Char, 
generic_quant_tag<Min, Max>, true>, Grammar<Char> >
+              : proto::transform::compose<as_repeat<Char, Gram, 
generic_quant_tag<Min, Max>, true>, Gram>
             {};
 
             template<typename Dummy>
             struct case_<proto::tag::negate, Dummy>
               : proto::transform::compose<
-                    
proto::transform::arg<proto::negate<proto::switch_<NonGreedyRepeatCases<Char> > 
> >
-                  , Grammar<Char>
+                    
proto::transform::arg<proto::negate<proto::switch_<NonGreedyRepeatCases<Char, 
Gram> > > >
+                  , Gram
                 >
             {};
 
             template<typename Dummy>
             struct case_<proto::tag::complement, Dummy>
               : in_sequence<as_inverse<
-                    
proto::transform::arg<proto::complement<proto::switch_<InvertibleCases<Char> > 
> >
+                    
proto::transform::arg<proto::complement<proto::switch_<InvertibleCases<Char, 
Gram> > > >
                 > >
             {};
 
             template<typename Dummy>
             struct case_<modifier_tag, Dummy>
-              : as_modifier<proto::binary_expr<modifier_tag, proto::_, 
Grammar<Char> > >
+              : as_modifier<proto::binary_expr<modifier_tag, proto::_, Gram> >
             {};
 
             template<typename Dummy>
             struct case_<lookahead_tag, Dummy>
-              : 
in_sequence<proto::transform::arg<proto::unary_expr<lookahead_tag, 
as_lookahead<Grammar<Char> > > > >
+              : 
in_sequence<proto::transform::arg<proto::unary_expr<lookahead_tag, 
as_lookahead<Gram> > > >
             {};
 
             template<typename Dummy>
             struct case_<lookbehind_tag, Dummy>
-              : 
in_sequence<proto::transform::arg<proto::unary_expr<lookbehind_tag, 
as_lookbehind<Grammar<Char> > > > >
+              : 
in_sequence<proto::transform::arg<proto::unary_expr<lookbehind_tag, 
as_lookbehind<Gram> > > >
             {};
 
             template<typename Dummy>
             struct case_<keeper_tag, Dummy>
-              : 
in_sequence<proto::transform::arg<proto::unary_expr<keeper_tag, 
as_keeper<Grammar<Char> > > > >
+              : 
in_sequence<proto::transform::arg<proto::unary_expr<keeper_tag, as_keeper<Gram> 
> > >
             {};
 
             template<typename Dummy>
@@ -252,17 +255,36 @@
             template<typename Dummy>
             struct case_<proto::tag::assign, Dummy>
               : proto::or_<
-                    
proto::transform::compose<as_marker<proto::assign<basic_mark_tag, Grammar<Char> 
> >, Grammar<Char> >
+                    
proto::transform::compose<as_marker<proto::assign<basic_mark_tag, Gram> >, Gram>
                   , in_sequence<as_list_set<ListSet<Char> > >
-                  , 
in_sequence<as_attr_matcher<proto::assign<proto::terminal<attribute_placeholder<proto::_>
 >, proto::_> > >
                 >
             {};
 
             template<typename Dummy>
             struct case_<proto::tag::subscript, Dummy>
               : proto::or_<
-                    
in_sequence<proto::transform::right<proto::subscript<set_initializer_type, 
as_set<Grammar<Char> > > > >
-                  , 
proto::transform::compose<as_action<proto::subscript<Grammar<Char>, proto::_> 
>, Grammar<Char> >
+                    
in_sequence<proto::transform::right<proto::subscript<set_initializer_type, 
as_set<Gram> > > >
+                  , 
proto::transform::compose<as_action<proto::subscript<ActionableGrammar<Char>, 
proto::_> >, ActionableGrammar<Char> >
+                >
+            {};
+        };
+
+        
///////////////////////////////////////////////////////////////////////////
+        // ActionableCases
+        template<typename Char, typename Gram>
+        struct ActionableCases
+        {
+            template<typename Tag, typename Dummy = void>
+            struct case_
+              : Cases<Char, Gram>::template case_<Tag>
+            {};
+
+            // Only in sub-expressions with actions attached do we allow 
attribute assignements
+            template<typename Dummy>
+            struct case_<proto::tag::assign, Dummy>
+              : proto::or_<
+                    typename Cases<Char, Gram>::template 
case_<proto::tag::assign>
+                  , 
in_sequence<as_attr_matcher<proto::assign<proto::terminal<attribute_placeholder<proto::_>
 >, proto::_> > >
                 >
             {};
         };
@@ -273,7 +295,12 @@
     // Grammar
     template<typename Char>
     struct Grammar
-      : proto::switch_<detail::Cases<Char> >
+      : proto::switch_<detail::Cases<Char, Grammar<Char> > >
+    {};
+
+    template<typename Char>
+    struct ActionableGrammar
+      : proto::switch_<detail::ActionableCases<Char, ActionableGrammar<Char> > 
>
     {};
 
     ///////////////////////////////////////////////////////////////////////////


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to