I completed the implementation of my own unput () function as follows:
struct unputImpl
{
template <typename Iter1T, typename Iter2T, typename StrT>
struct result {
typedef void type;
};
template <typename Iter1T, typename Iter2T, typename StrT>
typename result<Iter1T, Iter2T, StrT>::type operator()(Iter1T& start, Iter2T& end, StrT str) const {
start -= (str.length() - std::distance(start, end));
std::copy(str.begin(), str.end(), start);
end = start;
}
};
phoenix::function<unputImpl> const unput = unputImpl();
Then it can be used as:
this->self += lex::token_def<lex::omit>("{SYMBOL}\\(")
[
unput(_start, _end, "(" + construct<string>(_start, _end - 1) + " "),
_pass = lex::pass_flags::pass_ignore
];
, , . , , , , , , unput() .