Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57870 - in trunk/boost/spirit/repository: home/qi home/qi/primitive include
From: hartmut.kaiser_at_[hidden]
Date: 2009-11-23 13:42:22


Author: hkaiser
Date: 2009-11-23 13:42:21 EST (Mon, 23 Nov 2009)
New Revision: 57870
URL: http://svn.boost.org/trac/boost/changeset/57870

Log:
Spirit: moved iter_pos parser to repository
Added:
   trunk/boost/spirit/repository/home/qi/primitive/iter_pos.hpp (contents, props changed)
   trunk/boost/spirit/repository/include/qi_iter_pos.hpp (contents, props changed)
Text files modified:
   trunk/boost/spirit/repository/home/qi/primitive.hpp | 1 +
   1 files changed, 1 insertions(+), 0 deletions(-)

Modified: trunk/boost/spirit/repository/home/qi/primitive.hpp
==============================================================================
--- trunk/boost/spirit/repository/home/qi/primitive.hpp (original)
+++ trunk/boost/spirit/repository/home/qi/primitive.hpp 2009-11-23 13:42:21 EST (Mon, 23 Nov 2009)
@@ -12,6 +12,7 @@
 #endif
 
 #include <boost/spirit/repository/home/qi/primitive/flush_multi_pass.hpp>
+#include <boost/spirit/repository/home/qi/primitive/iter_pos.hpp>
 
 #endif
 

Added: trunk/boost/spirit/repository/home/qi/primitive/iter_pos.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/repository/home/qi/primitive/iter_pos.hpp 2009-11-23 13:42:21 EST (Mon, 23 Nov 2009)
@@ -0,0 +1,83 @@
+// Copyright (c) 2001-2009 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(ITER_POS_NOV_20_2009_1245PM)
+#define ITER_POS_NOV_20_2009_1245PM
+
+#include <boost/spirit/include/qi_parse.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+// definition the place holder
+namespace boost { namespace spirit { namespace repository { namespace qi
+{
+ BOOST_SPIRIT_TERMINAL(iter_pos);
+}}}}
+
+///////////////////////////////////////////////////////////////////////////////
+// implementation the enabler
+namespace boost { namespace spirit
+{
+ // We want custom_parser::iter_pos to be usable as a terminal only,
+ // and only for parser expressions (qi::domain).
+ template <>
+ struct use_terminal<qi::domain, repository::qi::tag::iter_pos>
+ : mpl::true_
+ {};
+}}
+
+///////////////////////////////////////////////////////////////////////////////
+// implementation of the parser
+namespace boost { namespace spirit { namespace repository { namespace qi
+{
+ struct iter_pos_parser
+ : boost::spirit::qi::primitive_parser<iter_pos_parser>
+ {
+ // Define the attribute type exposed by this parser component
+ template <typename Context, typename Iterator>
+ struct attribute
+ {
+ typedef Iterator type;
+ };
+
+ // This function is called during the actual parsing process
+ template <typename Iterator, typename Context
+ , typename Skipper, typename Attribute>
+ bool parse(Iterator& first, Iterator const& last
+ , Context&, Skipper const& skipper, Attribute& attr) const
+ {
+ boost::spirit::qi::skip_over(first, last, skipper);
+ boost::spirit::traits::assign_to(first, attr);
+ return true;
+ }
+
+ // This function is called during error handling to create
+ // a human readable string for the error context.
+ template <typename Context>
+ boost::spirit::info what(Context&) const
+ {
+ return boost::spirit::info("iter_pos");
+ }
+ };
+}}}}
+
+///////////////////////////////////////////////////////////////////////////////
+// instantiation of the parser
+namespace boost { namespace spirit { namespace qi
+{
+ // This is the factory function object invoked in order to create
+ // an instance of our iter_pos_parser.
+ template <typename Modifiers>
+ struct make_primitive<repository::qi::tag::iter_pos, Modifiers>
+ {
+ typedef repository::qi::iter_pos_parser result_type;
+
+ result_type operator()(unused_type, unused_type) const
+ {
+ return result_type();
+ }
+ };
+}}}
+
+#endif

Added: trunk/boost/spirit/repository/include/qi_iter_pos.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/repository/include/qi_iter_pos.hpp 2009-11-23 13:42:21 EST (Mon, 23 Nov 2009)
@@ -0,0 +1,18 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Joel de Guzman
+ Copyright (c) 2001-2009 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_REPOSITORY_ITER_POS
+#define BOOST_SPIRIT_INCLUDE_QI_REPOSITORY_ITER_POS
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/repository/home/qi/primitive/iter_pos.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