The no_delimit
directive is regrouping your exposed fusion sequences. Note that the following does compile:
range %= range_part << -(lit("-") << range_part) << -(lit("<<") << ulong_);
or even
range %= no_delimit[range_part << -(lit("-") << range_part) << -(lit("<<") << ulong_)];
AFAICT the rules are defined without delimiter, so the no_delimit should be redundant here anyway.
I have "fantasized" a RangeEntry type just to make it a selfcontained sample:
#include <boost/fusion/adapted.hpp>
#include <boost/spirit/include/karma.hpp>
namespace karma = boost::spirit::karma;
namespace C {
typedef std::pair<unsigned long, boost::optional<unsigned long> > RangeEntry;
struct Range {
RangeEntry firstPart;
boost::optional<RangeEntry> secondPart;
boost::optional<size_t> shift;
};
}
BOOST_FUSION_ADAPT_STRUCT(
C::Range,
(C::RangeEntry , firstPart)
(boost::optional<C::RangeEntry> , secondPart)
(boost::optional<size_t> , shift)
);
//... Declare the rules ...
int main()
{
typedef char* Iterator;
karma::rule<Iterator, C::Range()> range;
karma::rule<Iterator, C::RangeEntry()> range_part;
//... Define rules ...
using namespace karma;
range_part %= no_delimit[ulong_ << -(lit(":") << ulong_)];
range %= no_delimit[range_part << -(lit("-") << range_part) << -(lit("<<") << ulong_)];
}