$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r59519 - in trunk/boost/spirit/home: qi qi/directive support
From: joel_at_[hidden]
Date: 2010-02-05 20:51:35
Author: djowel
Date: 2010-02-05 20:51:34 EST (Fri, 05 Feb 2010)
New Revision: 59519
URL: http://svn.boost.org/trac/boost/changeset/59519
Log:
added hold directive
Added:
   trunk/boost/spirit/home/qi/directive/hold.hpp   (contents, props changed)
Text files modified: 
   trunk/boost/spirit/home/qi/directive.hpp             |     1 +                                       
   trunk/boost/spirit/home/support/common_terminals.hpp |     1 +                                       
   2 files changed, 2 insertions(+), 0 deletions(-)
Modified: trunk/boost/spirit/home/qi/directive.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/directive.hpp	(original)
+++ trunk/boost/spirit/home/qi/directive.hpp	2010-02-05 20:51:34 EST (Fri, 05 Feb 2010)
@@ -11,6 +11,7 @@
 #pragma once
 #endif
 
+#include <boost/spirit/home/qi/directive/hold.hpp>
 #include <boost/spirit/home/qi/directive/lexeme.hpp>
 #include <boost/spirit/home/qi/directive/matches.hpp>
 #include <boost/spirit/home/qi/directive/no_case.hpp>
Added: trunk/boost/spirit/home/qi/directive/hold.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/directive/hold.hpp	2010-02-05 20:51:34 EST (Fri, 05 Feb 2010)
@@ -0,0 +1,100 @@
+/*=============================================================================
+    Copyright (c) 2001-2010 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(SPIRIT_HOLD_FEBRUARY_6_2010_0917AM)
+#define SPIRIT_HOLD_FEBRUARY_6_2010_0917AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/skip_over.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+//~ #include <boost/spirit/home/qi/detail/assign_to.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/has_semantic_action.hpp>
+//~ #include <boost/range/iterator_range.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_directive<qi::domain, tag::hold> // enables hold
+      : mpl::true_ {};
+}}
+
+namespace boost { namespace spirit { namespace qi
+{
+    using spirit::hold;
+    using spirit::hold_type;
+
+    template <typename Subject>
+    struct hold_directive : unary_parser<hold_directive<Subject> >
+    {
+        typedef Subject subject_type;
+        hold_directive(Subject const& subject)
+          : subject(subject) {}
+
+        template <typename Context, typename Iterator>
+        struct attribute
+        {
+            typedef typename
+                traits::attribute_of<subject_type, Context, Iterator>::type
+            type;
+        };
+
+        template <typename Iterator, typename Context
+          , typename Skipper, typename Attribute>
+        bool parse(Iterator& first, Iterator const& last
+          , Context& context, Skipper const& skipper, Attribute& attr) const
+        {
+            Attribute copy(attr);
+            if (subject.parse(first, last, context, skipper, copy))
+            {
+                traits::swap_impl(copy, attr);
+                return true;
+            }
+            return false;
+        }
+
+        template <typename Context>
+        info what(Context& context) const
+        {
+            return info("hold", subject.what(context));
+
+        }
+
+        Subject subject;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Subject, typename Modifiers>
+    struct make_directive<tag::hold, Subject, Modifiers>
+    {
+        typedef hold_directive<Subject> result_type;
+        result_type operator()(unused_type, Subject const& subject, unused_type) const
+        {
+            return result_type(subject);
+        }
+    };
+}}}
+
+namespace boost { namespace spirit { namespace traits
+{
+    template <typename Subject>
+    struct has_semantic_action<qi::hold_directive<Subject> >
+      : unary_has_semantic_action<Subject> {};
+}}}
+
+#endif
Modified: trunk/boost/spirit/home/support/common_terminals.hpp
==============================================================================
--- trunk/boost/spirit/home/support/common_terminals.hpp	(original)
+++ trunk/boost/spirit/home/support/common_terminals.hpp	2010-02-05 20:51:34 EST (Fri, 05 Feb 2010)
@@ -38,6 +38,7 @@
         ( true_ )
         ( false_ )
         ( matches )
+        ( hold )
     )
 
     // Here we are reusing proto::lit