Chris@16: // Copyright (c) 2001-2011 Hartmut Kaiser Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. (See accompanying Chris@16: // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: #if !defined(BOOST_SPIRIT_KARMA_NO_DELIMIT_JAN_19_2010_0920AM) Chris@16: #define BOOST_SPIRIT_KARMA_NO_DELIMIT_JAN_19_2010_0920AM Chris@16: Chris@16: #if defined(_MSC_VER) Chris@16: #pragma once Chris@16: #endif Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost { namespace spirit Chris@16: { Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: // Enablers Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: template <> Chris@16: struct use_directive // enables no_delimit[] Chris@16: : mpl::true_ {}; Chris@16: Chris@16: }} Chris@16: Chris@16: namespace boost { namespace spirit { namespace karma Chris@16: { Chris@16: #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS Chris@16: using spirit::no_delimit; Chris@16: #endif Chris@16: using spirit::no_delimit_type; Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: // The no_delimit generator is used for no_delimit[...] directives. Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: template Chris@16: struct no_delimit_generator Chris@16: : unary_generator > Chris@16: { Chris@16: typedef Subject subject_type; Chris@16: typedef typename subject_type::properties properties; Chris@16: Chris@16: template Chris@16: struct attribute Chris@16: : traits::attribute_of Chris@16: {}; Chris@16: Chris@16: no_delimit_generator(Subject const& subject) Chris@16: : subject(subject) {} Chris@16: Chris@16: template Chris@16: bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d Chris@16: , Attribute const& attr) const Chris@16: { Chris@16: // the no_delimit generator simply dispatches to the embedded Chris@16: // generator while supplying unused_delimiter as the new delimiter Chris@16: // to avoid delimiting down the generator stream Chris@16: typedef detail::unused_delimiter unused_delimiter; Chris@16: Chris@16: // the difference to verbatim[] is that this does not post-delimit Chris@16: return subject.generate(sink, ctx, unused_delimiter(d), attr); Chris@16: } Chris@16: Chris@16: template Chris@16: info what(Context& context) const Chris@16: { Chris@16: return info("no_delimit", subject.what(context)); Chris@16: } Chris@16: Chris@16: Subject subject; Chris@16: }; Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: // Generator generators: make_xxx function (objects) Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: template Chris@16: struct make_directive Chris@16: { Chris@16: typedef no_delimit_generator result_type; Chris@16: Chris@16: result_type Chris@16: operator()(unused_type, Subject const& subject, unused_type) const Chris@16: { Chris@16: return result_type(subject); Chris@16: } Chris@16: }; Chris@16: Chris@16: }}} Chris@16: Chris@16: namespace boost { namespace spirit { namespace traits Chris@16: { Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: template Chris@16: struct has_semantic_action > Chris@16: : unary_has_semantic_action {}; Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: template Chris@16: struct handles_container, Attribute Chris@16: , Context, Iterator> Chris@16: : unary_handles_container {}; Chris@16: }}} Chris@16: Chris@16: #endif