|
Boost-Commit : |
From: hartmut.kaiser_at_[hidden]
Date: 2008-07-08 11:24:58
Author: hkaiser
Date: 2008-07-08 11:24:57 EDT (Tue, 08 Jul 2008)
New Revision: 47227
URL: http://svn.boost.org/trac/boost/changeset/47227
Log:
Spirit: Merged changes from trunk
Added:
branches/release/boost/spirit/home/karma/auxiliary/eol.hpp (contents, props changed)
branches/release/libs/spirit/test/karma/eol.cpp (contents, props changed)
Text files modified:
branches/release/boost/spirit/home/karma/auxiliary.hpp | 1 +
branches/release/boost/spirit/home/karma/auxiliary/meta_grammar.hpp | 3 +++
branches/release/libs/spirit/test/Jamfile | 1 +
3 files changed, 5 insertions(+), 0 deletions(-)
Modified: branches/release/boost/spirit/home/karma/auxiliary.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/auxiliary.hpp (original)
+++ branches/release/boost/spirit/home/karma/auxiliary.hpp 2008-07-08 11:24:57 EDT (Tue, 08 Jul 2008)
@@ -8,6 +8,7 @@
#include <boost/spirit/home/karma/auxiliary/none.hpp>
#include <boost/spirit/home/karma/auxiliary/eps.hpp>
+#include <boost/spirit/home/karma/auxiliary/eol.hpp>
#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
#include <boost/spirit/home/karma/auxiliary/functor.hpp>
#include <boost/spirit/home/karma/auxiliary/functor_director.hpp>
Added: branches/release/boost/spirit/home/karma/auxiliary/eol.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/spirit/home/karma/auxiliary/eol.hpp 2008-07-08 11:24:57 EDT (Tue, 08 Jul 2008)
@@ -0,0 +1,43 @@
+// Copyright (c) 2001-2008 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(BOOST_SPIRIT_KARMA_EOL_JUL_08_2008_1014AM)
+#define BOOST_SPIRIT_KARMA_EOL_JUL_08_2008_1014AM
+
+#include <boost/spirit/home/karma/domain.hpp>
+#include <boost/spirit/home/karma/delimit.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+
+namespace boost { namespace spirit { namespace karma
+{
+ struct eol_generator
+ {
+ template <typename Component, typename Context, typename Unused>
+ struct attribute
+ {
+ typedef unused_type type;
+ };
+
+ template <typename Component, typename OutputIterator,
+ typename Context, typename Delimiter, typename Parameter>
+ static bool
+ generate(Component const& /*component*/, OutputIterator& sink,
+ Context& /*ctx*/, Delimiter const& d, Parameter const& /*param*/)
+ {
+ detail::generate_to(sink, '\n');
+ karma::delimit(sink, d); // always do post-delimiting
+ return true;
+ }
+
+ template <typename Component>
+ static std::string what(Component const&)
+ {
+ return "eol";
+ }
+ };
+
+}}}
+
+#endif
Modified: branches/release/boost/spirit/home/karma/auxiliary/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/auxiliary/meta_grammar.hpp (original)
+++ branches/release/boost/spirit/home/karma/auxiliary/meta_grammar.hpp 2008-07-08 11:24:57 EDT (Tue, 08 Jul 2008)
@@ -24,6 +24,7 @@
///////////////////////////////////////////////////////////////////////////
struct none;
struct eps_generator;
+ struct eol_generator;
struct semantic_predicate;
struct lazy_generator;
struct functor_director;
@@ -45,6 +46,8 @@
karma::domain, tag::none, none>,
meta_grammar::empty_terminal_rule<
karma::domain, tag::eps, eps_generator>,
+ meta_grammar::empty_terminal_rule<
+ karma::domain, tag::eol, eol_generator>,
meta_grammar::function1_rule<
karma::domain, tag::eps, semantic_predicate>,
meta_grammar::function1_rule<
Modified: branches/release/libs/spirit/test/Jamfile
==============================================================================
--- branches/release/libs/spirit/test/Jamfile (original)
+++ branches/release/libs/spirit/test/Jamfile 2008-07-08 11:24:57 EDT (Tue, 08 Jul 2008)
@@ -61,6 +61,7 @@
[ run karma/center_alignment.cpp : : : : ]
[ run karma/char.cpp : : : : karma_char ]
[ run karma/delimiter.cpp : : : : ]
+ [ run karma/eol.cpp : : : : karma_eol ]
[ run karma/eps.cpp : : : : karma_eps ]
[ run karma/format_manip.cpp : : : : ]
[ run karma/functor.cpp : : : : karma_functor ]
Added: branches/release/libs/spirit/test/karma/eol.cpp
==============================================================================
--- (empty file)
+++ branches/release/libs/spirit/test/karma/eol.cpp 2008-07-08 11:24:57 EDT (Tue, 08 Jul 2008)
@@ -0,0 +1,33 @@
+// Copyright (c) 2001-2008 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)
+
+#include <boost/config/warning_disable.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/spirit/include/karma_auxiliary.hpp>
+#include <boost/spirit/include/karma_char.hpp>
+#include <boost/spirit/include/karma_generate.hpp>
+
+#include <iostream>
+#include "test.hpp"
+
+int
+main()
+{
+ using namespace spirit_test;
+ using namespace boost::spirit;
+ using namespace boost::spirit::ascii;
+
+ {
+ BOOST_TEST((test("\n", eol)));
+ BOOST_TEST((test("\n", eol)));
+ }
+
+ {
+ BOOST_TEST((test_delimited("\n ", eol, space)));
+ BOOST_TEST((test_delimited("\n ", eol, space)));
+ }
+
+ return boost::report_errors();
+}
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