$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: joel_at_[hidden]
Date: 2008-07-11 11:30:39
Author: djowel
Date: 2008-07-11 11:30:39 EDT (Fri, 11 Jul 2008)
New Revision: 47314
URL: http://svn.boost.org/trac/boost/changeset/47314
Log:
no more grammar_def
Added:
   trunk/boost/spirit/home/qi/nonterminal/grammar_fwd.hpp   (contents, props changed)
Text files modified: 
   trunk/boost/spirit/home/qi/nonterminal/grammar.hpp |   175 +-------------------------------------- 
   trunk/boost/spirit/home/qi/nonterminal/rule.hpp    |    15 +--                                     
   2 files changed, 11 insertions(+), 179 deletions(-)
Modified: trunk/boost/spirit/home/qi/nonterminal/grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/nonterminal/grammar.hpp	(original)
+++ trunk/boost/spirit/home/qi/nonterminal/grammar.hpp	2008-07-11 11:30:39 EDT (Fri, 11 Jul 2008)
@@ -9,6 +9,7 @@
 
 #include <boost/spirit/home/support/unused.hpp>
 #include <boost/spirit/home/qi/nonterminal/nonterminal.hpp>
+#include <boost/spirit/home/qi/nonterminal/grammar_fwd.hpp>
 #include <boost/spirit/home/qi/domain.hpp>
 #include <boost/spirit/home/qi/nonterminal/rule.hpp>
 #include <boost/spirit/home/qi/nonterminal/nonterminal_director.hpp>
@@ -18,100 +19,10 @@
 
 namespace boost { namespace spirit { namespace qi
 {
-    template <typename Definition>
+    template <typename Iterator, typename T0 , typename T1 , typename T2>
     struct grammar
       : nonterminal<
-            grammar<Definition>
-          , typename Definition::sig_type
-          , typename Definition::locals_type
-        >, noncopyable
-    {
-        typedef typename Definition::sig_type sig_type;
-        typedef typename Definition::locals_type locals_type;
-        typedef typename Definition::skipper_type skipper_type;
-        typedef typename Definition::start_type start_type;
-        typedef typename Definition::iterator_type iterator_type;
-
-        template <typename Definition_>
-        explicit grammar(Definition_ const& definition)
-          : definition(definition)
-          , start(definition.start)
-        {
-        }
-
-        template <typename Definition_, typename Start>
-        grammar(Definition_ const& definition, Start const& start)
-          : definition(definition)
-          , start(start)
-        {
-        }
-
-    private:
-
-        template <typename Iterator, typename Context, typename Skipper>
-        bool parse(
-            Iterator& first, Iterator const& last
-          , Context& context, Skipper const& skipper) const
-        {
-            return start.parse(first, last, context, skipper);
-        }
-
-        std::string what() const
-        {
-            if (definition.name().empty())
-            {
-                return start.what();
-            }
-            else
-            {
-                return definition.name();
-            }
-        }
-
-        friend struct nonterminal_director;
-        Definition const& definition;
-        start_type const& start;
-    };
-
-    template <
-        typename Iterator
-      , typename T0 = unused_type
-      , typename T1 = unused_type
-      , typename T2 = unused_type
-    >
-    struct grammar_def : noncopyable
-    {
-        typedef Iterator iterator_type;
-        typedef qi::rule<Iterator, T0, T1, T2> start_type;
-        typedef typename start_type::sig_type sig_type;
-        typedef typename start_type::locals_type locals_type;
-        typedef typename start_type::skipper_type skipper_type;
-
-        grammar_def(std::string const& name_ = std::string())
-          : name_(name_) {}
-
-        std::string name() const
-        {
-            return name_;
-        }
-
-        void name(std::string const& name__)
-        {
-            name_ = name__;
-        }
-
-        std::string name_;
-    };
-
-    template <
-        typename Iterator
-      , typename T0 = unused_type
-      , typename T1 = unused_type
-      , typename T2 = unused_type
-    >
-    struct grammar_
-      : nonterminal<
-            grammar_<Iterator, T0, T1, T2>
+            grammar<Iterator, T0, T1, T2>
           , typename qi::rule<Iterator, T0, T1, T2>::sig_type
           , typename qi::rule<Iterator, T0, T1, T2>::locals_type
         >, noncopyable
@@ -121,9 +32,9 @@
         typedef typename start_type::sig_type sig_type;
         typedef typename start_type::locals_type locals_type;
         typedef typename start_type::skipper_type skipper_type;
-        typedef grammar_<Iterator, T0, T1, T2> base_type;
+        typedef grammar<Iterator, T0, T1, T2> base_type;
 
-        grammar_(start_type const& start, std::string const& name_ = std::string())
+        grammar(start_type const& start, std::string const& name_ = std::string())
           : start(start), name_(name_) {}
 
         std::string name() const
@@ -136,8 +47,8 @@
             name_ = name__;
         }
 
-        std::string name_;
         start_type const& start;
+        std::string name_;
 
     private:
 
@@ -163,80 +74,6 @@
 
         friend struct nonterminal_director;
     };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  The grammar_class template
-    ///////////////////////////////////////////////////////////////////////////
-    template <template <typename, typename> class Def>
-    struct grammar_class {};
-
-    template <typename Iterator, template <typename, typename> class Def>
-    inline bool
-    parse(
-        Iterator& first
-      , Iterator last
-      , grammar_class<Def>& gc)
-    {
-        Def<Iterator, unused_type> def(gc);
-        grammar<Def<Iterator, unused_type> > g(def);
-        return parse(first, last, g);
-    }
-
-    template <typename Iterator
-      , template <typename, typename> class Def, typename Attr>
-    inline bool
-    parse(
-        Iterator& first
-      , Iterator last
-      , grammar_class<Def>& gc
-      , Attr& attr)
-    {
-        Def<Iterator, unused_type> def(gc);
-        grammar<Def<Iterator, unused_type> > g(def);
-        return parse(first, last, g, attr);
-    }
-
-    template <typename Iterator
-      , template <typename, typename> class Def, typename Skipper>
-    inline bool
-    phrase_parse(
-        Iterator& first
-      , Iterator last
-      , grammar_class<Def>& gc
-      , Skipper const& skipper_)
-    {
-        typedef typename
-            result_of::as_component<qi::domain, Skipper>::type
-        skipper_type;
-
-        skipper_type skipper = spirit::as_component(qi::domain(), skipper_);
-
-        Def<Iterator, skipper_type> def(gc);
-        grammar<Def<Iterator, skipper_type> > g(def);
-        return phrase_parse(first, last, g, skipper);
-    }
-
-    template <typename Iterator
-      , template <typename, typename> class Def, typename Attr, typename Skipper>
-    inline bool
-    phrase_parse(
-        Iterator& first
-      , Iterator last
-      , grammar_class<Def>& gc
-      , Attr& attr
-      , Skipper const& skipper_)
-    {
-        typedef typename
-            result_of::as_component<qi::domain, Skipper>::type
-        skipper_type;
-
-        skipper_type skipper = spirit::as_component(qi::domain(), skipper_);
-
-        Def<Iterator, skipper_type> def(gc);
-        grammar<Def<Iterator, skipper_type> > g(def);
-        return phrase_parse(first, last, g, attr, skipper);
-    }
-
 }}}
 
 #endif
Added: trunk/boost/spirit/home/qi/nonterminal/grammar_fwd.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/nonterminal/grammar_fwd.hpp	2008-07-11 11:30:39 EDT (Fri, 11 Jul 2008)
@@ -0,0 +1,22 @@
+/*=============================================================================
+    Copyright (c) 2001-2007 Joel de Guzman
+
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
+    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#if !defined(BOOST_SPIRIT_GRAMMAR_FWD_JULY_11_2008_1034AM)
+#define BOOST_SPIRIT_GRAMMAR_FWD_JULY_11_2008_1034AM
+
+namespace boost { namespace spirit { namespace qi
+{
+    // forward declaration
+    template <
+        typename Iterator
+      , typename T0 = unused_type
+      , typename T1 = unused_type
+      , typename T2 = unused_type
+    >
+    struct grammar;
+}}}
+
+#endif
Modified: trunk/boost/spirit/home/qi/nonterminal/rule.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/nonterminal/rule.hpp	(original)
+++ trunk/boost/spirit/home/qi/nonterminal/rule.hpp	2008-07-11 11:30:39 EDT (Fri, 11 Jul 2008)
@@ -9,6 +9,7 @@
 
 #include <boost/spirit/home/support/unused.hpp>
 #include <boost/spirit/home/qi/nonterminal/nonterminal.hpp>
+#include <boost/spirit/home/qi/nonterminal/grammar_fwd.hpp>
 #include <boost/spirit/home/qi/nonterminal/detail/rule.hpp>
 #include <boost/spirit/home/qi/nonterminal/detail/error_handler.hpp>
 #include <boost/spirit/home/qi/domain.hpp>
@@ -23,9 +24,6 @@
 
 namespace boost { namespace spirit { namespace qi
 {
-    // forward declarations
-    template <typename Definition>
-    struct grammar;
     namespace detail { struct rule_decorator; }
 
     template <
@@ -86,7 +84,7 @@
 
             // temp workaround for mpl problem
             BOOST_STATIC_ASSERT(is_component::value);
-            
+
             define(xpr, mpl::false_());
             return *this;
         }
@@ -143,11 +141,8 @@
 
     private:
 
-        template <typename Definition>
-        friend struct grammar;
-
         template <typename Iterator_, typename T0_, typename T1_, typename T2_>
-        friend struct grammar_;
+        friend struct grammar;
 
         friend struct detail::rule_decorator;
 
@@ -176,8 +171,8 @@
         {
             // If the following line produces a compilation error stating the
             // 4th parameter is not convertible to the expected type, then you
-            // are probably trying to use this rule instance with a skipper 
-            // which is not compatible with the skipper type used while 
+            // are probably trying to use this rule instance with a skipper
+            // which is not compatible with the skipper type used while
             // defining the type of this rule instance.
             return ptr->parse(first, last, context, skipper);
         }