Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59716 - in trunk/boost/spirit: home/qi home/qi/directive include
From: hartmut.kaiser_at_[hidden]
Date: 2010-02-16 20:48:35


Author: hkaiser
Date: 2010-02-16 20:48:34 EST (Tue, 16 Feb 2010)
New Revision: 59716
URL: http://svn.boost.org/trac/boost/changeset/59716

Log:
Spirit: adding no_skip[] directive
Added:
   trunk/boost/spirit/home/qi/directive/no_skip.hpp (contents, props changed)
   trunk/boost/spirit/include/qi_no_skip.hpp (contents, props changed)
Text files modified:
   trunk/boost/spirit/home/qi/directive.hpp | 1 +
   1 files changed, 1 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-16 20:48:34 EST (Tue, 16 Feb 2010)
@@ -13,6 +13,7 @@
 
 #include <boost/spirit/home/qi/directive/hold.hpp>
 #include <boost/spirit/home/qi/directive/lexeme.hpp>
+#include <boost/spirit/home/qi/directive/no_skip.hpp>
 #include <boost/spirit/home/qi/directive/matches.hpp>
 #include <boost/spirit/home/qi/directive/no_case.hpp>
 #include <boost/spirit/home/qi/directive/omit.hpp>

Added: trunk/boost/spirit/home/qi/directive/no_skip.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/directive/no_skip.hpp 2010-02-16 20:48:34 EST (Tue, 16 Feb 2010)
@@ -0,0 +1,96 @@
+/*=============================================================================
+ Copyright (c) 2001-2010 Joel de Guzman
+ Copyright (c) 2001-2010 Hartmut Kaiser
+
+ 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_NO_SKIP_JAN_16_2010_0802PM)
+#define SPIRIT_NO_SKIP_JAN_16_2010_0802PM
+
+#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/qi/detail/unused_skipper.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/info.hpp>
+
+namespace boost { namespace spirit
+{
+ ///////////////////////////////////////////////////////////////////////////
+ // Enablers
+ ///////////////////////////////////////////////////////////////////////////
+ template <>
+ struct use_directive<qi::domain, tag::no_skip> // enables no_skip
+ : mpl::true_ {};
+}}
+
+namespace boost { namespace spirit { namespace qi
+{
+ using spirit::no_skip;
+ using spirit::no_skip_type;
+
+ // same as lexeme[], but does not pre-skip
+ template <typename Subject>
+ struct no_skip_directive : unary_parser<no_skip_directive<Subject> >
+ {
+ typedef Subject subject_type;
+ no_skip_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
+ {
+ return subject.parse(first, last, context
+ , detail::unused_skipper<Skipper>(skipper), attr);
+ }
+
+ template <typename Context>
+ info what(Context& context) const
+ {
+ return info("no_skip", subject.what(context));
+
+ }
+
+ Subject subject;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Parser generators: make_xxx function (objects)
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Subject, typename Modifiers>
+ struct make_directive<tag::no_skip, Subject, Modifiers>
+ {
+ typedef no_skip_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::no_skip_directive<Subject> >
+ : unary_has_semantic_action<Subject> {};
+}}}
+
+#endif

Added: trunk/boost/spirit/include/qi_no_skip.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/include/qi_no_skip.hpp 2010-02-16 20:48:34 EST (Tue, 16 Feb 2010)
@@ -0,0 +1,18 @@
+/*=============================================================================
+ Copyright (c) 2001-2010 Joel de Guzman
+ Copyright (c) 2001-2010 Hartmut Kaiser
+ http://spirit.sourceforge.net/
+
+ 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)
+=============================================================================*/
+#ifndef BOOST_SPIRIT_INCLUDE_QI_NO_SKIP
+#define BOOST_SPIRIT_INCLUDE_QI_NO_SKIP
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/directive/no_skip.hpp>
+
+#endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk