stabilize build system: depends, installer, boost/bdb fixes, cross targets groundwork
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_APPLY_PARSER_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_APPLY_PARSER_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/v1/unless_error.hpp>
|
||||
#include <boost/metaparse/v1/get_result.hpp>
|
||||
#include <boost/metaparse/v1/get_remaining.hpp>
|
||||
#include <boost/metaparse/v1/get_position.hpp>
|
||||
#include <boost/metaparse/v1/transform.hpp>
|
||||
|
||||
#include <boost/mpl/push_back.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
struct apply_parser
|
||||
{
|
||||
private:
|
||||
template <class ListToAppend>
|
||||
struct do_append
|
||||
{
|
||||
template <class Item>
|
||||
struct apply : boost::mpl::push_back<ListToAppend, Item> {};
|
||||
};
|
||||
|
||||
template <class Accum, class S, class Pos, class Parser>
|
||||
struct apply_unchecked :
|
||||
transform<Parser,do_append<typename Accum::type> >::template apply<
|
||||
typename S::type,
|
||||
typename Pos::type
|
||||
>
|
||||
{};
|
||||
|
||||
public:
|
||||
template <class State, class Parser>
|
||||
struct apply :
|
||||
unless_error<
|
||||
State,
|
||||
apply_unchecked<
|
||||
get_result<State>,
|
||||
get_remaining<State>,
|
||||
get_position<State>,
|
||||
Parser
|
||||
>
|
||||
>
|
||||
{};
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_ASSERT_STRING_LENGTH_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_ASSERT_STRING_LENGTH_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2014.
|
||||
// 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/static_assert.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <int Len, class S>
|
||||
struct assert_string_length : S
|
||||
{
|
||||
BOOST_STATIC_ASSERT((Len <= BOOST_METAPARSE_LIMIT_STRING_SIZE));
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_AT_C_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_AT_C_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/config.hpp>
|
||||
#include <boost/metaparse/v1/fwd/string.hpp>
|
||||
|
||||
#include <boost/mpl/char.hpp>
|
||||
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <class S, int N>
|
||||
struct at_c;
|
||||
|
||||
#ifdef BOOST_METAPARSE_VARIADIC_STRING
|
||||
template <char C, char... Cs, int N>
|
||||
struct at_c<string<C, Cs...>, N> : at_c<string<Cs...>, N - 1> {};
|
||||
|
||||
template <char C, char... Cs>
|
||||
struct at_c<string<C, Cs...>, 0> : boost::mpl::char_<C> {};
|
||||
#else
|
||||
#ifdef BOOST_METAPARSE_STRING_CASE
|
||||
# error BOOST_METAPARSE_STRING_CASE is already defined
|
||||
#endif
|
||||
#define BOOST_METAPARSE_STRING_CASE(z, n, unused) \
|
||||
template < \
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, int C) \
|
||||
> \
|
||||
struct \
|
||||
at_c< \
|
||||
string< \
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, C) \
|
||||
>, \
|
||||
n \
|
||||
> : \
|
||||
boost::mpl::char_<BOOST_PP_CAT(C, n)> \
|
||||
{};
|
||||
|
||||
BOOST_PP_REPEAT(
|
||||
BOOST_METAPARSE_LIMIT_STRING_SIZE,
|
||||
BOOST_METAPARSE_STRING_CASE,
|
||||
~
|
||||
)
|
||||
|
||||
#undef BOOST_METAPARSE_STRING_CASE
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_BACK_INSERTER_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_BACK_INSERTER_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
|
||||
// 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/mpl/push_back.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
struct back_inserter
|
||||
{
|
||||
typedef back_inserter type;
|
||||
|
||||
template <class T0, class T1>
|
||||
struct apply : boost::mpl::push_back<T0, T1> {};
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_CONCAT_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_CONCAT_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/config.hpp>
|
||||
#include <boost/metaparse/v1/fwd/string.hpp>
|
||||
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
#include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
#include <boost/preprocessor/arithmetic/mul.hpp>
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <class A, class B>
|
||||
struct concat;
|
||||
|
||||
#ifdef BOOST_METAPARSE_VARIADIC_STRING
|
||||
template <char... As, char... Bs>
|
||||
struct concat<string<As...>, string<Bs...>> : string<As..., Bs...> {};
|
||||
#else
|
||||
template <class A, class B>
|
||||
struct concat_impl;
|
||||
|
||||
#ifdef BOOST_METAPARSE_ARG
|
||||
# error BOOST_METAPARSE_ARG already defined
|
||||
#endif
|
||||
#define BOOST_METAPARSE_ARG(z, n, unused) \
|
||||
BOOST_PP_CAT(B, BOOST_PP_INC(n))
|
||||
|
||||
#ifdef BOOST_METAPARSE_CONCAT
|
||||
# error BOOST_METAPARSE_CONCAT already defined
|
||||
#endif
|
||||
#define BOOST_METAPARSE_CONCAT(z, n, unused) \
|
||||
template < \
|
||||
BOOST_PP_ENUM_PARAMS(n, int A) BOOST_PP_COMMA_IF(n) \
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, int B) \
|
||||
> \
|
||||
struct \
|
||||
concat_impl< \
|
||||
string< \
|
||||
BOOST_PP_ENUM_PARAMS(n, A) \
|
||||
BOOST_PP_COMMA_IF( \
|
||||
BOOST_PP_MUL( \
|
||||
BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_STRING_SIZE, n), \
|
||||
n \
|
||||
) \
|
||||
) \
|
||||
BOOST_PP_ENUM( \
|
||||
BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_STRING_SIZE, n), \
|
||||
BOOST_NO_CHAR BOOST_PP_TUPLE_EAT(3), \
|
||||
~ \
|
||||
) \
|
||||
>, \
|
||||
string< \
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, B) \
|
||||
> \
|
||||
> : \
|
||||
concat< \
|
||||
string<BOOST_PP_ENUM_PARAMS(n, A) BOOST_PP_COMMA_IF(n) B0>, \
|
||||
string< \
|
||||
BOOST_PP_ENUM( \
|
||||
BOOST_PP_DEC(BOOST_METAPARSE_LIMIT_STRING_SIZE), \
|
||||
BOOST_METAPARSE_ARG, \
|
||||
~ \
|
||||
) \
|
||||
> \
|
||||
> \
|
||||
{};
|
||||
|
||||
BOOST_PP_REPEAT(
|
||||
BOOST_METAPARSE_LIMIT_STRING_SIZE,
|
||||
BOOST_METAPARSE_CONCAT,
|
||||
~
|
||||
)
|
||||
|
||||
#undef BOOST_METAPARSE_ARG
|
||||
#undef BOOST_METAPARSE_CONCAT
|
||||
|
||||
template <class S>
|
||||
struct concat<S, string<> > : S {};
|
||||
|
||||
template <class A, class B>
|
||||
struct concat : concat_impl<A, B> {};
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_EMPTY_STRING_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_EMPTY_STRING_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/config.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <class Ignore = int>
|
||||
struct empty_string
|
||||
{
|
||||
typedef empty_string type;
|
||||
|
||||
#ifdef BOOST_NO_CONSTEXPR_C_STR
|
||||
static const char value[1];
|
||||
#else
|
||||
static constexpr char value[1] = {0};
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef BOOST_NO_CONSTEXPR_C_STR
|
||||
template <class Ignore>
|
||||
const char empty_string<Ignore>::value[1] = {0};
|
||||
#else
|
||||
template <class Ignore>
|
||||
constexpr char empty_string<Ignore>::value[1];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_FRONT_INSERTER_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_FRONT_INSERTER_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
|
||||
// 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/mpl/push_front.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
struct front_inserter
|
||||
{
|
||||
typedef front_inserter type;
|
||||
|
||||
template <class T0, class T1>
|
||||
struct apply : boost::mpl::push_front<T0, T1> {};
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_FWD_ITERATE_IMPL_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_FWD_ITERATE_IMPL_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/v1/is_error.hpp>
|
||||
#include <boost/metaparse/v1/get_result.hpp>
|
||||
#include <boost/metaparse/v1/get_remaining.hpp>
|
||||
#include <boost/metaparse/v1/get_position.hpp>
|
||||
|
||||
#include <boost/mpl/deque.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/push_back.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <int N, class P, class Accum>
|
||||
struct iterate_impl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_HAS_TYPE_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_HAS_TYPE_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2014.
|
||||
// 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/mpl/has_xxx.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(type)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_IS_ANY_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_IS_ANY_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/limit_one_char_except_size.hpp>
|
||||
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <class Stub = int>
|
||||
struct is_any0
|
||||
{
|
||||
template <class C>
|
||||
struct apply : boost::mpl::true_ {};
|
||||
};
|
||||
|
||||
#ifdef BOOST_METAPARSE_DEFINE_IS_ANY
|
||||
# error BOOST_METAPARSE_DEFINE_IS_ANY already defined
|
||||
#endif
|
||||
#define BOOST_METAPARSE_DEFINE_IS_ANY(z, n, unused) \
|
||||
template <BOOST_PP_ENUM_PARAMS(n, class T)> \
|
||||
struct BOOST_PP_CAT(is_any, n) \
|
||||
{ \
|
||||
template <class C> \
|
||||
struct apply : \
|
||||
boost::mpl::eval_if< \
|
||||
boost::mpl::bool_< \
|
||||
C::type::value \
|
||||
== BOOST_PP_CAT(T, BOOST_PP_DEC(n))::type::value \
|
||||
>, \
|
||||
boost::mpl::false_, \
|
||||
typename BOOST_PP_CAT(is_any, BOOST_PP_DEC(n))< \
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(n), T) \
|
||||
>::template apply<C> \
|
||||
> \
|
||||
{}; \
|
||||
};
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(
|
||||
1,
|
||||
BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE,
|
||||
BOOST_METAPARSE_DEFINE_IS_ANY,
|
||||
~
|
||||
)
|
||||
|
||||
#undef BOOST_METAPARSE_DEFINE_IS_ANY
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_IS_CHAR_C_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_IS_CHAR_C_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
|
||||
// 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/mpl/bool.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <char C>
|
||||
struct is_char_c
|
||||
{
|
||||
typedef is_char_c type;
|
||||
|
||||
template <class Ch>
|
||||
struct apply : boost::mpl::bool_<Ch::type::value == C> {};
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_ITERATE_IMPL_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_ITERATE_IMPL_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/v1/impl/iterate_impl_unchecked.hpp>
|
||||
#include <boost/metaparse/v1/return_.hpp>
|
||||
#include <boost/metaparse/v1/is_error.hpp>
|
||||
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <int N, class P, class Accum>
|
||||
struct iterate_impl
|
||||
{
|
||||
typedef iterate_impl type;
|
||||
|
||||
template <class S, class Pos>
|
||||
struct apply :
|
||||
boost::mpl::eval_if<
|
||||
typename is_error<typename P::template apply<S, Pos> >::type,
|
||||
typename P::template apply<S, Pos>,
|
||||
iterate_impl_unchecked<N, P, Accum, S, Pos>
|
||||
>
|
||||
{};
|
||||
};
|
||||
|
||||
template <class P, class Accum>
|
||||
struct iterate_impl<0, P, Accum> : return_<Accum> {};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_ITERATE_IMPL_UNCHECKED_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_ITERATE_IMPL_UNCHECKED_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/v1/impl/fwd/iterate_impl.hpp>
|
||||
#include <boost/metaparse/v1/get_result.hpp>
|
||||
#include <boost/metaparse/v1/get_remaining.hpp>
|
||||
#include <boost/metaparse/v1/get_position.hpp>
|
||||
|
||||
#include <boost/mpl/push_back.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <int N, class P, class Accum, class S, class Pos>
|
||||
struct iterate_impl_unchecked :
|
||||
iterate_impl<
|
||||
N - 1,
|
||||
P,
|
||||
typename boost::mpl::push_back<
|
||||
Accum,
|
||||
typename get_result<typename P::template apply<S, Pos> >::type
|
||||
>::type
|
||||
>::template apply<
|
||||
typename get_remaining<typename P::template apply<S, Pos> >::type,
|
||||
typename get_position<typename P::template apply<S, Pos> >::type
|
||||
>
|
||||
{};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_LATER_RESULT_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_LATER_RESULT_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
|
||||
// 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/metaparse/v1/get_position.hpp>
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/less.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <class R1, class R2>
|
||||
struct later_result :
|
||||
boost::mpl::if_<
|
||||
typename boost::mpl::less<
|
||||
typename get_position<R2>::type,
|
||||
typename get_position<R1>::type
|
||||
>::type,
|
||||
R1,
|
||||
R2
|
||||
>
|
||||
{};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_NEXT_DIGIT_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_NEXT_DIGIT_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
|
||||
// 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/mpl/int.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
struct next_digit
|
||||
{
|
||||
typedef next_digit type;
|
||||
|
||||
template <class PartialResult, class NextDigit>
|
||||
struct apply :
|
||||
boost::mpl::int_<
|
||||
PartialResult::type::value * 10 + NextDigit::type::value
|
||||
>
|
||||
{};
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_NO_CHAR_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_NO_CHAR_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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 <cstdio>
|
||||
|
||||
#ifdef BOOST_NO_CHAR
|
||||
# error BOOST_NO_CHAR already defined
|
||||
#endif
|
||||
#define BOOST_NO_CHAR EOF
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_NTH_OF_C_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_NTH_OF_C_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/v1/impl/nth_of_c_impl.hpp>
|
||||
#include <boost/metaparse/v1/error/index_out_of_range.hpp>
|
||||
#include <boost/metaparse/v1/fail.hpp>
|
||||
#include <boost/metaparse/limit_sequence_size.hpp>
|
||||
|
||||
#include <boost/mpl/list.hpp>
|
||||
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
#ifdef BOOST_METAPARSE_NTH_OF_CASE
|
||||
# error BOOST_METAPARSE_NTH_OF_CASE already defined
|
||||
#endif
|
||||
#define BOOST_METAPARSE_NTH_OF_CASE(z, n, unused) \
|
||||
template < \
|
||||
int K BOOST_PP_COMMA_IF(n) \
|
||||
BOOST_PP_ENUM_PARAMS(n, class P) \
|
||||
> \
|
||||
struct BOOST_PP_CAT(nth_of_c, n) : \
|
||||
boost::mpl::if_< \
|
||||
boost::mpl::bool_<(0 <= K && K < n)>, \
|
||||
nth_of_c_impl< \
|
||||
K, \
|
||||
boost::mpl::list<BOOST_PP_ENUM_PARAMS(n, P)> \
|
||||
>, \
|
||||
fail<error::index_out_of_range<0, n - 1, K> > \
|
||||
>::type \
|
||||
{};
|
||||
|
||||
BOOST_PP_REPEAT(
|
||||
BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
|
||||
BOOST_METAPARSE_NTH_OF_CASE,
|
||||
~
|
||||
)
|
||||
|
||||
#undef BOOST_METAPARSE_NTH_OF_CASE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_NTH_OF_C_IMPL_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_NTH_OF_C_IMPL_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/v1/impl/skip_seq.hpp>
|
||||
|
||||
#include <boost/mpl/front.hpp>
|
||||
#include <boost/mpl/pop_front.hpp>
|
||||
#include <boost/mpl/fold.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <int N, class Seq>
|
||||
struct nth_of_c_impl
|
||||
{
|
||||
private:
|
||||
template <class NextResult>
|
||||
struct apply_unchecked :
|
||||
nth_of_c_impl<
|
||||
N - 1,
|
||||
typename boost::mpl::pop_front<Seq>::type
|
||||
>::template apply<
|
||||
typename get_remaining<NextResult>::type,
|
||||
typename get_position<NextResult>::type
|
||||
>
|
||||
{};
|
||||
public:
|
||||
typedef nth_of_c_impl type;
|
||||
|
||||
template <class S, class Pos>
|
||||
struct apply :
|
||||
boost::mpl::eval_if<
|
||||
typename is_error<
|
||||
typename boost::mpl::front<Seq>::type::template apply<S, Pos>
|
||||
>::type,
|
||||
typename boost::mpl::front<Seq>::type::template apply<S, Pos>,
|
||||
apply_unchecked<
|
||||
typename boost::mpl::front<Seq>::type::template apply<S, Pos>
|
||||
>
|
||||
>
|
||||
{};
|
||||
};
|
||||
|
||||
template <class Seq>
|
||||
struct nth_of_c_impl<0, Seq>
|
||||
{
|
||||
typedef nth_of_c_impl type;
|
||||
|
||||
template <class S, class Pos>
|
||||
struct apply :
|
||||
boost::mpl::fold<
|
||||
typename boost::mpl::pop_front<Seq>::type,
|
||||
typename boost::mpl::front<Seq>::type::template apply<
|
||||
S,
|
||||
Pos
|
||||
>::type,
|
||||
skip_seq
|
||||
>
|
||||
{};
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_ONE_CHAR_EXCEPT_NOT_USED_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_ONE_CHAR_EXCEPT_NOT_USED_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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)
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
struct one_char_except_not_used {};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_ONE_OF_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_ONE_OF_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/v1/error/none_of_the_expected_cases_found.hpp>
|
||||
#include <boost/metaparse/v1/fail.hpp>
|
||||
|
||||
#include <boost/metaparse/v1/impl/one_of_fwd_op.hpp>
|
||||
|
||||
#include <boost/mpl/fold.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <class Parsers>
|
||||
struct one_of
|
||||
{
|
||||
typedef one_of type;
|
||||
|
||||
template <class S, class Pos>
|
||||
struct apply :
|
||||
boost::mpl::fold<
|
||||
Parsers,
|
||||
fail<error::none_of_the_expected_cases_found>::apply<S, Pos>,
|
||||
one_of_fwd_op<S, Pos>
|
||||
>::type
|
||||
{};
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_ONE_OF_FWD_OP_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_ONE_OF_FWD_OP_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
|
||||
// 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/metaparse/v1/is_error.hpp>
|
||||
#include <boost/metaparse/v1/impl/later_result.hpp>
|
||||
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <class S, class Pos>
|
||||
struct one_of_fwd_op
|
||||
{
|
||||
typedef one_of_fwd_op type;
|
||||
|
||||
template <class State, class P>
|
||||
struct apply :
|
||||
boost::mpl::eval_if<
|
||||
typename is_error<State>::type,
|
||||
boost::mpl::eval_if<
|
||||
typename is_error<typename P::template apply<S, Pos> >::type,
|
||||
later_result<State, typename P::template apply<S, Pos> >,
|
||||
typename P::template apply<S, Pos>
|
||||
>,
|
||||
State
|
||||
>
|
||||
{};
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_POP_BACK_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_POP_BACK_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/config.hpp>
|
||||
#include <boost/metaparse/v1/fwd/string.hpp>
|
||||
#include <boost/metaparse/v1/impl/push_front_c.hpp>
|
||||
#include <boost/metaparse/v1/impl/size.hpp>
|
||||
#include <boost/metaparse/v1/impl/update_c.hpp>
|
||||
|
||||
#include <boost/mpl/clear.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <class S>
|
||||
struct pop_back;
|
||||
|
||||
#ifdef BOOST_METAPARSE_VARIADIC_STRING
|
||||
template <char C>
|
||||
struct pop_back<string<C>> : boost::mpl::clear<string<C>> {};
|
||||
|
||||
template <char C, char... Cs>
|
||||
struct pop_back<string<C, Cs...>> :
|
||||
push_front_c<typename pop_back<string<Cs...>>::type, C>
|
||||
{};
|
||||
#else
|
||||
template <class S>
|
||||
struct pop_back :
|
||||
update_c<
|
||||
typename S::type,
|
||||
size<typename S::type>::type::value - 1,
|
||||
BOOST_NO_CHAR
|
||||
>
|
||||
{};
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_POP_FRONT_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_POP_FRONT_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/config.hpp>
|
||||
#include <boost/metaparse/v1/fwd/string.hpp>
|
||||
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <class S>
|
||||
struct pop_front;
|
||||
|
||||
#ifdef BOOST_METAPARSE_VARIADIC_STRING
|
||||
template <char C, char... Cs>
|
||||
struct pop_front<string<C, Cs...>> : string<Cs...> {};
|
||||
#else
|
||||
#ifdef BOOST_METAPARSE_POP_FRONT
|
||||
# error BOOST_METAPARSE_POP_FRONT already defined
|
||||
#endif
|
||||
#define BOOST_METAPARSE_POP_FRONT(z, n, unused) \
|
||||
BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) BOOST_PP_CAT(C, n)
|
||||
|
||||
template < \
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, int C) \
|
||||
>
|
||||
struct
|
||||
pop_front<
|
||||
string<BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, C)>
|
||||
> :
|
||||
string<
|
||||
BOOST_PP_REPEAT_FROM_TO(
|
||||
1,
|
||||
BOOST_METAPARSE_LIMIT_STRING_SIZE,
|
||||
BOOST_METAPARSE_POP_FRONT,
|
||||
~
|
||||
),
|
||||
BOOST_NO_CHAR
|
||||
>
|
||||
{};
|
||||
|
||||
#undef BOOST_METAPARSE_POP_FRONT
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
#ifndef BOOST_METAPARSE_V1_PUSH_BACK_C_HPP
|
||||
#define BOOST_METAPARSE_V1_PUSH_BACK_C_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/config.hpp>
|
||||
#include <boost/metaparse/v1/fwd/string.hpp>
|
||||
#include <boost/metaparse/v1/impl/update_c.hpp>
|
||||
#include <boost/metaparse/v1/impl/size.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <class S, char C>
|
||||
struct push_back_c;
|
||||
|
||||
#ifdef BOOST_METAPARSE_VARIADIC_STRING
|
||||
template <char... Cs, char C>
|
||||
struct push_back_c<string<Cs...>, C> : string<Cs..., C> {};
|
||||
#else
|
||||
template <class S, char C>
|
||||
struct push_back_c :
|
||||
update_c<typename S::type, size<typename S::type>::type::value, C>
|
||||
{};
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_PUSH_FRONT_C_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_PUSH_FRONT_C_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/config.hpp>
|
||||
#include <boost/metaparse/v1/fwd/string.hpp>
|
||||
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <class S, char C>
|
||||
struct push_front_c;
|
||||
|
||||
#ifdef BOOST_METAPARSE_VARIADIC_STRING
|
||||
template <char... Cs, char C>
|
||||
struct push_front_c<string<Cs...>, C> : string<C, Cs...> {};
|
||||
#else
|
||||
template <
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, int C),
|
||||
char Ch
|
||||
>
|
||||
struct push_front_c<
|
||||
string<BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, C)>,
|
||||
Ch
|
||||
> :
|
||||
string<
|
||||
Ch,
|
||||
BOOST_PP_ENUM_PARAMS(
|
||||
BOOST_PP_DEC(BOOST_METAPARSE_LIMIT_STRING_SIZE),
|
||||
C
|
||||
)
|
||||
>
|
||||
{};
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_REMOVE_TRAILING_NO_CHARS_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_REMOVE_TRAILING_NO_CHARS_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/config.hpp>
|
||||
#include <boost/metaparse/v1/string.hpp>
|
||||
#include <boost/metaparse/v1/impl/push_front_c.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <class S>
|
||||
struct remove_trailing_no_chars : S {};
|
||||
|
||||
#ifdef BOOST_METAPARSE_VARIADIC_STRING
|
||||
// this code assumes that BOOST_NO_CHARs are at the end of the string
|
||||
template <char... Cs>
|
||||
struct remove_trailing_no_chars<string<BOOST_NO_CHAR, Cs...>> :
|
||||
string<>
|
||||
{};
|
||||
|
||||
template <char C, char... Cs>
|
||||
struct remove_trailing_no_chars<string<C, Cs...>> :
|
||||
push_front_c<typename remove_trailing_no_chars<string<Cs...>>::type,C>
|
||||
{};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/*
|
||||
* These specialisations are needed to avoid an internal compiler error
|
||||
* in Visual C++ 12
|
||||
*/
|
||||
template <char C>
|
||||
struct remove_trailing_no_chars<string<C>> : string<C> {};
|
||||
|
||||
template <>
|
||||
struct remove_trailing_no_chars<string<BOOST_NO_CHAR>> : string<> {};
|
||||
|
||||
template <>
|
||||
struct remove_trailing_no_chars<string<>> : string<> {};
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_RETURNS_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_RETURNS_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2014.
|
||||
// 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)
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <class T>
|
||||
struct returns
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_SEQUENCE_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_SEQUENCE_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/v1/impl/sequence_impl.hpp>
|
||||
#include <boost/metaparse/limit_sequence_size.hpp>
|
||||
|
||||
#include <boost/mpl/vector.hpp>
|
||||
|
||||
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
#ifdef BOOST_METAPARSE_SEQUENCE_CASE
|
||||
# error BOOST_METAPARSE_SEQUENCE_CASE already defined
|
||||
#endif
|
||||
#define BOOST_METAPARSE_SEQUENCE_CASE(z, n, unused) \
|
||||
template <BOOST_PP_ENUM_PARAMS(n, class P)> \
|
||||
struct BOOST_PP_CAT(sequence, n) \
|
||||
{ \
|
||||
typedef BOOST_PP_CAT(sequence, n) type; \
|
||||
\
|
||||
template <class S, class Pos> \
|
||||
struct apply : \
|
||||
sequence_impl< \
|
||||
boost::mpl::vector<BOOST_PP_ENUM_PARAMS(n, P)>, \
|
||||
S, \
|
||||
Pos \
|
||||
> \
|
||||
{}; \
|
||||
};
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(
|
||||
1,
|
||||
BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
|
||||
BOOST_METAPARSE_SEQUENCE_CASE,
|
||||
~
|
||||
)
|
||||
|
||||
#undef BOOST_METAPARSE_SEQUENCE_CASE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_SEQUENCE_IMPL_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_SEQUENCE_IMPL_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/v1/impl/apply_parser.hpp>
|
||||
#include <boost/metaparse/v1/accept.hpp>
|
||||
|
||||
#include <boost/mpl/deque.hpp>
|
||||
#include <boost/mpl/fold.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <class Ps, class S, class Pos>
|
||||
struct sequence_impl :
|
||||
boost::mpl::fold<
|
||||
Ps,
|
||||
accept<boost::mpl::deque<>, S, Pos>,
|
||||
apply_parser
|
||||
>
|
||||
{};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_SIZE_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_SIZE_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/config.hpp>
|
||||
#include <boost/metaparse/v1/fwd/string.hpp>
|
||||
|
||||
#include <boost/mpl/int.hpp>
|
||||
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/preprocessor/tuple/eat.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <class S>
|
||||
struct size;
|
||||
|
||||
#ifdef BOOST_METAPARSE_VARIADIC_STRING
|
||||
template <char... Cs>
|
||||
struct size<string<Cs...>> : boost::mpl::int_<sizeof...(Cs)> {};
|
||||
#else
|
||||
#ifdef BOOST_METAPARSE_STRING_CASE
|
||||
# error BOOST_METAPARSE_STRING_CASE
|
||||
#endif
|
||||
#define BOOST_METAPARSE_STRING_CASE(z, n, unused) \
|
||||
template <BOOST_PP_ENUM_PARAMS(n, int C)> \
|
||||
struct \
|
||||
size< \
|
||||
string< \
|
||||
BOOST_PP_ENUM_PARAMS(n, C) BOOST_PP_COMMA_IF(n) \
|
||||
BOOST_PP_ENUM( \
|
||||
BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_STRING_SIZE, n), \
|
||||
BOOST_NO_CHAR BOOST_PP_TUPLE_EAT(3), \
|
||||
~ \
|
||||
) \
|
||||
> \
|
||||
> : \
|
||||
boost::mpl::int_<n> \
|
||||
{};
|
||||
|
||||
BOOST_PP_REPEAT(
|
||||
BOOST_METAPARSE_LIMIT_STRING_SIZE,
|
||||
BOOST_METAPARSE_STRING_CASE,
|
||||
~
|
||||
)
|
||||
|
||||
#undef BOOST_METAPARSE_STRING_CASE
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_SKIP_SEQ_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_SKIP_SEQ_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/v1/is_error.hpp>
|
||||
#include <boost/metaparse/v1/accept.hpp>
|
||||
#include <boost/metaparse/v1/get_remaining.hpp>
|
||||
#include <boost/metaparse/v1/get_position.hpp>
|
||||
#include <boost/metaparse/v1/get_result.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
struct skip_seq
|
||||
{
|
||||
private:
|
||||
template <class ParsingResult, class NewResultValue>
|
||||
struct change_result :
|
||||
accept<
|
||||
NewResultValue,
|
||||
typename get_remaining<ParsingResult>::type,
|
||||
typename get_position<ParsingResult>::type
|
||||
>
|
||||
{};
|
||||
|
||||
template <class Result, class P>
|
||||
struct apply_unchecked :
|
||||
boost::mpl::eval_if<
|
||||
typename is_error<
|
||||
typename P::template apply<
|
||||
typename get_remaining<Result>::type,
|
||||
typename get_position<Result>::type
|
||||
>
|
||||
>::type,
|
||||
typename P::template apply<
|
||||
typename get_remaining<Result>::type,
|
||||
typename get_position<Result>::type
|
||||
>,
|
||||
change_result<
|
||||
typename P::template apply<
|
||||
typename get_remaining<Result>::type,
|
||||
typename get_position<Result>::type
|
||||
>,
|
||||
typename get_result<Result>::type
|
||||
>
|
||||
>
|
||||
{};
|
||||
|
||||
public:
|
||||
template <class Result, class P>
|
||||
struct apply :
|
||||
boost::mpl::eval_if<
|
||||
is_error<Result>,
|
||||
Result,
|
||||
apply_unchecked<Result, P>
|
||||
>
|
||||
{};
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_SPLIT_AT_C_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_SPLIT_AT_C_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/config.hpp>
|
||||
#include <boost/metaparse/v1/fwd/string.hpp>
|
||||
#include <boost/metaparse/v1/impl/push_front_c.hpp>
|
||||
|
||||
#include <boost/preprocessor/arithmetic/add.hpp>
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
|
||||
#include <boost/mpl/pair.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <int N, class S>
|
||||
struct split_at_c;
|
||||
|
||||
#ifdef BOOST_METAPARSE_VARIADIC_STRING
|
||||
template <int N, char C, char... Cs>
|
||||
struct split_at_c<N, string<C, Cs...>> :
|
||||
boost::mpl::pair<
|
||||
typename push_front_c<
|
||||
typename split_at_c<N - 1, string<Cs...>>::type::first,
|
||||
C
|
||||
>::type,
|
||||
typename split_at_c<N - 1, string<Cs...>>::type::second
|
||||
>
|
||||
{};
|
||||
|
||||
template <char C, char... Cs>
|
||||
struct split_at_c<0, string<C, Cs...>> :
|
||||
boost::mpl::pair<string<>, string<C, Cs...>>
|
||||
{};
|
||||
|
||||
template <class S>
|
||||
struct split_at_c<0, S> : boost::mpl::pair<string<>, S> {};
|
||||
#else
|
||||
#ifdef BOOST_METAPARSE_ARG
|
||||
# error BOOST_METAPARSE_ARG already defined
|
||||
#endif
|
||||
#define BOOST_METAPARSE_ARG(z, n, d) BOOST_PP_CAT(C, BOOST_PP_ADD(n, d))
|
||||
|
||||
#ifdef BOOST_METAPARSE_SPLIT_AT
|
||||
# error BOOST_METAPARSE_SPLIT_AT already defined
|
||||
#endif
|
||||
#define BOOST_METAPARSE_SPLIT_AT(z, n, unused) \
|
||||
template < \
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, int C) \
|
||||
> \
|
||||
struct \
|
||||
split_at_c< \
|
||||
n, \
|
||||
string<BOOST_PP_ENUM_PARAMS( \
|
||||
BOOST_METAPARSE_LIMIT_STRING_SIZE, C) \
|
||||
> \
|
||||
> : \
|
||||
boost::mpl::pair< \
|
||||
string<BOOST_PP_ENUM_PARAMS(n, C)>, \
|
||||
string< \
|
||||
BOOST_PP_ENUM( \
|
||||
BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_STRING_SIZE, n), \
|
||||
BOOST_METAPARSE_ARG, \
|
||||
n \
|
||||
) \
|
||||
> \
|
||||
> \
|
||||
{};
|
||||
|
||||
BOOST_PP_REPEAT(
|
||||
BOOST_METAPARSE_LIMIT_STRING_SIZE,
|
||||
BOOST_METAPARSE_SPLIT_AT,
|
||||
~
|
||||
)
|
||||
|
||||
#undef BOOST_METAPARSE_SPLIT_AT
|
||||
#undef BOOST_METAPARSE_ARG
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,41 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_STRING_AT_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_STRING_AT_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2016.
|
||||
// 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/metaparse/config.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/metaparse/v1/impl/no_char.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <int MaxLen, int Len, class T>
|
||||
BOOST_CONSTEXPR int string_at(const T (&s)[Len], int n)
|
||||
{
|
||||
// "MaxLen + 1" adds the \0 character of the string literal to the
|
||||
// limit
|
||||
BOOST_STATIC_ASSERT((Len <= MaxLen + 1));
|
||||
return n >= Len - 1 ? BOOST_NO_CHAR : s[n];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BOOST_METAPARSE_V1_STRING_AT
|
||||
# error BOOST_METAPARSE_V1_STRING_AT already defined
|
||||
#endif
|
||||
#define BOOST_METAPARSE_V1_STRING_AT \
|
||||
::boost::metaparse::v1::impl::string_at<BOOST_METAPARSE_LIMIT_STRING_SIZE>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_STRING_ITERATOR_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_STRING_ITERATOR_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/v1/impl/string_iterator_tag.hpp>
|
||||
#include <boost/metaparse/v1/impl/at_c.hpp>
|
||||
|
||||
|
||||
#include <boost/mpl/iterator_tags.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
// string_iterator
|
||||
template <class S, int N>
|
||||
struct string_iterator
|
||||
{
|
||||
typedef string_iterator type;
|
||||
typedef string_iterator_tag tag;
|
||||
typedef boost::mpl::random_access_iterator_tag category;
|
||||
};
|
||||
|
||||
// advance_c
|
||||
|
||||
template <class S, int N>
|
||||
struct advance_c;
|
||||
|
||||
template <class S, int N, int P>
|
||||
struct advance_c<string_iterator<S, N>, P> :
|
||||
string_iterator<S, N + P>
|
||||
{};
|
||||
|
||||
// distance
|
||||
|
||||
template <class A, class B>
|
||||
struct distance;
|
||||
|
||||
template <class S, int A, int B>
|
||||
struct distance<string_iterator<S, A>, string_iterator<S, B> > :
|
||||
boost::mpl::int_<B - A>
|
||||
{};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace mpl
|
||||
{
|
||||
// advance
|
||||
template <class S>
|
||||
struct advance_impl;
|
||||
|
||||
template <>
|
||||
struct advance_impl<boost::metaparse::v1::impl::string_iterator_tag>
|
||||
{
|
||||
typedef advance_impl type;
|
||||
|
||||
template <class S, class N>
|
||||
struct apply :
|
||||
boost::metaparse::v1::impl::advance_c<
|
||||
typename S::type, N::type::value
|
||||
>
|
||||
{};
|
||||
};
|
||||
|
||||
// distance
|
||||
template <class S>
|
||||
struct distance_impl;
|
||||
|
||||
template <>
|
||||
struct distance_impl<boost::metaparse::v1::impl::string_iterator_tag>
|
||||
{
|
||||
typedef distance_impl type;
|
||||
|
||||
template <class A, class B>
|
||||
struct apply :
|
||||
boost::metaparse::v1::impl::distance<
|
||||
typename A::type,
|
||||
typename B::type
|
||||
>
|
||||
{};
|
||||
};
|
||||
|
||||
// next
|
||||
template <class S>
|
||||
struct next;
|
||||
|
||||
template <class S, int N>
|
||||
struct next<boost::metaparse::v1::impl::string_iterator<S, N> > :
|
||||
boost::metaparse::v1::impl::string_iterator<S, N + 1>
|
||||
{};
|
||||
|
||||
// prior
|
||||
template <class S>
|
||||
struct prior;
|
||||
|
||||
template <class S, int N>
|
||||
struct prior<boost::metaparse::v1::impl::string_iterator<S, N> > :
|
||||
boost::metaparse::v1::impl::string_iterator<S, N - 1>
|
||||
{};
|
||||
|
||||
// deref
|
||||
template <class S>
|
||||
struct deref;
|
||||
|
||||
template <class S, int N>
|
||||
struct deref<boost::metaparse::v1::impl::string_iterator<S, N> > :
|
||||
boost::metaparse::v1::impl::at_c<S, N>
|
||||
{};
|
||||
|
||||
// equal_to
|
||||
template <class A, class B>
|
||||
struct equal_to_impl;
|
||||
|
||||
template <>
|
||||
struct equal_to_impl<
|
||||
boost::metaparse::v1::impl::string_iterator_tag,
|
||||
boost::metaparse::v1::impl::string_iterator_tag
|
||||
>
|
||||
{
|
||||
typedef equal_to_impl type;
|
||||
|
||||
template <class A, class B>
|
||||
struct apply : is_same<typename A::type, typename B::type> {};
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct equal_to_impl<boost::metaparse::v1::impl::string_iterator_tag, T>
|
||||
{
|
||||
typedef equal_to_impl type;
|
||||
|
||||
template <class, class>
|
||||
struct apply : false_ {};
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct equal_to_impl<T, boost::metaparse::v1::impl::string_iterator_tag> :
|
||||
equal_to_impl<boost::metaparse::v1::impl::string_iterator_tag, T>
|
||||
{};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_STRING_ITERATOR_TAG_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_STRING_ITERATOR_TAG_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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)
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
struct string_iterator_tag
|
||||
{
|
||||
typedef string_iterator_tag type;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_UPDATE_C_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_UPDATE_C_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
|
||||
// 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/metaparse/config.hpp>
|
||||
#include <boost/metaparse/v1/fwd/string.hpp>
|
||||
#include <boost/metaparse/v1/impl/split_at_c.hpp>
|
||||
#include <boost/metaparse/v1/impl/concat.hpp>
|
||||
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
#include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
#ifndef BOOST_METAPARSE_VARIADIC_STRING
|
||||
template <class S, int N, int C>
|
||||
struct update_c;
|
||||
|
||||
#ifdef BOOST_METAPARSE_ARGN
|
||||
# error BOOST_METAPARSE_ARGN already defined
|
||||
#endif
|
||||
#define BOOST_METAPARSE_ARGN(z, n, unused) , BOOST_PP_CAT(C, n)
|
||||
|
||||
#ifdef BOOST_METAPARSE_UPDATE
|
||||
# error BOOST_METAPARSE_UPDATE already defined
|
||||
#endif
|
||||
#define BOOST_METAPARSE_UPDATE(z, n, unused) \
|
||||
template < \
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, int C), \
|
||||
int Ch \
|
||||
> \
|
||||
struct update_c< \
|
||||
string<BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, C)>,\
|
||||
n, \
|
||||
Ch \
|
||||
> : \
|
||||
string< \
|
||||
BOOST_PP_ENUM_PARAMS(n, C) BOOST_PP_COMMA_IF(n) \
|
||||
Ch \
|
||||
BOOST_PP_REPEAT_FROM_TO( \
|
||||
BOOST_PP_INC(n), \
|
||||
BOOST_PP_DEC(BOOST_METAPARSE_LIMIT_STRING_SIZE), \
|
||||
BOOST_METAPARSE_ARGN, \
|
||||
~ \
|
||||
) \
|
||||
> \
|
||||
{};
|
||||
|
||||
BOOST_PP_REPEAT(
|
||||
BOOST_METAPARSE_LIMIT_STRING_SIZE,
|
||||
BOOST_METAPARSE_UPDATE,
|
||||
~
|
||||
)
|
||||
|
||||
#undef BOOST_METAPARSE_UPDATE
|
||||
#undef BOOST_METAPARSE_ARGN
|
||||
#else
|
||||
template <class S, int N, char C>
|
||||
struct update_c :
|
||||
concat<
|
||||
typename split_at_c<N, S>::type::first,
|
||||
typename
|
||||
update_c<typename split_at_c<N, S>::type::second, 0, C>::type
|
||||
>
|
||||
{};
|
||||
|
||||
template <char... Cs, char C, char NewChar>
|
||||
struct update_c<string<C, Cs...>, 0, NewChar> :
|
||||
string<NewChar, Cs...>
|
||||
{};
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_VOID_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_VOID_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
|
||||
// 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)
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
struct void_ { typedef void_ type; };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user