2
0
mirror of https://github.com/boostorg/spirit.git synced 2026-01-19 04:42:11 +00:00

Spirit: fixing the unescaped_string example

[SVN r71202]
This commit is contained in:
Hartmut Kaiser
2011-04-12 14:52:14 +00:00
parent 8b5acda525
commit ee1c4791b6
3 changed files with 29 additions and 2 deletions

View File

@@ -24,7 +24,7 @@ namespace client
("\\r", '\r')("\\t", '\t')("\\v", '\v')("\\\\", '\\')
("\\\'", '\'')("\\\"", '\"')
;
unesc_str = qi::lit(qi::_r1)
>> *(unesc_char | qi::alnum | "\\x" >> qi::hex)
>> qi::lit(qi::_r1)

View File

@@ -174,9 +174,30 @@ namespace boost { namespace spirit { namespace traits
struct is_weak_substitute<T, optional<Expected> >
: is_weak_substitute<T, Expected> {};
#define BOOST_SPIRIT_IS_WEAK_SUBSTITUTE(z, N, _) \
is_weak_substitute<BOOST_PP_CAT(T, N), Expected>::type::value && \
/***/
// make sure unused variant parameters do not affect the outcome
template <typename Expected>
struct is_weak_substitute<boost::detail::variant::void_, Expected>
: mpl::true_
{};
template <BOOST_VARIANT_ENUM_PARAMS(typename T), typename Expected>
struct is_weak_substitute<
boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Expected>
: mpl::bool_<BOOST_PP_REPEAT(BOOST_VARIANT_LIMIT_TYPES
, BOOST_SPIRIT_IS_WEAK_SUBSTITUTE, _) true>
{};
#undef BOOST_SPIRIT_IS_WEAK_SUBSTITUTE
template <typename T>
struct is_weak_substitute<T, T
, typename enable_if<not_is_optional<T> >::type>
, typename enable_if<
mpl::and_<not_is_optional<T>, not_is_variant<T> >
>::type>
: mpl::true_ {};
///////////////////////////////////////////////////////////////////////////

View File

@@ -63,6 +63,12 @@ namespace boost { namespace spirit { namespace traits
is_container<BOOST_PP_CAT(T, N)>::value || \
/***/
// make sure unused variant parameters do not affect the outcome
template <>
struct is_container<boost::detail::variant::void_>
: mpl::false_
{};
template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
struct is_container<variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
: mpl::bool_<BOOST_PP_REPEAT(BOOST_VARIANT_LIMIT_TYPES