|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r71243 - in branches/release/boost/spirit: . home home/karma home/karma/numeric home/karma/numeric/detail home/karma/stream home/lex home/lex/lexer home/lex/lexer/lexertl home/phoenix/core home/qi/detail home/qi/numeric home/qi/numeric/detail home/support home/support/auto home/support/detail home/support/utree/detail include repository/home/support
From: hartmut.kaiser_at_[hidden]
Date: 2011-04-14 10:12:54
Author: hkaiser
Date: 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
New Revision: 71243
URL: http://svn.boost.org/trac/boost/changeset/71243
Log:
Spirit: merging Phoenix V3 support from trunk
Added:
branches/release/boost/spirit/home/lex/argument_phoenix.hpp
- copied, changed from r70657, /trunk/boost/spirit/home/lex/argument_phoenix.hpp
branches/release/boost/spirit/home/lex/lexer/support_functions_expression.hpp
- copied, changed from r70657, /trunk/boost/spirit/home/lex/lexer/support_functions_expression.hpp
branches/release/boost/spirit/home/support/argument_expression.hpp
- copied, changed from r70657, /trunk/boost/spirit/home/support/argument_expression.hpp
branches/release/boost/spirit/home/support/detail/is_spirit_tag.hpp (contents, props changed)
branches/release/boost/spirit/home/support/limits.hpp
- copied unchanged from r70657, /trunk/boost/spirit/home/support/limits.hpp
branches/release/boost/spirit/home/support/terminal_expression.hpp
- copied, changed from r70657, /trunk/boost/spirit/home/support/terminal_expression.hpp
branches/release/boost/spirit/include/phoenix_limits.hpp
- copied unchanged from r71193, /trunk/boost/spirit/include/phoenix_limits.hpp
Properties modified:
branches/release/boost/spirit/ (props changed)
branches/release/boost/spirit/home/ (props changed)
branches/release/boost/spirit/home/karma/ (props changed)
branches/release/boost/spirit/home/support/attributes.hpp (contents, props changed)
Text files modified:
branches/release/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp | 644 +++++++++++++++++++++------------------
branches/release/boost/spirit/home/karma/numeric/detail/real_utils.hpp | 25
branches/release/boost/spirit/home/karma/numeric/int.hpp | 18
branches/release/boost/spirit/home/karma/numeric/real_policies.hpp | 19
branches/release/boost/spirit/home/karma/numeric/uint.hpp | 6
branches/release/boost/spirit/home/karma/stream/stream.hpp | 6
branches/release/boost/spirit/home/lex/argument.hpp | 132 +++----
branches/release/boost/spirit/home/lex/argument_phoenix.hpp | 107 ++++--
branches/release/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp | 40 --
branches/release/boost/spirit/home/lex/lexer/support_functions.hpp | 45 +-
branches/release/boost/spirit/home/lex/lexer/support_functions_expression.hpp | 53 ++-
branches/release/boost/spirit/home/phoenix/core/argument.hpp | 18
branches/release/boost/spirit/home/qi/detail/alternative_function.hpp | 10
branches/release/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp | 29 +
branches/release/boost/spirit/home/qi/numeric/detail/real_impl.hpp | 2
branches/release/boost/spirit/home/qi/numeric/numeric_utils.hpp | 2
branches/release/boost/spirit/home/qi/numeric/uint.hpp | 2
branches/release/boost/spirit/home/support/action_dispatch.hpp | 136 ++++++++
branches/release/boost/spirit/home/support/adapt_adt_attributes.hpp | 36 ++
branches/release/boost/spirit/home/support/argument.hpp | 89 +++-
branches/release/boost/spirit/home/support/argument_expression.hpp | 14
branches/release/boost/spirit/home/support/attributes.hpp | 169 ++++++---
branches/release/boost/spirit/home/support/auto/meta_create.hpp | 1
branches/release/boost/spirit/home/support/char_class.hpp | 330 ++++++++++----------
branches/release/boost/spirit/home/support/common_terminals.hpp | 4
branches/release/boost/spirit/home/support/container.hpp | 42 +-
branches/release/boost/spirit/home/support/context.hpp | 124 +++++--
branches/release/boost/spirit/home/support/detail/make_cons.hpp | 1
branches/release/boost/spirit/home/support/detail/pow10.hpp | 117 ++++---
branches/release/boost/spirit/home/support/lazy.hpp | 6
branches/release/boost/spirit/home/support/make_component.hpp | 166 ++++++++-
branches/release/boost/spirit/home/support/meta_compiler.hpp | 2
branches/release/boost/spirit/home/support/modify.hpp | 1
branches/release/boost/spirit/home/support/numeric_traits.hpp | 15
branches/release/boost/spirit/home/support/terminal.hpp | 150 +++++++--
branches/release/boost/spirit/home/support/terminal_expression.hpp | 12
branches/release/boost/spirit/home/support/utree/detail/utree_detail2.hpp | 2
branches/release/boost/spirit/include/phoenix.hpp | 6
branches/release/boost/spirit/include/phoenix_algorithm.hpp | 6
branches/release/boost/spirit/include/phoenix_bind.hpp | 6
branches/release/boost/spirit/include/phoenix_container.hpp | 6
branches/release/boost/spirit/include/phoenix_core.hpp | 7
branches/release/boost/spirit/include/phoenix_function.hpp | 6
branches/release/boost/spirit/include/phoenix_fusion.hpp | 6
branches/release/boost/spirit/include/phoenix_object.hpp | 6
branches/release/boost/spirit/include/phoenix_operator.hpp | 6
branches/release/boost/spirit/include/phoenix_scope.hpp | 6
branches/release/boost/spirit/include/phoenix_statement.hpp | 6
branches/release/boost/spirit/include/phoenix_stl.hpp | 6
branches/release/boost/spirit/repository/home/support/confix.hpp | 2
branches/release/boost/spirit/repository/home/support/distinct.hpp | 2
51 files changed, 1677 insertions(+), 975 deletions(-)
Modified: branches/release/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp (original)
+++ branches/release/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -17,6 +17,7 @@
#include <boost/type_traits/is_integral.hpp>
#include <boost/spirit/home/support/char_class.hpp>
#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/numeric_traits.hpp>
#include <boost/spirit/home/support/detail/pow10.hpp>
#include <boost/spirit/home/support/detail/sign.hpp>
#include <boost/spirit/home/karma/detail/generate_to.hpp>
@@ -40,34 +41,32 @@
#error "Please set the BOOST_KARMA_NUMERICS_LOOP_UNROLL to a non-negative value!"
#endif
-namespace boost { namespace spirit { namespace karma
+namespace boost { namespace spirit { namespace traits
{
- namespace detail
+ ///////////////////////////////////////////////////////////////////////
+ //
+ // return the absolute value from a given number, avoiding over- and
+ // underflow
+ //
+ ///////////////////////////////////////////////////////////////////////
+ template <typename T, typename Enable/* = void*/>
+ struct absolute_value
{
- ///////////////////////////////////////////////////////////////////////
- //
- // return the absolute value from a given number, avoiding over- and
- // underflow
- //
- ///////////////////////////////////////////////////////////////////////
- template <typename T>
- struct absolute_value_helper
+ typedef T type;
+ static T call (T n)
{
- typedef T result_type;
- static T call (T n)
- {
- // allow for ADL to find the correct overloads for fabs
- using namespace std;
- return fabs(n);
- }
- };
+ // allow for ADL to find the correct overloads for fabs
+ using namespace std;
+ return fabs(n);
+ }
+ };
-#define BOOST_SPIRIT_ABSOLUTE_VALUE(type, unsignedtype) \
+#define BOOST_SPIRIT_ABSOLUTE_VALUE(signedtype, unsignedtype) \
template <> \
- struct absolute_value_helper<type> \
+ struct absolute_value<signedtype> \
{ \
- typedef unsignedtype result_type; \
- static result_type call(type n) \
+ typedef unsignedtype type; \
+ static type call(signedtype n) \
{ \
return (n >= 0) ? n : (unsignedtype)(-n); \
} \
@@ -75,367 +74,410 @@
/**/
#define BOOST_SPIRIT_ABSOLUTE_VALUE_UNSIGNED(unsignedtype) \
template <> \
- struct absolute_value_helper<unsignedtype> \
+ struct absolute_value<unsignedtype> \
{ \
- typedef unsignedtype result_type; \
- static result_type call(unsignedtype n) \
+ typedef unsignedtype type; \
+ static type call(unsignedtype n) \
{ \
return n; \
} \
} \
/**/
- BOOST_SPIRIT_ABSOLUTE_VALUE(signed char, unsigned char);
- BOOST_SPIRIT_ABSOLUTE_VALUE(char, unsigned char);
- BOOST_SPIRIT_ABSOLUTE_VALUE(short, unsigned short);
- BOOST_SPIRIT_ABSOLUTE_VALUE(int, unsigned int);
- BOOST_SPIRIT_ABSOLUTE_VALUE(long, unsigned long);
- BOOST_SPIRIT_ABSOLUTE_VALUE_UNSIGNED(unsigned char);
- BOOST_SPIRIT_ABSOLUTE_VALUE_UNSIGNED(unsigned short);
- BOOST_SPIRIT_ABSOLUTE_VALUE_UNSIGNED(unsigned int);
- BOOST_SPIRIT_ABSOLUTE_VALUE_UNSIGNED(unsigned long);
+ BOOST_SPIRIT_ABSOLUTE_VALUE(signed char, unsigned char);
+ BOOST_SPIRIT_ABSOLUTE_VALUE(char, unsigned char);
+ BOOST_SPIRIT_ABSOLUTE_VALUE(short, unsigned short);
+ BOOST_SPIRIT_ABSOLUTE_VALUE(int, unsigned int);
+ BOOST_SPIRIT_ABSOLUTE_VALUE(long, unsigned long);
+ BOOST_SPIRIT_ABSOLUTE_VALUE_UNSIGNED(unsigned char);
+ BOOST_SPIRIT_ABSOLUTE_VALUE_UNSIGNED(unsigned short);
+ BOOST_SPIRIT_ABSOLUTE_VALUE_UNSIGNED(unsigned int);
+ BOOST_SPIRIT_ABSOLUTE_VALUE_UNSIGNED(unsigned long);
#ifdef BOOST_HAS_LONG_LONG
- BOOST_SPIRIT_ABSOLUTE_VALUE(boost::long_long_type, boost::ulong_long_type);
- BOOST_SPIRIT_ABSOLUTE_VALUE_UNSIGNED(boost::ulong_long_type);
+ BOOST_SPIRIT_ABSOLUTE_VALUE(boost::long_long_type, boost::ulong_long_type);
+ BOOST_SPIRIT_ABSOLUTE_VALUE_UNSIGNED(boost::ulong_long_type);
#endif
#undef BOOST_SPIRIT_ABSOLUTE_VALUE
#undef BOOST_SPIRIT_ABSOLUTE_VALUE_UNSIGNED
- template <>
- struct absolute_value_helper<float>
+ template <>
+ struct absolute_value<float>
+ {
+ typedef float type;
+ static type call(float n)
{
- typedef float result_type;
- static result_type call(float n)
- {
- return (spirit::detail::signbit)(n) ? -n : n;
- }
- };
+ return (spirit::detail::signbit)(n) ? -n : n;
+ }
+ };
- template <>
- struct absolute_value_helper<double>
+ template <>
+ struct absolute_value<double>
+ {
+ typedef double type;
+ static type call(double n)
{
- typedef double result_type;
- static result_type call(double n)
- {
- return (spirit::detail::signbit)(n) ? -n : n;
- }
- };
+ return (spirit::detail::signbit)(n) ? -n : n;
+ }
+ };
- template <>
- struct absolute_value_helper<long double>
+ template <>
+ struct absolute_value<long double>
+ {
+ typedef long double type;
+ static type call(long double n)
{
- typedef long double result_type;
- static result_type call(long double n)
- {
- return (spirit::detail::signbit)(n) ? -n : n;
- }
- };
+ return (spirit::detail::signbit)(n) ? -n : n;
+ }
+ };
- // specialization for pointers
- template <typename T>
- struct absolute_value_helper<T*>
+ // specialization for pointers
+ template <typename T>
+ struct absolute_value<T*>
+ {
+ typedef std::size_t type;
+ static type call (T* p)
{
- typedef std::size_t result_type;
- static std::size_t call (T* p)
- {
- return std::size_t(p);
- }
- };
+ return std::size_t(p);
+ }
+ };
- template <typename T>
- typename absolute_value_helper<T>::result_type
- absolute_value(T n)
- {
- return absolute_value_helper<T>::call(n);
+ template <typename T>
+ inline typename absolute_value<T>::type
+ get_absolute_value(T n)
+ {
+ return absolute_value<T>::call(n);
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+ template <typename T, typename Enable/* = void*/>
+ struct is_negative
+ {
+ static bool call(T n)
+ {
+ return (n < 0) ? true : false;
}
+ };
- ///////////////////////////////////////////////////////////////////////
- inline bool is_negative(float n)
+ template <>
+ struct is_negative<float>
+ {
+ static bool call(float n)
{
return (spirit::detail::signbit)(n) ? true : false;
}
+ };
- inline bool is_negative(double n)
+ template <>
+ struct is_negative<double>
+ {
+ static bool call(double n)
{
return (spirit::detail::signbit)(n) ? true : false;
}
+ };
- inline bool is_negative(long double n)
+ template <>
+ struct is_negative<long double>
+ {
+ static bool call(long double n)
{
return (spirit::detail::signbit)(n) ? true : false;
}
+ };
- template <typename T>
- inline bool is_negative(T n)
- {
- return (n < 0) ? true : false;
+ template <typename T>
+ inline bool test_negative(T n)
+ {
+ return is_negative<T>::call(n);
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+ template <typename T, typename Enable/* = void*/>
+ struct is_zero
+ {
+ static bool call(T n)
+ {
+ return (n == 0) ? true : false;
}
+ };
- ///////////////////////////////////////////////////////////////////////
- inline bool is_zero(float n)
+ template <>
+ struct is_zero<float>
+ {
+ static bool call(float n)
{
return (math::fpclassify)(n) == FP_ZERO;
}
+ };
- inline bool is_zero(double n)
+ template <>
+ struct is_zero<double>
+ {
+ static bool call(double n)
{
return (math::fpclassify)(n) == FP_ZERO;
}
+ };
- inline bool is_zero(long double n)
+ template <>
+ struct is_zero<long double>
+ {
+ static bool call(long double n)
{
return (math::fpclassify)(n) == FP_ZERO;
}
+ };
- template <typename T>
- inline bool is_zero(T n)
+ template <typename T>
+ inline bool test_zero(T n)
+ {
+ return is_zero<T>::call(n);
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+ struct cast_to_long
+ {
+ static long call(float n, mpl::false_)
{
- return (n == 0) ? true : false;
+ return static_cast<long>(std::floor(n));
}
- ///////////////////////////////////////////////////////////////////////
- struct cast_to_long
+ static long call(double n, mpl::false_)
{
- static long call(float n, mpl::false_)
- {
- return static_cast<long>(std::floor(n));
- }
-
- static long call(double n, mpl::false_)
- {
- return static_cast<long>(std::floor(n));
- }
+ return static_cast<long>(std::floor(n));
+ }
- static long call(long double n, mpl::false_)
- {
- return static_cast<long>(std::floor(n));
- }
+ static long call(long double n, mpl::false_)
+ {
+ return static_cast<long>(std::floor(n));
+ }
- template <typename T>
- static long call(T n, mpl::false_)
- {
- // allow for ADL to find the correct overload for floor and
- // lround
- using namespace std;
- return lround(floor(n));
- }
+ template <typename T>
+ static long call(T n, mpl::false_)
+ {
+ // allow for ADL to find the correct overload for floor and
+ // lround
+ using namespace std;
+ return lround(floor(n));
+ }
- template <typename T>
- static long call(T n, mpl::true_)
- {
- return static_cast<long>(n);
- }
+ template <typename T>
+ static long call(T n, mpl::true_)
+ {
+ return static_cast<long>(n);
+ }
- template <typename T>
- static long call(T n)
- {
- return call(n, mpl::bool_<is_integral<T>::value>());
- }
- };
+ template <typename T>
+ static long call(T n)
+ {
+ return call(n, mpl::bool_<is_integral<T>::value>());
+ }
+ };
- ///////////////////////////////////////////////////////////////////////
- struct truncate_to_long
+ ///////////////////////////////////////////////////////////////////////
+ struct truncate_to_long
+ {
+ static long call(float n, mpl::false_)
{
- static long call(float n, mpl::false_)
- {
- return is_negative(n) ? static_cast<long>(std::ceil(n)) :
- static_cast<long>(std::floor(n));
- }
+ return test_negative(n) ? static_cast<long>(std::ceil(n)) :
+ static_cast<long>(std::floor(n));
+ }
- static long call(double n, mpl::false_)
- {
- return is_negative(n) ? static_cast<long>(std::ceil(n)) :
- static_cast<long>(std::floor(n));
- }
+ static long call(double n, mpl::false_)
+ {
+ return test_negative(n) ? static_cast<long>(std::ceil(n)) :
+ static_cast<long>(std::floor(n));
+ }
- static long call(long double n, mpl::false_)
- {
- return is_negative(n) ? static_cast<long>(std::ceil(n)) :
- static_cast<long>(std::floor(n));
- }
+ static long call(long double n, mpl::false_)
+ {
+ return test_negative(n) ? static_cast<long>(std::ceil(n)) :
+ static_cast<long>(std::floor(n));
+ }
- template <typename T>
- static long call(T n, mpl::false_)
- {
- // allow for ADL to find the correct overloads for ltrunc
- using namespace std;
- return ltrunc(n);
- }
+ template <typename T>
+ static long call(T n, mpl::false_)
+ {
+ // allow for ADL to find the correct overloads for ltrunc
+ using namespace std;
+ return ltrunc(n);
+ }
- template <typename T>
- static long call(T n, mpl::true_)
- {
- return static_cast<long>(n);
- }
+ template <typename T>
+ static long call(T n, mpl::true_)
+ {
+ return static_cast<long>(n);
+ }
- template <typename T>
- static long call(T n)
- {
- return call(n, mpl::bool_<is_integral<T>::value>());
- }
- };
+ template <typename T>
+ static long call(T n)
+ {
+ return call(n, mpl::bool_<is_integral<T>::value>());
+ }
+ };
- ///////////////////////////////////////////////////////////////////////
- //
- // Traits class for radix specific number conversion
- //
- // Convert a digit from binary representation to character
- // representation:
- //
- // static int digit(unsigned n);
- //
- ///////////////////////////////////////////////////////////////////////
- template<unsigned Radix, typename CharEncoding, typename Tag>
- struct radix_traits;
-
- // Binary
- template<typename CharEncoding, typename Tag>
- struct radix_traits<2, CharEncoding, Tag>
+ ///////////////////////////////////////////////////////////////////////
+ //
+ // Traits class for radix specific number conversion
+ //
+ // Convert a digit from binary representation to character
+ // representation:
+ //
+ // static int call(unsigned n);
+ //
+ ///////////////////////////////////////////////////////////////////////
+ template <unsigned Radix, typename CharEncoding, typename Tag>
+ struct convert_digit;
+
+ // Binary
+ template <typename CharEncoding, typename Tag>
+ struct convert_digit<2, CharEncoding, Tag>
+ {
+ static int call(unsigned n)
{
- static int digit(unsigned n)
- {
- return n + '0';
- }
- };
+ return n + '0';
+ }
+ };
- // Octal
- template<typename CharEncoding, typename Tag>
- struct radix_traits<8, CharEncoding, Tag>
+ // Octal
+ template <typename CharEncoding, typename Tag>
+ struct convert_digit<8, CharEncoding, Tag>
+ {
+ static int call(unsigned n)
{
- static int digit(unsigned n)
- {
- return n + '0';
- }
- };
+ return n + '0';
+ }
+ };
- // Decimal
- template<typename CharEncoding, typename Tag>
- struct radix_traits<10, CharEncoding, Tag>
+ // Decimal
+ template <typename CharEncoding, typename Tag>
+ struct convert_digit<10, CharEncoding, Tag>
+ {
+ static int call(unsigned n)
{
- static int digit(unsigned n)
- {
- return n + '0';
- }
- };
+ return n + '0';
+ }
+ };
- // Hexadecimal, lower case
- template<>
- struct radix_traits<16, unused_type, unused_type>
+ // Hexadecimal, lower case
+ template <>
+ struct convert_digit<16, unused_type, unused_type>
+ {
+ static int call(unsigned n)
{
- static int digit(unsigned n)
- {
- if (n <= 9)
- return n + '0';
- return n - 10 + 'a';
- }
- };
+ if (n <= 9)
+ return n + '0';
+ return n - 10 + 'a';
+ }
+ };
- // Hexadecimal, upper case
- template<typename CharEncoding, typename Tag>
- struct radix_traits<16, CharEncoding, Tag>
+ // Hexadecimal, upper case
+ template <typename CharEncoding, typename Tag>
+ struct convert_digit<16, CharEncoding, Tag>
+ {
+ static int call(unsigned n)
{
- static int digit(unsigned n)
- {
- if (n <= 9)
- return n + '0';
+ if (n <= 9)
+ return n + '0';
- using spirit::char_class::convert;
- return convert<CharEncoding>::to(Tag(), n - 10 + 'a');
- }
- };
+ using spirit::char_class::convert;
+ return convert<CharEncoding>::to(Tag(), n - 10 + 'a');
+ }
+ };
- ///////////////////////////////////////////////////////////////////////
- template <unsigned Radix>
- struct divide
+ ///////////////////////////////////////////////////////////////////////
+ template <unsigned Radix>
+ struct divide
+ {
+ template <typename T>
+ static T call(T& n, mpl::true_)
{
- template <typename T>
- static T call(T& n, mpl::true_)
- {
- return n / Radix;
- }
-
- template <typename T>
- static T call(T& n, mpl::false_)
- {
- // Allow ADL to find the correct overload for floor
- using namespace std;
- return floor(n / Radix);
- }
+ return n / Radix;
+ }
- template <typename T>
- static T call(T& n, T const&, int)
- {
- return call(n, mpl::bool_<is_integral<T>::value>());
- }
+ template <typename T>
+ static T call(T& n, mpl::false_)
+ {
+ // Allow ADL to find the correct overload for floor
+ using namespace std;
+ return floor(n / Radix);
+ }
- template <typename T>
- static T call(T& n)
- {
- return call(n, mpl::bool_<is_integral<T>::value>());
- }
- };
+ template <typename T>
+ static T call(T& n, T const&, int)
+ {
+ return call(n, mpl::bool_<is_integral<T>::value>());
+ }
- // specialization for division by 10
- template <>
- struct divide<10>
+ template <typename T>
+ static T call(T& n)
{
- template <typename T>
- static T call(T& n, T, int, mpl::true_)
- {
- return n / 10;
- }
+ return call(n, mpl::bool_<is_integral<T>::value>());
+ }
+ };
- template <typename T>
- static T call(T, T& num, int exp, mpl::false_)
- {
- // Allow ADL to find the correct overload for floor
- using namespace std;
- return floor(num / spirit::detail::pow10<T>(exp));
- }
+ // specialization for division by 10
+ template <>
+ struct divide<10>
+ {
+ template <typename T>
+ static T call(T& n, T, int, mpl::true_)
+ {
+ return n / 10;
+ }
- template <typename T>
- static T call(T& n, T& num, int exp)
- {
- return call(n, num, exp, mpl::bool_<is_integral<T>::value>());
- }
+ template <typename T>
+ static T call(T, T& num, int exp, mpl::false_)
+ {
+ // Allow ADL to find the correct overload for floor
+ using namespace std;
+ return floor(num / spirit::traits::pow10<T>(exp));
+ }
- template <typename T>
- static T call(T& n)
- {
- return call(n, n, 1, mpl::bool_<is_integral<T>::value>());
- }
- };
+ template <typename T>
+ static T call(T& n, T& num, int exp)
+ {
+ return call(n, num, exp, mpl::bool_<is_integral<T>::value>());
+ }
- ///////////////////////////////////////////////////////////////////////
- template <unsigned Radix>
- struct remainder
+ template <typename T>
+ static T call(T& n)
{
- template <typename T>
- static long call(T n, mpl::true_)
- {
- // this cast is safe since we know the result is not larger
- // than Radix
- return static_cast<long>(n % Radix);
- }
+ return call(n, n, 1, mpl::bool_<is_integral<T>::value>());
+ }
+ };
- template <typename T>
- static long call(T n, mpl::false_)
- {
- // Allow ADL to find the correct overload for fmod
- using namespace std;
- return cast_to_long::call(fmod(n, T(Radix)));
- }
+ ///////////////////////////////////////////////////////////////////////
+ template <unsigned Radix>
+ struct remainder
+ {
+ template <typename T>
+ static long call(T n, mpl::true_)
+ {
+ // this cast is safe since we know the result is not larger
+ // than Radix
+ return static_cast<long>(n % Radix);
+ }
- template <typename T>
- static long call(T n)
- {
- return call(n, mpl::bool_<is_integral<T>::value>());
- }
- };
+ template <typename T>
+ static long call(T n, mpl::false_)
+ {
+ // Allow ADL to find the correct overload for fmod
+ using namespace std;
+ return cast_to_long::call(fmod(n, T(Radix)));
+ }
- } // namespace detail
+ template <typename T>
+ static long call(T n)
+ {
+ return call(n, mpl::bool_<is_integral<T>::value>());
+ }
+ };
+}}}
+namespace boost { namespace spirit { namespace karma
+{
///////////////////////////////////////////////////////////////////////////
//
// The int_inserter template takes care of the integer to string
@@ -448,8 +490,8 @@
//
///////////////////////////////////////////////////////////////////////////
#define BOOST_KARMA_NUMERICS_INNER_LOOP_PREFIX(z, x, data) \
- if (!detail::is_zero(n)) { \
- int ch = radix_type::digit(remainder_type::call(n)); \
+ if (!traits::test_zero(n)) { \
+ int ch = radix_type::call(remainder_type::call(n)); \
n = divide_type::call(n, num, ++exp); \
/**/
@@ -464,23 +506,23 @@
, typename Tag = unused_type>
struct int_inserter
{
- typedef detail::radix_traits<Radix, CharEncoding, Tag> radix_type;
- typedef detail::divide<Radix> divide_type;
- typedef detail::remainder<Radix> remainder_type;
+ typedef traits::convert_digit<Radix, CharEncoding, Tag> radix_type;
+ typedef traits::divide<Radix> divide_type;
+ typedef traits::remainder<Radix> remainder_type;
template <typename OutputIterator, typename T>
static bool
call(OutputIterator& sink, T n, T& num, int exp)
{
// remainder_type::call returns n % Radix
- int ch = radix_type::digit(remainder_type::call(n));
+ int ch = radix_type::call(remainder_type::call(n));
n = divide_type::call(n, num, ++exp);
BOOST_PP_REPEAT(
BOOST_KARMA_NUMERICS_LOOP_UNROLL,
BOOST_KARMA_NUMERICS_INNER_LOOP_PREFIX, _);
- if (!detail::is_zero(n))
+ if (!traits::test_zero(n))
call(sink, n, num, exp);
BOOST_PP_REPEAT(
@@ -576,7 +618,7 @@
static bool
call(OutputIterator& sink, T const& n)
{
- typedef typename detail::absolute_value_helper<T>::result_type type;
+ typedef typename traits::absolute_value<T>::type type;
type un = type(n);
return base_type::call(sink, un, un, 0);
}
Modified: branches/release/boost/spirit/home/karma/numeric/detail/real_utils.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/numeric/detail/real_utils.hpp (original)
+++ branches/release/boost/spirit/home/karma/numeric/detail/real_utils.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -115,7 +115,7 @@
bool force_sign = p.force_sign(n);
bool sign_val = false;
int flags = p.floatfield(n);
- if (detail::is_negative(n))
+ if (traits::test_negative(n))
{
n = -n;
sign_val = true;
@@ -137,23 +137,23 @@
using namespace std;
U dim = 0;
- if (0 == (Policies::fmtflags::fixed & flags) && !detail::is_zero(n))
+ if (0 == (Policies::fmtflags::fixed & flags) && !traits::test_zero(n))
{
dim = log10(n);
if (dim > 0)
- n /= spirit::detail::pow10<U>(detail::truncate_to_long::call(dim));
+ n /= spirit::traits::pow10<U>(traits::truncate_to_long::call(dim));
else if (n < 1.) {
- long exp = detail::truncate_to_long::call(-dim);
+ long exp = traits::truncate_to_long::call(-dim);
if (exp != -dim)
++exp;
dim = -exp;
- n *= spirit::detail::pow10<U>(exp);
+ n *= spirit::traits::pow10<U>(exp);
}
}
// prepare numbers (sign, integer and fraction part)
U integer_part;
- U precexp = spirit::detail::pow10<U>(precision);
+ U precexp = spirit::traits::pow10<U>(precision);
U fractional_part = modf(n, &integer_part);
fractional_part = floor(fractional_part * precexp + U(0.5));
@@ -174,9 +174,9 @@
if (0 != long_frac_part) {
// remove the trailing zeros
while (0 != prec &&
- 0 == detail::remainder<10>::call(long_frac_part))
+ 0 == traits::remainder<10>::call(long_frac_part))
{
- long_frac_part = detail::divide<10>::call(long_frac_part);
+ long_frac_part = traits::divide<10>::call(long_frac_part);
--prec;
}
}
@@ -189,13 +189,13 @@
if (precision != prec)
{
long_frac_part = frac_part_floor /
- spirit::detail::pow10<U>(precision-prec);
+ spirit::traits::pow10<U>(precision-prec);
}
}
// call the actual generating functions to output the different parts
- if (sign_val && detail::is_zero(long_int_part) &&
- detail::is_zero(long_frac_part))
+ if (sign_val && traits::test_zero(long_int_part) &&
+ traits::test_zero(long_frac_part))
{
sign_val = false; // result is zero, no sign please
}
@@ -211,7 +211,7 @@
if (r && 0 == (Policies::fmtflags::fixed & flags)) {
return p.template exponent<CharEncoding, Tag>(sink,
- detail::truncate_to_long::call(dim));
+ traits::truncate_to_long::call(dim));
}
return r;
}
@@ -221,7 +221,6 @@
#endif
};
-
}}}
#endif
Modified: branches/release/boost/spirit/home/karma/numeric/int.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/numeric/int.hpp (original)
+++ branches/release/boost/spirit/home/karma/numeric/int.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -22,6 +22,7 @@
#include <boost/spirit/home/support/char_class.hpp>
#include <boost/spirit/home/support/container.hpp>
#include <boost/spirit/home/support/detail/get_encoding.hpp>
+#include <boost/spirit/home/support/detail/is_spirit_tag.hpp>
#include <boost/spirit/home/karma/meta_compiler.hpp>
#include <boost/spirit/home/karma/delimit_out.hpp>
#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
@@ -40,7 +41,10 @@
namespace tag
{
template <typename T, unsigned Radix, bool force_sign>
- struct int_generator {};
+ struct int_generator
+ {
+ BOOST_SPIRIT_IS_TAG()
+ };
}
namespace karma
@@ -203,10 +207,10 @@
template <typename OutputIterator, typename Attribute>
static bool insert_int(OutputIterator& sink, Attribute const& attr)
{
- return sign_inserter::call(sink, detail::is_zero(attr)
- , detail::is_negative(attr), force_sign) &&
+ return sign_inserter::call(sink, traits::test_zero(attr)
+ , traits::test_negative(attr), force_sign) &&
int_inserter<Radix, CharEncoding, Tag>::call(sink
- , detail::absolute_value(attr));
+ , traits::get_absolute_value(attr));
}
public:
@@ -274,10 +278,10 @@
template <typename OutputIterator, typename Attribute>
static bool insert_int(OutputIterator& sink, Attribute const& attr)
{
- return sign_inserter::call(sink, detail::is_zero(attr)
- , detail::is_negative(attr), force_sign) &&
+ return sign_inserter::call(sink, traits::test_zero(attr)
+ , traits::test_negative(attr), force_sign) &&
int_inserter<Radix, CharEncoding, Tag>::call(sink
- , detail::absolute_value(attr));
+ , traits::get_absolute_value(attr));
}
public:
Modified: branches/release/boost/spirit/home/karma/numeric/real_policies.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/numeric/real_policies.hpp (original)
+++ branches/release/boost/spirit/home/karma/numeric/real_policies.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -142,10 +142,10 @@
///////////////////////////////////////////////////////////////////////
static int floatfield(T n)
{
- if (detail::is_zero(n))
+ if (traits::test_zero(n))
return fmtflags::fixed;
- T abs_n = detail::absolute_value(n);
+ T abs_n = traits::get_absolute_value(n);
return (abs_n >= 1e5 || abs_n < 1e-3)
? fmtflags::scientific : fmtflags::fixed;
}
@@ -187,7 +187,7 @@
, bool force_sign)
{
return sign_inserter::call(
- sink, detail::is_zero(n), sign, force_sign) &&
+ sink, traits::test_zero(n), sign, force_sign) &&
int_inserter<10>::call(sink, n);
}
@@ -259,7 +259,7 @@
// but it's spelled out to avoid inter-modular dependencies.
typename remove_const<T>::type digits =
- (detail::is_zero(n) ? 0 : floor(log10(n))) + 1;
+ (traits::test_zero(n) ? 0 : floor(log10(n))) + 1;
bool r = true;
for (/**/; r && digits < precision_; digits = digits + 1)
r = char_inserter<>::call(sink, '0');
@@ -284,10 +284,10 @@
template <typename CharEncoding, typename Tag, typename OutputIterator>
static bool exponent (OutputIterator& sink, long n)
{
- long abs_n = detail::absolute_value(n);
+ long abs_n = traits::get_absolute_value(n);
bool r = char_inserter<CharEncoding, Tag>::call(sink, 'e') &&
- sign_inserter::call(sink, detail::is_zero(n)
- , detail::is_negative(n), false);
+ sign_inserter::call(sink, traits::test_zero(n)
+ , traits::test_negative(n), false);
// the C99 Standard requires at least two digits in the exponent
if (r && abs_n < 10)
@@ -316,7 +316,7 @@
static bool nan (OutputIterator& sink, T n, bool force_sign)
{
return sign_inserter::call(
- sink, false, detail::is_negative(n), force_sign) &&
+ sink, false, traits::test_negative(n), force_sign) &&
string_inserter<CharEncoding, Tag>::call(sink, "nan");
}
@@ -324,11 +324,10 @@
static bool inf (OutputIterator& sink, T n, bool force_sign)
{
return sign_inserter::call(
- sink, false, detail::is_negative(n), force_sign) &&
+ sink, false, traits::test_negative(n), force_sign) &&
string_inserter<CharEncoding, Tag>::call(sink, "inf");
}
};
-
}}}
#endif // defined(BOOST_SPIRIT_KARMA_REAL_POLICIES_MAR_02_2007_0936AM)
Modified: branches/release/boost/spirit/home/karma/numeric/uint.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/numeric/uint.hpp (original)
+++ branches/release/boost/spirit/home/karma/numeric/uint.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -22,6 +22,7 @@
#include <boost/spirit/home/support/char_class.hpp>
#include <boost/spirit/home/support/container.hpp>
#include <boost/spirit/home/support/detail/get_encoding.hpp>
+#include <boost/spirit/home/support/detail/is_spirit_tag.hpp>
#include <boost/spirit/home/karma/meta_compiler.hpp>
#include <boost/spirit/home/karma/delimit_out.hpp>
#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
@@ -39,7 +40,10 @@
namespace tag
{
template <typename T, unsigned Radix>
- struct uint_generator {};
+ struct uint_generator
+ {
+ BOOST_SPIRIT_IS_TAG()
+ };
}
namespace karma
Modified: branches/release/boost/spirit/home/karma/stream/stream.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/stream/stream.hpp (original)
+++ branches/release/boost/spirit/home/karma/stream/stream.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -15,6 +15,7 @@
#include <boost/spirit/home/support/container.hpp>
#include <boost/spirit/home/support/detail/hold_any.hpp>
#include <boost/spirit/home/support/detail/get_encoding.hpp>
+#include <boost/spirit/home/support/detail/is_spirit_tag.hpp>
#include <boost/spirit/home/karma/domain.hpp>
#include <boost/spirit/home/karma/meta_compiler.hpp>
#include <boost/spirit/home/karma/delimit_out.hpp>
@@ -37,7 +38,10 @@
namespace tag
{
template <typename Char = char>
- struct stream_tag {};
+ struct stream_tag
+ {
+ BOOST_SPIRIT_IS_TAG()
+ };
}
namespace karma
Modified: branches/release/boost/spirit/home/lex/argument.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/argument.hpp (original)
+++ branches/release/boost/spirit/home/lex/argument.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -1,6 +1,7 @@
// Copyright (c) 2001-2011 Hartmut Kaiser
// Copyright (c) 2001-2011 Joel de Guzman
// Copyright (c) 2010 Bryce Lelbach
+// Copyright (c) 2011 Thomas Heller
//
// 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)
@@ -12,18 +13,16 @@
#pragma once
#endif
-#include <boost/spirit/home/phoenix/core/actor.hpp>
-#include <boost/spirit/home/phoenix/core/argument.hpp>
-#include <boost/spirit/home/phoenix/core/compose.hpp>
-#include <boost/spirit/home/phoenix/core/value.hpp>
-#include <boost/spirit/home/phoenix/core/as_actor.hpp>
-#include <boost/spirit/home/phoenix/operator/self.hpp>
+#include <boost/spirit/include/phoenix_core.hpp>
+#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/spirit/home/support/string_traits.hpp>
+#include <boost/spirit/home/lex/argument_phoenix.hpp>
#include <boost/fusion/include/at.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
+#include <boost/type_traits/remove_reference.hpp>
///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace spirit { namespace lex
@@ -48,9 +47,11 @@
template <typename Env>
struct result
{
- typedef typename
- remove_const<
- typename mpl::at_c<typename Env::args_type, 4>::type
+ typedef
+ typename remove_reference<
+ typename remove_const<
+ typename mpl::at_c<typename Env::args_type, 4>::type
+ >::type
>::type
context_type;
@@ -92,9 +93,11 @@
template <typename Env>
void eval(Env const& env) const
{
- typedef typename
- remove_const<
- typename mpl::at_c<typename Env::args_type, 4>::type
+ typedef
+ typename remove_reference<
+ typename remove_const<
+ typename mpl::at_c<typename Env::args_type, 4>::type
+ >::type
>::type
context_type;
@@ -108,39 +111,15 @@
: actor_(actor) {}
// see explanation for this constructor at the end of this file
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
state_setter(phoenix::actor<state_getter>, Actor const& actor)
: actor_(actor) {}
+#endif
Actor actor_;
};
///////////////////////////////////////////////////////////////////////////
- // The state_context is used as a noop Phoenix actor to create the
- // placeholder '_state' (see below). It is a noop actor because it is used
- // as a placeholder only, while it is being converted either to a
- // state_getter (if used as a rvalue) or to a state_setter (if used as a
- // lvalue). The conversion is achieved by specializing and overloading a
- // couple of the Phoenix templates from the Phoenix expression composition
- // engine (see the end of this file).
- struct state_context
- {
- typedef mpl::true_ no_nullary;
-
- template <typename Env>
- struct result
- {
- typedef unused_type type;
- };
-
- template <typename Env>
- unused_type
- eval(Env const& env) const
- {
- return unused;
- }
- };
-
- ///////////////////////////////////////////////////////////////////////////
// The value_getter is used to create the _val placeholder, which is a
// Phoenix actor used to access the value of the current token.
//
@@ -159,9 +138,11 @@
template <typename Env>
struct result
{
- typedef typename
- remove_const<
- typename mpl::at_c<typename Env::args_type, 4>::type
+ typedef
+ typename remove_reference<
+ typename remove_const<
+ typename mpl::at_c<typename Env::args_type, 4>::type
+ >::type
>::type
context_type;
@@ -209,40 +190,16 @@
value_setter(Actor const& actor)
: actor_(actor) {}
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
// see explanation for this constructor at the end of this file
value_setter(phoenix::actor<value_getter>, Actor const& actor)
: actor_(actor) {}
+#endif
Actor actor_;
};
///////////////////////////////////////////////////////////////////////////
- // The value_context is used as a noop Phoenix actor to create the
- // placeholder '_val' (see below). It is a noop actor because it is used
- // as a placeholder only, while it is being converted either to a
- // value_getter (if used as a rvalue) or to a value_setter (if used as a
- // lvalue). The conversion is achieved by specializing and overloading a
- // couple of the Phoenix templates from the Phoenix expression composition
- // engine (see the end of this file).
- struct value_context
- {
- typedef mpl::true_ no_nullary;
-
- template <typename Env>
- struct result
- {
- typedef unused_type type;
- };
-
- template <typename Env>
- unused_type
- eval(Env const& env) const
- {
- return unused;
- }
- };
-
- ///////////////////////////////////////////////////////////////////////////
// The eoi_getter is used to create the _eoi placeholder, which is a
// Phoenix actor used to access the end of input iterator pointing to the
// end of the underlying input sequence.
@@ -263,9 +220,11 @@
template <typename Env>
struct result
{
- typedef typename
- remove_const<
- typename mpl::at_c<typename Env::args_type, 4>::type
+ typedef
+ typename remove_reference<
+ typename remove_const<
+ typename mpl::at_c<typename Env::args_type, 4>::type
+ >::type
>::type
context_type;
@@ -283,33 +242,47 @@
///////////////////////////////////////////////////////////////////////////
// '_start' and '_end' may be used to access the start and the end of
// the matched sequence of the current token
- phoenix::actor<phoenix::argument<0> > const _start = phoenix::argument<0>();
- phoenix::actor<phoenix::argument<1> > const _end = phoenix::argument<1>();
+ typedef phoenix::arg_names::_1_type _start_type;
+ typedef phoenix::arg_names::_2_type _end_type;
+#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
+ _start_type const _start = _start_type();
+ _end_type const _end = _end_type();
+#endif
// We are reusing the placeholder '_pass' to access and change the pass
// status of the current match (see support/argument.hpp for its
// definition).
+ // typedef phoenix::arg_names::_3_type _pass_type;
+ using boost::spirit::_pass_type;
+#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
using boost::spirit::_pass;
+#endif
// '_tokenid' may be used to access and change the tokenid of the current
// token
- phoenix::actor<phoenix::argument<3> > const _tokenid = phoenix::argument<3>();
+ typedef phoenix::arg_names::_4_type _tokenid_type;
+#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
+ _tokenid_type const _tokenid = _tokenid_type();
+#endif
+ typedef phoenix::actor<value_context> _val_type;
+ typedef phoenix::actor<state_context> _state_type;
+ typedef phoenix::actor<eoi_getter> _eoi_type;
+#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
// '_val' may be used to access and change the token value of the current
// token
- phoenix::actor<value_context> const _val = value_context();
-
+ _val_type const _val = _val_type();
// _state may be used to access and change the name of the current lexer
// state
- phoenix::actor<state_context> const _state = state_context();
-
+ _state_type const _state = _state_type();
// '_eoi' may be used to access the end of input iterator of the input
// stream used by the lexer to match tokens from
- phoenix::actor<eoi_getter> const _eoi = eoi_getter();
-
+ _eoi_type const _eoi = _eoi_type();
+#endif
}}}
///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
namespace boost { namespace phoenix
{
///////////////////////////////////////////////////////////////////////////
@@ -382,6 +355,7 @@
typedef spirit::lex::value_setter<typename as_actor<RHS>::type> type;
};
}}
+#endif
#undef SPIRIT_DECLARE_ARG
#endif
Copied: branches/release/boost/spirit/home/lex/argument_phoenix.hpp (from r70657, /trunk/boost/spirit/home/lex/argument_phoenix.hpp)
==============================================================================
--- /trunk/boost/spirit/home/lex/argument_phoenix.hpp (original)
+++ branches/release/boost/spirit/home/lex/argument_phoenix.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -27,6 +27,8 @@
{
typedef mpl::true_ no_nullary;
+ typedef unused_type result_type;
+
template <typename Env>
struct result
{
@@ -57,6 +59,8 @@
{
typedef mpl::true_ no_nullary;
+ typedef unused_type result_type;
+
template <typename Env>
struct result
{
@@ -77,42 +81,6 @@
struct eoi_getter;
}}}
-BOOST_PHOENIX_DEFINE_CUSTOM_TERMINAL(
- template<>
- , boost::spirit::lex::value_context
- , mpl::false_
- , v2_eval(
- proto::make<boost::spirit::lex::value_getter()>
- , proto::call<
- functional::env(proto::_state)
- >
- )
-)
-
-BOOST_PHOENIX_DEFINE_CUSTOM_TERMINAL(
- template<>
- , boost::spirit::lex::state_context
- , mpl::false_
- , v2_eval(
- proto::make<boost::spirit::lex::state_getter()>
- , proto::call<
- functional::env(proto::_state)
- >
- )
-)
-
-BOOST_PHOENIX_DEFINE_CUSTOM_TERMINAL(
- template<>
- , boost::spirit::lex::eoi_getter
- , mpl::false_
- , v2_eval(
- proto::make<boost::spirit::lex::eoi_getter()>
- , proto::call<
- functional::env(proto::_state)
- >
- )
-)
-
///////////////////////////////////////////////////////////////////////////////
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
@@ -128,6 +96,27 @@
namespace boost { namespace phoenix
{
+ namespace result_of
+ {
+ template <>
+ struct is_nullary<custom_terminal<boost::spirit::lex::value_context> >
+ : mpl::false_
+ {};
+ }
+
+ template <typename Dummy>
+ struct is_custom_terminal<boost::spirit::lex::value_context, Dummy>: mpl::true_ {};
+
+ template <typename Dummy>
+ struct custom_terminal<boost::spirit::lex::value_context, Dummy>
+ : proto::call<
+ v2_eval(
+ proto::make<boost::spirit::lex::value_getter()>
+ , proto::call<functional::env(proto::_state)>
+ )
+ >
+ {};
+
template <typename Dummy>
struct is_nullary::when<spirit::lex::rule::value_setter, Dummy>
: proto::make<mpl::false_()>
@@ -152,7 +141,7 @@
: boost::phoenix::actor<proto::terminal<spirit::lex::value_context>::type>
{
typedef boost::phoenix::actor<
- typename proto::terminal<spirit::lex::value_context>::type
+ proto::terminal<spirit::lex::value_context>::type
> base_type;
actor(base_type const & base = base_type())
@@ -170,6 +159,27 @@
>::make(phoenix::as_actor<Expr>::convert(expr));
}
};
+
+ namespace result_of
+ {
+ template <>
+ struct is_nullary<custom_terminal<boost::spirit::lex::state_context> >
+ : mpl::false_
+ {};
+ }
+
+ template <typename Dummy>
+ struct is_custom_terminal<boost::spirit::lex::state_context, Dummy>: mpl::true_ {};
+
+ template <typename Dummy>
+ struct custom_terminal<boost::spirit::lex::state_context, Dummy>
+ : proto::call<
+ v2_eval(
+ proto::make<boost::spirit::lex::state_getter()>
+ , proto::call<functional::env(proto::_state)>
+ )
+ >
+ {};
template <typename Dummy>
struct is_nullary::when<spirit::lex::rule::state_setter, Dummy>
@@ -195,7 +205,7 @@
: boost::phoenix::actor<proto::terminal<spirit::lex::state_context>::type>
{
typedef boost::phoenix::actor<
- typename proto::terminal<spirit::lex::state_context>::type
+ proto::terminal<spirit::lex::state_context>::type
> base_type;
actor(base_type const & base = base_type())
@@ -213,6 +223,27 @@
>::make(phoenix::as_actor<Expr>::convert(expr));
}
};
+
+ namespace result_of
+ {
+ template <>
+ struct is_nullary<custom_terminal<boost::spirit::lex::eoi_getter> >
+ : mpl::false_
+ {};
+ }
+
+ template <typename Dummy>
+ struct is_custom_terminal<boost::spirit::lex::eoi_getter, Dummy>: mpl::true_ {};
+
+ template <typename Dummy>
+ struct custom_terminal<boost::spirit::lex::eoi_getter, Dummy>
+ : proto::call<
+ v2_eval(
+ proto::make<boost::spirit::lex::eoi_getter()>
+ , proto::call<functional::env(proto::_state)>
+ )
+ >
+ {};
}}
#endif // BOOST_SPIRIT_USE_PHOENIX_V3
Modified: branches/release/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp (original)
+++ branches/release/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -13,10 +13,10 @@
#pragma once
#endif
-#include <boost/spirit/home/phoenix/core/actor.hpp>
-#include <boost/spirit/home/phoenix/core/argument.hpp>
-#include <boost/spirit/home/phoenix/bind.hpp>
-#include <boost/spirit/home/phoenix/scope.hpp>
+#include <boost/spirit/include/phoenix_core.hpp>
+#include <boost/spirit/include/phoenix_bind.hpp>
+#include <boost/spirit/include/phoenix_scope.hpp>
+
#include <boost/spirit/home/support/attributes.hpp>
#include <boost/spirit/home/lex/lexer/pass_flags.hpp>
@@ -29,42 +29,14 @@
, typename IdType>
struct wrap_action
{
- // plain functions with 5 arguments and function objects are not
- // touched at all
+ // plain functions with 5 arguments, function objects (including
+ // phoenix actors) are not touched at all
template <typename F>
static FunctionType call(F const& f)
{
return f;
}
- // wrap phoenix actor
- struct phoenix_action
- {
- template <typename F, typename T1, typename T2, typename T3
- , typename T4, typename T5>
- struct result { typedef void type; };
-
- template <typename Eval>
- void operator()(phoenix::actor<Eval> const& f, Iterator& start
- , Iterator& end, BOOST_SCOPED_ENUM(pass_flags)& pass
- , IdType& id, Context& ctx) const
- {
- f (start, end, pass, id, ctx);
- }
- };
-
- template <typename Eval>
- static FunctionType call(phoenix::actor<Eval> const& f)
- {
- using phoenix::arg_names::_1;
- using phoenix::arg_names::_2;
- using phoenix::arg_names::_3;
- using phoenix::arg_names::_4;
- using phoenix::arg_names::_5;
- return phoenix::bind(phoenix_action(), phoenix::lambda[f],
- _1, _2, _3, _4, _5);
- }
-
// semantic actions with 4 arguments
template <typename F>
static void arg4_action(F* f, Iterator& start, Iterator& end
Modified: branches/release/boost/spirit/home/lex/lexer/support_functions.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/support_functions.hpp (original)
+++ branches/release/boost/spirit/home/lex/lexer/support_functions.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -10,14 +10,12 @@
#pragma once
#endif
-#include <boost/spirit/home/phoenix/core/actor.hpp>
-#include <boost/spirit/home/phoenix/core/argument.hpp>
-#include <boost/spirit/home/phoenix/core/compose.hpp>
-#include <boost/spirit/home/phoenix/core/value.hpp>
-#include <boost/spirit/home/phoenix/core/as_actor.hpp>
+#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/home/support/detail/scoped_enum_emulation.hpp>
#include <boost/spirit/home/lex/lexer/pass_flags.hpp>
+#include <boost/spirit/home/lex/lexer/support_functions_expression.hpp>
+
///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace spirit { namespace lex
{
@@ -72,13 +70,14 @@
};
// The function lex::less() is used to create a Phoenix actor allowing to
- // implement functionality similar to flex' function yyless().
+ // implement functionality similar to flex' function yyless().
template <typename T>
- inline phoenix::actor<less_type<typename phoenix::as_actor<T>::type> >
+ inline typename expression::less<
+ typename phoenix::as_actor<T>::type
+ >::type const
less(T const& v)
{
- typedef typename phoenix::as_actor<T>::type actor_type;
- return less_type<actor_type>(phoenix::as_actor<T>::convert(v));
+ return expression::less<T>::make(phoenix::as_actor<T>::convert(v));
}
///////////////////////////////////////////////////////////////////////////
@@ -115,10 +114,10 @@
// The function lex::more() is used to create a Phoenix actor allowing to
// implement functionality similar to flex' function yymore().
- inline phoenix::actor<more_type>
- more()
+ //inline expression::more<mpl::void_>::type const
+ inline phoenix::actor<more_type> more()
{
- return more_type();
+ return phoenix::actor<more_type>();
}
///////////////////////////////////////////////////////////////////////////
@@ -156,27 +155,27 @@
// The function lex::lookahead() is used to create a Phoenix actor
// allowing to implement functionality similar to flex' lookahead operator
- // a/b.
+ // a/b.
template <typename T>
- inline phoenix::actor<
- lookahead_type<
- typename phoenix::as_actor<T>::type
- , typename phoenix::as_actor<std::size_t>::type> >
+ inline typename expression::lookahead<
+ typename phoenix::as_actor<T>::type
+ , typename phoenix::as_actor<std::size_t>::type
+ >::type const
lookahead(T const& id)
{
typedef typename phoenix::as_actor<T>::type id_actor_type;
typedef typename phoenix::as_actor<std::size_t>::type state_actor_type;
- return lookahead_type<id_actor_type, state_actor_type>(
+ return expression::lookahead<id_actor_type, state_actor_type>::make(
phoenix::as_actor<T>::convert(id),
phoenix::as_actor<std::size_t>::convert(std::size_t(~0)));
}
template <typename Attribute, typename Char, typename Idtype>
- inline phoenix::actor<
- lookahead_type<
- typename phoenix::as_actor<Idtype>::type
- , typename phoenix::as_actor<std::size_t>::type> >
+ inline typename expression::lookahead<
+ typename phoenix::as_actor<Idtype>::type
+ , typename phoenix::as_actor<std::size_t>::type
+ >::type const
lookahead(token_def<Attribute, Char, Idtype> const& tok)
{
typedef typename phoenix::as_actor<Idtype>::type id_actor_type;
@@ -190,7 +189,7 @@
BOOST_ASSERT(std::size_t(~0) != state &&
"token_def instance not associated with lexer yet");
- return lookahead_type<id_actor_type, state_actor_type>(
+ return expression::lookahead<id_actor_type, state_actor_type>::make(
phoenix::as_actor<Idtype>::convert(tok.id()),
phoenix::as_actor<std::size_t>::convert(state));
}
Copied: branches/release/boost/spirit/home/lex/lexer/support_functions_expression.hpp (from r70657, /trunk/boost/spirit/home/lex/lexer/support_functions_expression.hpp)
==============================================================================
--- /trunk/boost/spirit/home/lex/lexer/support_functions_expression.hpp (original)
+++ branches/release/boost/spirit/home/lex/lexer/support_functions_expression.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -20,16 +20,6 @@
template <typename, typename> struct lookahead_type;
}}}
-BOOST_PHOENIX_DEFINE_CUSTOM_TERMINAL(
- template <>
- , boost::spirit::lex::more_type
- , mpl::false_
- , v2_eval(
- proto::make<boost::spirit::lex::more_type()>
- , proto::call<functional::env(proto::_state)>
- )
-)
-
///////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
@@ -76,6 +66,29 @@
namespace boost { namespace phoenix
{
+
+ namespace result_of
+ {
+ template <>
+ struct is_nullary<custom_terminal<boost::spirit::lex::more_type> >
+ : mpl::false_
+ {};
+ }
+
+ template <typename Dummy>
+ struct is_custom_terminal<boost::spirit::lex::more_type, Dummy> : mpl::true_ {};
+
+ template <typename Dummy>
+ struct custom_terminal<boost::spirit::lex::more_type, Dummy>
+ : proto::call<
+ v2_eval(
+ proto::make<boost::spirit::lex::more_type()>
+ , proto::call<functional::env(proto::_state)>
+ )
+ >
+ {};
+
+
template <typename Dummy>
struct is_nullary::when<spirit::lex::rule::less, Dummy>
: proto::make<mpl::false_()>
@@ -85,7 +98,9 @@
struct default_actions::when<spirit::lex::rule::less, Dummy>
: proto::call<
v2_eval(
- spirit::lex::less_type<proto::_child0>(proto::_child0)
+ proto::make<
+ spirit::lex::less_type<proto::_child0>(proto::_child0)
+ >
, _env
)
>
@@ -100,13 +115,15 @@
struct default_actions::when<spirit::lex::rule::lookahead, Dummy>
: proto::call<
v2_eval(
- spirit::lex::lookahead_type<
- proto::_child0
- , proto::_child1
- >(
- proto::_child0
- , proto::_child1
- )
+ proto::make<
+ spirit::lex::lookahead_type<
+ proto::_child0
+ , proto::_child1
+ >(
+ proto::_child0
+ , proto::_child1
+ )
+ >
, _env
)
>
Modified: branches/release/boost/spirit/home/phoenix/core/argument.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/core/argument.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/core/argument.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -21,10 +21,14 @@
#include <boost/mpl/size.hpp>
#include <boost/type_traits/add_reference.hpp>
-#define PHOENIX_DECLARE_ARG(z, n, data) \
- actor<argument<n> > const \
- BOOST_PP_CAT(arg, BOOST_PP_INC(n)) = argument<n>(); \
- actor<argument<n> > const \
+#define PHOENIX_DECLARE_ARG(z, n, data) \
+ typedef actor<argument<n> > \
+ BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(n)), _type); \
+ actor<argument<n> > const \
+ BOOST_PP_CAT(arg, BOOST_PP_INC(n)) = argument<n>(); \
+ typedef actor<argument<n> > \
+ BOOST_PP_CAT(BOOST_PP_CAT(_, BOOST_PP_INC(n)), _type); \
+ actor<argument<n> > const \
BOOST_PP_CAT(_, BOOST_PP_INC(n)) = argument<n>();
namespace boost { namespace phoenix
@@ -69,13 +73,19 @@
namespace arg_names
{
// Phoenix style names
+ typedef actor<argument<0> > arg1_type;
actor<argument<0> > const arg1 = argument<0>();
+ typedef actor<argument<1> > arg2_type;
actor<argument<1> > const arg2 = argument<1>();
+ typedef actor<argument<2> > arg3_type;
actor<argument<2> > const arg3 = argument<2>();
// BLL style names
+ typedef actor<argument<0> > _1_type;
actor<argument<0> > const _1 = argument<0>();
+ typedef actor<argument<1> > _2_type;
actor<argument<1> > const _2 = argument<1>();
+ typedef actor<argument<2> > _3_type;
actor<argument<2> > const _3 = argument<2>();
// Bring in the rest or the Phoenix style arguments (arg4 .. argN+1)
Modified: branches/release/boost/spirit/home/qi/detail/alternative_function.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/detail/alternative_function.hpp (original)
+++ branches/release/boost/spirit/home/qi/detail/alternative_function.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -31,7 +31,15 @@
typedef typename mpl::end<types>::type end;
typedef typename
- mpl::find_if<types, traits::is_substitute<mpl::_1, Expected> >::type
+ mpl::find_if<types, is_same<mpl::_1, Expected> >::type
+ iter_1;
+
+ typedef typename
+ mpl::eval_if<
+ is_same<iter_1, end>,
+ mpl::find_if<types, traits::is_substitute<mpl::_1, Expected> >,
+ mpl::identity<iter_1>
+ >::type
iter;
typedef typename
Modified: branches/release/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp (original)
+++ branches/release/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -155,6 +155,32 @@
};
};
+ // arbitrary Radix
+ template <unsigned Radix>
+ struct radix_traits
+ {
+ template<typename Char>
+ inline static bool is_valid(Char ch)
+ {
+ return (ch >= '0' && ch <= ('0' + Radix - 1));
+ }
+
+ template<typename Char>
+ inline static unsigned digit(Char ch)
+ {
+ return ch - '0';
+ }
+
+ template<typename T>
+ struct digits
+ {
+ typedef std::numeric_limits<T> numeric_limits_;
+ BOOST_STATIC_CONSTANT(int, value = numeric_limits_::digits10);
+ // TODO(j.f.eick_at_[hidden]): this is the min number of digits which
+ // can be safely parsed if the radix is < 10 - this is not optimal?
+ };
+ };
+
///////////////////////////////////////////////////////////////////////////
// positive_accumulator/negative_accumulator: Accumulator policies for
// extracting integers. Use positive_accumulator if number is positive.
@@ -175,7 +201,8 @@
{
// Ensure n *= Radix will not overflow
static T const max = (std::numeric_limits<T>::max)();
- static T const val = (max - 1) / Radix;
+ //static T const val = (max - 1) / Radix;
+ static T const val = max / Radix;
if (n > val)
return false;
Modified: branches/release/boost/spirit/home/qi/numeric/detail/real_impl.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/numeric/detail/real_impl.hpp (original)
+++ branches/release/boost/spirit/home/qi/numeric/detail/real_impl.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -30,7 +30,7 @@
namespace boost { namespace spirit { namespace traits
{
- using spirit::detail::pow10;
+ using spirit::traits::pow10;
template <typename T>
inline void
Modified: branches/release/boost/spirit/home/qi/numeric/numeric_utils.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/numeric/numeric_utils.hpp (original)
+++ branches/release/boost/spirit/home/qi/numeric/numeric_utils.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -48,7 +48,7 @@
{
// check template parameter 'Radix' for validity
BOOST_SPIRIT_ASSERT_MSG(
- Radix == 2 || Radix == 8 || Radix == 10 || Radix == 16,
+ Radix >= 2 || Radix <= 10 || Radix == 16,
not_supported_radix, ());
template <typename Iterator>
Modified: branches/release/boost/spirit/home/qi/numeric/uint.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/numeric/uint.hpp (original)
+++ branches/release/boost/spirit/home/qi/numeric/uint.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -217,7 +217,7 @@
{
// check template parameter 'Radix' for validity
BOOST_SPIRIT_ASSERT_MSG(
- Radix == 2 || Radix == 8 || Radix == 10 || Radix == 16,
+ Radix >= 2 || Radix <= 10 || Radix == 16,
not_supported_radix, ());
template <typename Context, typename Iterator>
Modified: branches/release/boost/spirit/home/support/action_dispatch.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/action_dispatch.hpp (original)
+++ branches/release/boost/spirit/home/support/action_dispatch.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -13,7 +13,16 @@
#pragma once
#endif
-#include <boost/spirit/home/phoenix/core/actor.hpp>
+#include<boost/config.hpp>
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_LAMBDAS) && \
+ !defined(BOOST_NO_VARIADIC_TEMPLATES) && !defined(BOOST_NO_DECLTYPE)
+#include <utility>
+#include <type_traits>
+#endif
+
+
+#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/home/support/attributes.hpp>
namespace boost { namespace spirit { namespace traits
@@ -21,6 +30,130 @@
template <typename Component>
struct action_dispatch
{
+#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_LAMBDAS) && \
+ !defined(BOOST_NO_VARIADIC_TEMPLATES) && !defined(BOOST_NO_DECLTYPE)
+ // omit function parameters without specializing for each possible
+ // type of callable entity
+ // many thanks to Eelis/##iso-c++ for this contribution
+
+ private:
+ // this will be used to pass around POD types which are safe
+ // to go through the ellipsis operator (if ever used)
+ template <typename>
+ struct fwd_tag {};
+
+ // the first parameter is a placeholder to obtain SFINAE when
+ // doing overload resolution, the second one is the actual
+ // forwarder, where we can apply our implementation
+ template <typename, typename T>
+ struct fwd_storage { typedef T type; };
+
+ // gcc should accept fake<T>() but it prints a sorry, needs
+ // a check once the bug is sorted out, use a FAKE_CALL macro for now
+ template <typename T>
+ T fake_call();
+
+#define BOOST_SPIRIT_FAKE_CALL(T) (*(T*)0)
+
+ // the forwarders, here we could tweak the implementation of
+ // how parameters are passed to the functions, if needed
+ struct fwd_none
+ {
+ template<typename F, typename... Rest>
+ auto operator()(F && f, Rest&&...) -> decltype(f())
+ {
+ return f();
+ }
+ };
+
+ struct fwd_attrib
+ {
+ template<typename F, typename A, typename... Rest>
+ auto operator()(F && f, A && a, Rest&&...) -> decltype(f(a))
+ {
+ return f(a);
+ }
+ };
+
+ struct fwd_attrib_context
+ {
+ template<typename F, typename A, typename B, typename... Rest>
+ auto operator()(F && f, A && a, B && b, Rest&&...)
+ -> decltype(f(a, b))
+ {
+ return f(a, b);
+ }
+ };
+
+ struct fwd_attrib_context_pass
+ {
+ template<typename F, typename A, typename B, typename C
+ , typename... Rest>
+ auto operator()(F && f, A && a, B && b, C && c, Rest&&...)
+ -> decltype(f(a, b, c))
+ {
+ return f(a, b, c);
+ }
+ };
+
+ // SFINAE for our calling syntax, the forwarders are stored based
+ // on what function call gives a proper result
+ // this code can probably be more generic once implementations are
+ // steady
+ template <typename F>
+ static auto do_call(F && f, ...)
+ -> typename fwd_storage<decltype(f()), fwd_none>::type
+ {
+ return {};
+ }
+
+ template <typename F, typename A>
+ static auto do_call(F && f, fwd_tag<A>, ...)
+ -> typename fwd_storage<decltype(f(BOOST_SPIRIT_FAKE_CALL(A)))
+ , fwd_attrib>::type
+ {
+ return {};
+ }
+
+ template <typename F, typename A, typename B>
+ static auto do_call(F && f, fwd_tag<A>, fwd_tag<B>, ...)
+ -> typename fwd_storage<
+ decltype(f(BOOST_SPIRIT_FAKE_CALL(A), BOOST_SPIRIT_FAKE_CALL(B)))
+ , fwd_attrib_context>::type
+ {
+ return {};
+ }
+
+ template <typename F, typename A, typename B, typename C>
+ static auto do_call(F && f, fwd_tag<A>, fwd_tag<B>, fwd_tag<C>, ...)
+ -> typename fwd_storage<
+ decltype(f(BOOST_SPIRIT_FAKE_CALL(A), BOOST_SPIRIT_FAKE_CALL(B)
+ , BOOST_SPIRIT_FAKE_CALL(C)))
+ , fwd_attrib_context_pass>::type
+ {
+ return {};
+ }
+
+ // this function calls the forwarder and is responsible for
+ // stripping the tail of the parameters
+ template <typename F, typename... A>
+ static void caller(F && f, A && ... a)
+ {
+ do_call(f, fwd_tag<typename std::remove_reference<A>::type>()...)
+ (std::forward<F>(f), std::forward<A>(a)...);
+ }
+
+#undef BOOST_SPIRIT_FAKE_CALL
+
+ public:
+ template <typename F, typename Attribute, typename Context>
+ bool operator()(F const& f, Attribute& attr, Context& context)
+ {
+ bool pass = true;
+ caller(f, attr, context, pass);
+ return pass;
+ }
+#else
// general handler for everything not explicitly specialized below
template <typename F, typename Attribute, typename Context>
bool operator()(F const& f, Attribute& attr, Context& context)
@@ -29,6 +162,7 @@
f(attr, context, pass);
return pass;
}
+#endif
// handler for phoenix actors
Modified: branches/release/boost/spirit/home/support/adapt_adt_attributes.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/adapt_adt_attributes.hpp (original)
+++ branches/release/boost/spirit/home/support/adapt_adt_attributes.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -12,6 +12,7 @@
#include <boost/spirit/home/support/attributes.hpp>
#include <boost/spirit/home/support/container.hpp>
+#include <boost/spirit/home/support/numeric_traits.hpp>
#include <boost/fusion/include/adapt_adt.hpp>
#include <boost/utility/enable_if.hpp>
@@ -155,6 +156,41 @@
clear(type(val));
}
};
+
+ // customization point specializations for numeric generators
+ template <typename T, int N, bool Const>
+ struct absolute_value<fusion::extension::adt_attribute_proxy<T, N, Const> >
+ {
+ typedef typename
+ fusion::extension::adt_attribute_proxy<T, N, Const>::type
+ type;
+
+ static type
+ call (fusion::extension::adt_attribute_proxy<T, N, Const> const& val)
+ {
+ return get_absolute_value(val.get());
+ }
+ };
+
+ template <typename T, int N, bool Const>
+ struct is_negative<fusion::extension::adt_attribute_proxy<T, N, Const> >
+ {
+ static bool
+ call(fusion::extension::adt_attribute_proxy<T, N, Const> const& val)
+ {
+ return test_negative(val.get());
+ }
+ };
+
+ template <typename T, int N, bool Const>
+ struct is_zero<fusion::extension::adt_attribute_proxy<T, N, Const> >
+ {
+ static bool
+ call(fusion::extension::adt_attribute_proxy<T, N, Const> const& val)
+ {
+ return test_zero(val.get());
+ }
+ };
}}}
#endif
Modified: branches/release/boost/spirit/home/support/argument.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/argument.hpp (original)
+++ branches/release/boost/spirit/home/support/argument.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -1,5 +1,7 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2001-2011 Hartmut Kaiser
+ Copyright (c) 2011 Thomas Heller
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)
@@ -13,47 +15,81 @@
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#include <boost/preprocessor/arithmetic/inc.hpp>
-#include <boost/spirit/home/phoenix/core/actor.hpp>
-#include <boost/spirit/home/phoenix/core/argument.hpp>
+#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/home/support/assert_msg.hpp>
+#include <boost/spirit/home/support/limits.hpp>
#include <boost/fusion/include/at.hpp>
#include <boost/fusion/include/size.hpp>
#include <boost/mpl/size.hpp>
#include <boost/mpl/at.hpp>
-#if !defined(SPIRIT_ARGUMENTS_LIMIT)
-# define SPIRIT_ARGUMENTS_LIMIT PHOENIX_LIMIT
-#endif
-
#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
-#define SPIRIT_DECLARE_ARG(z, n, data) \
- typedef phoenix::actor<argument<n> > const \
- BOOST_PP_CAT(BOOST_PP_CAT(_, BOOST_PP_INC(n)), _type); \
- phoenix::actor<argument<n> > const \
- BOOST_PP_CAT(_, BOOST_PP_INC(n)) = argument<n>();
+#define SPIRIT_DECLARE_ARG(z, n, data) \
+ typedef phoenix::actor<argument<n> > const \
+ BOOST_PP_CAT(BOOST_PP_CAT(_, BOOST_PP_INC(n)), _type); \
+ phoenix::actor<argument<n> > const \
+ BOOST_PP_CAT(_, BOOST_PP_INC(n)) = \
+ BOOST_PP_CAT(BOOST_PP_CAT(_, BOOST_PP_INC(n)), _type)(); \
/***/
-#define SPIRIT_USING_ARGUMENT(z, n, data) \
- using spirit::BOOST_PP_CAT(BOOST_PP_CAT(_, n), _type); \
- using spirit::BOOST_PP_CAT(_, n);
+#define SPIRIT_USING_ARGUMENT(z, n, data) \
+ using spirit::BOOST_PP_CAT(BOOST_PP_CAT(_, n), _type); \
+ using spirit::BOOST_PP_CAT(_, n); \
/***/
#else
-#define SPIRIT_DECLARE_ARG(z, n, data) \
- typedef phoenix::actor<argument<n> > const \
- BOOST_PP_CAT(BOOST_PP_CAT(_, BOOST_PP_INC(n)), _type);
+#define SPIRIT_DECLARE_ARG(z, n, data) \
+ typedef phoenix::actor<argument<n> > const \
+ BOOST_PP_CAT(BOOST_PP_CAT(_, BOOST_PP_INC(n)), _type); \
/***/
-#define SPIRIT_USING_ARGUMENT(z, n, data) \
- using spirit::BOOST_PP_CAT(BOOST_PP_CAT(_, n), _type); \
+#define SPIRIT_USING_ARGUMENT(z, n, data) \
+ using spirit::BOOST_PP_CAT(BOOST_PP_CAT(_, n), _type); \
/***/
#endif
namespace boost { namespace spirit
{
+ template <int N>
+ struct argument;
+
+ template <typename Dummy>
+ struct attribute_context;
+}}
+
+BOOST_PHOENIX_DEFINE_CUSTOM_TERMINAL(
+ template <int N>
+ , boost::spirit::argument<N>
+ , mpl::false_ // is not nullary
+ , v2_eval(
+ proto::make<
+ boost::spirit::argument<N>()
+ >
+ , proto::call<
+ functional::env(proto::_state)
+ >
+ )
+)
+
+BOOST_PHOENIX_DEFINE_CUSTOM_TERMINAL(
+ template <typename Dummy>
+ , boost::spirit::attribute_context<Dummy>
+ , mpl::false_ // is not nullary
+ , v2_eval(
+ proto::make<
+ boost::spirit::attribute_context<Dummy>()
+ >
+ , proto::call<
+ functional::env(proto::_state)
+ >
+ )
+)
+
+namespace boost { namespace spirit
+{
namespace result_of
{
template <typename Sequence, int N>
@@ -91,6 +127,7 @@
return result_of::get_arg<T, N>::call(val);
}
+ template <typename>
struct attribute_context
{
typedef mpl::true_ no_nullary;
@@ -138,9 +175,9 @@
};
// _0 refers to the whole attribute as generated by the lhs parser
- typedef phoenix::actor<attribute_context> const _0_type;
+ typedef phoenix::actor<attribute_context<void> > const _0_type;
#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
- _0_type _0 = attribute_context();
+ _0_type _0 = _0_type();
#endif
// _1, _2, ... refer to the attributes of the single components the lhs
@@ -150,15 +187,15 @@
typedef phoenix::actor<argument<2> > const _3_type;
#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
- _1_type _1 = argument<0>();
- _2_type _2 = argument<1>();
- _3_type _3 = argument<2>();
+ _1_type _1 = _1_type();
+ _2_type _2 = _2_type();
+ _3_type _3 = _3_type();
#endif
// '_pass' may be used to make a match fail in retrospective
- typedef phoenix::actor<phoenix::argument<2> > const _pass_type;
+ typedef phoenix::arg_names::_3_type const _pass_type;
#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
- _pass_type _pass = phoenix::argument<2>();
+ _pass_type _pass = _pass_type();
#endif
// Bring in the rest of the arguments and attributes (_4 .. _N+1), using PP
Copied: branches/release/boost/spirit/home/support/argument_expression.hpp (from r70657, /trunk/boost/spirit/home/support/argument_expression.hpp)
==============================================================================
--- /trunk/boost/spirit/home/support/argument_expression.hpp (original)
+++ branches/release/boost/spirit/home/support/argument_expression.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -106,14 +106,24 @@
template <typename Dummy>
struct custom_terminal<spirit::attribute_context<Dummy> >
: proto::call<
- v2_eval(spirit::attribute_context<Dummy>(), _env)
+ v2_eval(
+ proto::make<spirit::attribute_context<Dummy>()>
+ , proto::call<
+ functional::env(proto::_state)
+ >
+ )
>
{};
template <int N>
struct custom_terminal<spirit::argument<N> >
: proto::call<
- v2_eval(spirit::argument<N>(), _env(proto::_, proto::_state, int()))
+ v2_eval(
+ proto::make<spirit::argument<N>()>
+ , proto::call<
+ functional::env(proto::_state)
+ >
+ )
>
{};
}}
Modified: branches/release/boost/spirit/home/support/attributes.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/attributes.hpp (original)
+++ branches/release/boost/spirit/home/support/attributes.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -60,49 +60,107 @@
///////////////////////////////////////////////////////////////////////////
// Find out if T can be a (strong) substitute for Expected attribute
+ namespace detail
+ {
+ template <typename T, typename Expected>
+ struct value_type_is_substitute
+ : is_substitute<
+ typename container_value<T>::type
+ , typename container_value<Expected>::type>
+ {};
+
+ template <typename T, typename Expected, typename Enable = void>
+ struct is_substitute_impl : is_same<T, Expected> {};
+
+ template <typename T, typename Expected>
+ struct is_substitute_impl<T, Expected,
+ typename enable_if<
+ mpl::and_<
+ fusion::traits::is_sequence<T>,
+ fusion::traits::is_sequence<Expected>,
+ mpl::equal<T, Expected, is_substitute<mpl::_1, mpl::_2> >
+ >
+ >::type>
+ : mpl::true_ {};
+
+ template <typename T, typename Expected>
+ struct is_substitute_impl<T, Expected,
+ typename enable_if<
+ mpl::and_<
+ is_container<T>,
+ is_container<Expected>,
+ detail::value_type_is_substitute<T, Expected>
+ >
+ >::type>
+ : mpl::true_ {};
+ }
+
template <typename T, typename Expected, typename Enable /*= void*/>
- struct is_substitute : is_same<T, Expected> {};
+ struct is_substitute
+ : detail::is_substitute_impl<T, Expected> {};
template <typename T, typename Expected>
struct is_substitute<optional<T>, optional<Expected> >
: is_substitute<T, Expected> {};
- template <typename T, typename Expected>
- struct is_substitute<T, Expected,
- typename enable_if<
- mpl::and_<
- fusion::traits::is_sequence<T>,
- fusion::traits::is_sequence<Expected>,
- mpl::equal<T, Expected, is_substitute<mpl::_1, mpl::_2> >
- >
- >::type>
+ template <typename T>
+ struct is_substitute<T, T
+ , typename enable_if<not_is_optional<T> >::type>
: mpl::true_ {};
+ ///////////////////////////////////////////////////////////////////////////
+ // Find out if T can be a weak substitute for Expected attribute
namespace detail
{
template <typename T, typename Expected>
- struct value_type_is_substitute
- : is_substitute<
+ struct value_type_is_weak_substitute
+ : is_weak_substitute<
typename container_value<T>::type
, typename container_value<Expected>::type>
{};
- }
- template <typename T, typename Expected>
- struct is_substitute<T, Expected,
- typename enable_if<
- mpl::and_<
- is_container<T>,
- is_container<Expected>,
- detail::value_type_is_substitute<T, Expected>
- >
- >::type>
- : mpl::true_ {};
+ template <typename T, typename Expected, typename Enable = void>
+ struct is_weak_substitute_impl : is_convertible<T, Expected> {};
- ///////////////////////////////////////////////////////////////////////////
- // Find out if T can be a weak substitute for Expected attribute
+ template <typename T, typename Expected>
+ struct is_weak_substitute_impl<T, Expected,
+ typename enable_if<
+ mpl::and_<
+ is_container<T>,
+ is_container<Expected>,
+ value_type_is_weak_substitute<T, Expected> >
+ >::type>
+ : mpl::true_ {};
+
+ template <typename T, typename Expected>
+ struct is_weak_substitute_impl<T, Expected,
+ typename enable_if<
+ mpl::and_<
+ fusion::traits::is_sequence<T>,
+ fusion::traits::is_sequence<Expected>,
+ mpl::equal<T, Expected, is_weak_substitute<mpl::_1, mpl::_2> > >
+ >::type>
+ : mpl::true_ {};
+
+ // If this is not defined, the main template definition above will return
+ // true if T is convertible to the first type in a fusion::vector. We
+ // globally declare any non-Fusion sequence T as not compatible with any
+ // Fusion sequence Expected.
+ template <typename T, typename Expected>
+ struct is_weak_substitute_impl<T, Expected,
+ typename enable_if<
+ mpl::and_<
+ mpl::not_<fusion::traits::is_sequence<T> >
+ , fusion::traits::is_sequence<Expected> >
+ >::type>
+ : mpl::false_ {};
+ }
+
+ // main template forwards to detail namespace, this helps older compilers
+ // to disambiguate things
template <typename T, typename Expected, typename Enable /*= void*/>
- struct is_weak_substitute : is_convertible<T, Expected> {};
+ struct is_weak_substitute
+ : detail::is_weak_substitute_impl<T, Expected> {};
template <typename T, typename Expected>
struct is_weak_substitute<optional<T>, optional<Expected> >
@@ -116,47 +174,30 @@
struct is_weak_substitute<T, optional<Expected> >
: is_weak_substitute<T, Expected> {};
- template <typename T, typename Expected>
- struct is_weak_substitute<T, Expected,
- typename enable_if<
- mpl::and_<
- fusion::traits::is_sequence<T>,
- fusion::traits::is_sequence<Expected>,
- mpl::equal<T, Expected, is_weak_substitute<mpl::_1, mpl::_2> > >
- >::type>
- : mpl::true_ {};
+#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_
+ {};
- // If this is not defined, the main template definition above will return
- // true if T is convertible to the first type in a fusion::vector. We
- // globally declare any non-Fusion sequence T as not compatible with any
- // Fusion sequence Expected.
- template <typename T, typename Expected>
- struct is_weak_substitute<T, Expected,
- typename enable_if<
- mpl::and_<
- mpl::not_<fusion::traits::is_sequence<T> >
- , fusion::traits::is_sequence<Expected> >
- >::type>
- : mpl::false_ {};
+ 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>
+ {};
- namespace detail
- {
- template <typename T, typename Expected>
- struct value_type_is_weak_substitute
- : is_weak_substitute<
- typename container_value<T>::type
- , typename container_value<Expected>::type>
- {};
- }
+#undef BOOST_SPIRIT_IS_WEAK_SUBSTITUTE
- template <typename T, typename Expected>
- struct is_weak_substitute<T, Expected,
- typename enable_if<
- mpl::and_<
- is_container<T>,
- is_container<Expected>,
- detail::value_type_is_weak_substitute<T, Expected> >
- >::type>
+ template <typename T>
+ struct is_weak_substitute<T, T
+ , typename enable_if<
+ mpl::and_<not_is_optional<T>, not_is_variant<T> >
+ >::type>
: mpl::true_ {};
///////////////////////////////////////////////////////////////////////////
Modified: branches/release/boost/spirit/home/support/auto/meta_create.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/auto/meta_create.hpp (original)
+++ branches/release/boost/spirit/home/support/auto/meta_create.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -13,6 +13,7 @@
#include <boost/spirit/home/support/unused.hpp>
#include <boost/version.hpp>
+#include <boost/spirit/include/phoenix_limits.hpp> // needs to be included before proto
#include <boost/proto/proto.hpp>
#include <boost/utility/result_of.hpp>
#include <boost/type_traits/add_const.hpp>
Modified: branches/release/boost/spirit/home/support/char_class.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/char_class.hpp (original)
+++ branches/release/boost/spirit/home/support/char_class.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -14,10 +14,12 @@
#include <string>
+#include <boost/spirit/include/phoenix_limits.hpp> // needs to be included before proto
#include <boost/proto/proto.hpp>
#include <boost/config.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/detail/is_spirit_tag.hpp>
#include <boost/type_traits/is_signed.hpp>
#include <boost/type_traits/make_unsigned.hpp>
#include <boost/type_traits/make_signed.hpp>
@@ -66,192 +68,192 @@
namespace boost { namespace spirit { namespace tag
{
- struct char_ {};
- struct string {};
+ struct char_ { BOOST_SPIRIT_IS_TAG() };
+ struct string { BOOST_SPIRIT_IS_TAG() };
///////////////////////////////////////////////////////////////////////////
// classification tags
- struct alnum {};
- struct alpha {};
- struct digit {};
- struct xdigit {};
- struct cntrl {};
- struct graph {};
- struct print {};
- struct punct {};
- struct space {};
- struct blank {};
+ struct alnum { BOOST_SPIRIT_IS_TAG() };
+ struct alpha { BOOST_SPIRIT_IS_TAG() };
+ struct digit { BOOST_SPIRIT_IS_TAG() };
+ struct xdigit { BOOST_SPIRIT_IS_TAG() };
+ struct cntrl { BOOST_SPIRIT_IS_TAG() };
+ struct graph { BOOST_SPIRIT_IS_TAG() };
+ struct print { BOOST_SPIRIT_IS_TAG() };
+ struct punct { BOOST_SPIRIT_IS_TAG() };
+ struct space { BOOST_SPIRIT_IS_TAG() };
+ struct blank { BOOST_SPIRIT_IS_TAG() };
///////////////////////////////////////////////////////////////////////////
// classification/conversion tags
- struct no_case {};
- struct lower {};
- struct upper {};
- struct lowernum {};
- struct uppernum {};
- struct ucs4 {};
- struct encoding {};
+ struct no_case { BOOST_SPIRIT_IS_TAG() };
+ struct lower { BOOST_SPIRIT_IS_TAG() };
+ struct upper { BOOST_SPIRIT_IS_TAG() };
+ struct lowernum { BOOST_SPIRIT_IS_TAG() };
+ struct uppernum { BOOST_SPIRIT_IS_TAG() };
+ struct ucs4 { BOOST_SPIRIT_IS_TAG() };
+ struct encoding { BOOST_SPIRIT_IS_TAG() };
#if defined(BOOST_SPIRIT_UNICODE)
///////////////////////////////////////////////////////////////////////////
// Unicode Major Categories
///////////////////////////////////////////////////////////////////////////
- struct letter {};
- struct mark {};
- struct number {};
- struct separator {};
- struct other {};
- struct punctuation {};
- struct symbol {};
+ struct letter { BOOST_SPIRIT_IS_TAG() };
+ struct mark { BOOST_SPIRIT_IS_TAG() };
+ struct number { BOOST_SPIRIT_IS_TAG() };
+ struct separator { BOOST_SPIRIT_IS_TAG() };
+ struct other { BOOST_SPIRIT_IS_TAG() };
+ struct punctuation { BOOST_SPIRIT_IS_TAG() };
+ struct symbol { BOOST_SPIRIT_IS_TAG() };
///////////////////////////////////////////////////////////////////////////
// Unicode General Categories
///////////////////////////////////////////////////////////////////////////
- struct uppercase_letter {};
- struct lowercase_letter {};
- struct titlecase_letter {};
- struct modifier_letter {};
- struct other_letter {};
-
- struct nonspacing_mark {};
- struct enclosing_mark {};
- struct spacing_mark {};
-
- struct decimal_number {};
- struct letter_number {};
- struct other_number {};
-
- struct space_separator {};
- struct line_separator {};
- struct paragraph_separator {};
-
- struct control {};
- struct format {};
- struct private_use {};
- struct surrogate {};
- struct unassigned {};
-
- struct dash_punctuation {};
- struct open_punctuation {};
- struct close_punctuation {};
- struct connector_punctuation {};
- struct other_punctuation {};
- struct initial_punctuation {};
- struct final_punctuation {};
-
- struct math_symbol {};
- struct currency_symbol {};
- struct modifier_symbol {};
- struct other_symbol {};
+ struct uppercase_letter { BOOST_SPIRIT_IS_TAG() };
+ struct lowercase_letter { BOOST_SPIRIT_IS_TAG() };
+ struct titlecase_letter { BOOST_SPIRIT_IS_TAG() };
+ struct modifier_letter { BOOST_SPIRIT_IS_TAG() };
+ struct other_letter { BOOST_SPIRIT_IS_TAG() };
+
+ struct nonspacing_mark { BOOST_SPIRIT_IS_TAG() };
+ struct enclosing_mark { BOOST_SPIRIT_IS_TAG() };
+ struct spacing_mark { BOOST_SPIRIT_IS_TAG() };
+
+ struct decimal_number { BOOST_SPIRIT_IS_TAG() };
+ struct letter_number { BOOST_SPIRIT_IS_TAG() };
+ struct other_number { BOOST_SPIRIT_IS_TAG() };
+
+ struct space_separator { BOOST_SPIRIT_IS_TAG() };
+ struct line_separator { BOOST_SPIRIT_IS_TAG() };
+ struct paragraph_separator { BOOST_SPIRIT_IS_TAG() };
+
+ struct control { BOOST_SPIRIT_IS_TAG() };
+ struct format { BOOST_SPIRIT_IS_TAG() };
+ struct private_use { BOOST_SPIRIT_IS_TAG() };
+ struct surrogate { BOOST_SPIRIT_IS_TAG() };
+ struct unassigned { BOOST_SPIRIT_IS_TAG() };
+
+ struct dash_punctuation { BOOST_SPIRIT_IS_TAG() };
+ struct open_punctuation { BOOST_SPIRIT_IS_TAG() };
+ struct close_punctuation { BOOST_SPIRIT_IS_TAG() };
+ struct connector_punctuation { BOOST_SPIRIT_IS_TAG() };
+ struct other_punctuation { BOOST_SPIRIT_IS_TAG() };
+ struct initial_punctuation { BOOST_SPIRIT_IS_TAG() };
+ struct final_punctuation { BOOST_SPIRIT_IS_TAG() };
+
+ struct math_symbol { BOOST_SPIRIT_IS_TAG() };
+ struct currency_symbol { BOOST_SPIRIT_IS_TAG() };
+ struct modifier_symbol { BOOST_SPIRIT_IS_TAG() };
+ struct other_symbol { BOOST_SPIRIT_IS_TAG() };
///////////////////////////////////////////////////////////////////////////
// Unicode Derived Categories
///////////////////////////////////////////////////////////////////////////
- struct alphabetic {};
- struct uppercase {};
- struct lowercase {};
- struct white_space {};
- struct hex_digit {};
- struct noncharacter_code_point {};
- struct default_ignorable_code_point {};
+ struct alphabetic { BOOST_SPIRIT_IS_TAG() };
+ struct uppercase { BOOST_SPIRIT_IS_TAG() };
+ struct lowercase { BOOST_SPIRIT_IS_TAG() };
+ struct white_space { BOOST_SPIRIT_IS_TAG() };
+ struct hex_digit { BOOST_SPIRIT_IS_TAG() };
+ struct noncharacter_code_point { BOOST_SPIRIT_IS_TAG() };
+ struct default_ignorable_code_point { BOOST_SPIRIT_IS_TAG() };
///////////////////////////////////////////////////////////////////////////
// Unicode Scripts
///////////////////////////////////////////////////////////////////////////
- struct arabic {};
- struct imperial_aramaic {};
- struct armenian {};
- struct avestan {};
- struct balinese {};
- struct bamum {};
- struct bengali {};
- struct bopomofo {};
- struct braille {};
- struct buginese {};
- struct buhid {};
- struct canadian_aboriginal {};
- struct carian {};
- struct cham {};
- struct cherokee {};
- struct coptic {};
- struct cypriot {};
- struct cyrillic {};
- struct devanagari {};
- struct deseret {};
- struct egyptian_hieroglyphs {};
- struct ethiopic {};
- struct georgian {};
- struct glagolitic {};
- struct gothic {};
- struct greek {};
- struct gujarati {};
- struct gurmukhi {};
- struct hangul {};
- struct han {};
- struct hanunoo {};
- struct hebrew {};
- struct hiragana {};
- struct katakana_or_hiragana {};
- struct old_italic {};
- struct javanese {};
- struct kayah_li {};
- struct katakana {};
- struct kharoshthi {};
- struct khmer {};
- struct kannada {};
- struct kaithi {};
- struct tai_tham {};
- struct lao {};
- struct latin {};
- struct lepcha {};
- struct limbu {};
- struct linear_b {};
- struct lisu {};
- struct lycian {};
- struct lydian {};
- struct malayalam {};
- struct mongolian {};
- struct meetei_mayek {};
- struct myanmar {};
- struct nko {};
- struct ogham {};
- struct ol_chiki {};
- struct old_turkic {};
- struct oriya {};
- struct osmanya {};
- struct phags_pa {};
- struct inscriptional_pahlavi {};
- struct phoenician {};
- struct inscriptional_parthian {};
- struct rejang {};
- struct runic {};
- struct samaritan {};
- struct old_south_arabian {};
- struct saurashtra {};
- struct shavian {};
- struct sinhala {};
- struct sundanese {};
- struct syloti_nagri {};
- struct syriac {};
- struct tagbanwa {};
- struct tai_le {};
- struct new_tai_lue {};
- struct tamil {};
- struct tai_viet {};
- struct telugu {};
- struct tifinagh {};
- struct tagalog {};
- struct thaana {};
- struct thai {};
- struct tibetan {};
- struct ugaritic {};
- struct vai {};
- struct old_persian {};
- struct cuneiform {};
- struct yi {};
- struct inherited {};
- struct common {};
- struct unknown {};
+ struct arabic { BOOST_SPIRIT_IS_TAG() };
+ struct imperial_aramaic { BOOST_SPIRIT_IS_TAG() };
+ struct armenian { BOOST_SPIRIT_IS_TAG() };
+ struct avestan { BOOST_SPIRIT_IS_TAG() };
+ struct balinese { BOOST_SPIRIT_IS_TAG() };
+ struct bamum { BOOST_SPIRIT_IS_TAG() };
+ struct bengali { BOOST_SPIRIT_IS_TAG() };
+ struct bopomofo { BOOST_SPIRIT_IS_TAG() };
+ struct braille { BOOST_SPIRIT_IS_TAG() };
+ struct buginese { BOOST_SPIRIT_IS_TAG() };
+ struct buhid { BOOST_SPIRIT_IS_TAG() };
+ struct canadian_aboriginal { BOOST_SPIRIT_IS_TAG() };
+ struct carian { BOOST_SPIRIT_IS_TAG() };
+ struct cham { BOOST_SPIRIT_IS_TAG() };
+ struct cherokee { BOOST_SPIRIT_IS_TAG() };
+ struct coptic { BOOST_SPIRIT_IS_TAG() };
+ struct cypriot { BOOST_SPIRIT_IS_TAG() };
+ struct cyrillic { BOOST_SPIRIT_IS_TAG() };
+ struct devanagari { BOOST_SPIRIT_IS_TAG() };
+ struct deseret { BOOST_SPIRIT_IS_TAG() };
+ struct egyptian_hieroglyphs { BOOST_SPIRIT_IS_TAG() };
+ struct ethiopic { BOOST_SPIRIT_IS_TAG() };
+ struct georgian { BOOST_SPIRIT_IS_TAG() };
+ struct glagolitic { BOOST_SPIRIT_IS_TAG() };
+ struct gothic { BOOST_SPIRIT_IS_TAG() };
+ struct greek { BOOST_SPIRIT_IS_TAG() };
+ struct gujarati { BOOST_SPIRIT_IS_TAG() };
+ struct gurmukhi { BOOST_SPIRIT_IS_TAG() };
+ struct hangul { BOOST_SPIRIT_IS_TAG() };
+ struct han { BOOST_SPIRIT_IS_TAG() };
+ struct hanunoo { BOOST_SPIRIT_IS_TAG() };
+ struct hebrew { BOOST_SPIRIT_IS_TAG() };
+ struct hiragana { BOOST_SPIRIT_IS_TAG() };
+ struct katakana_or_hiragana { BOOST_SPIRIT_IS_TAG() };
+ struct old_italic { BOOST_SPIRIT_IS_TAG() };
+ struct javanese { BOOST_SPIRIT_IS_TAG() };
+ struct kayah_li { BOOST_SPIRIT_IS_TAG() };
+ struct katakana { BOOST_SPIRIT_IS_TAG() };
+ struct kharoshthi { BOOST_SPIRIT_IS_TAG() };
+ struct khmer { BOOST_SPIRIT_IS_TAG() };
+ struct kannada { BOOST_SPIRIT_IS_TAG() };
+ struct kaithi { BOOST_SPIRIT_IS_TAG() };
+ struct tai_tham { BOOST_SPIRIT_IS_TAG() };
+ struct lao { BOOST_SPIRIT_IS_TAG() };
+ struct latin { BOOST_SPIRIT_IS_TAG() };
+ struct lepcha { BOOST_SPIRIT_IS_TAG() };
+ struct limbu { BOOST_SPIRIT_IS_TAG() };
+ struct linear_b { BOOST_SPIRIT_IS_TAG() };
+ struct lisu { BOOST_SPIRIT_IS_TAG() };
+ struct lycian { BOOST_SPIRIT_IS_TAG() };
+ struct lydian { BOOST_SPIRIT_IS_TAG() };
+ struct malayalam { BOOST_SPIRIT_IS_TAG() };
+ struct mongolian { BOOST_SPIRIT_IS_TAG() };
+ struct meetei_mayek { BOOST_SPIRIT_IS_TAG() };
+ struct myanmar { BOOST_SPIRIT_IS_TAG() };
+ struct nko { BOOST_SPIRIT_IS_TAG() };
+ struct ogham { BOOST_SPIRIT_IS_TAG() };
+ struct ol_chiki { BOOST_SPIRIT_IS_TAG() };
+ struct old_turkic { BOOST_SPIRIT_IS_TAG() };
+ struct oriya { BOOST_SPIRIT_IS_TAG() };
+ struct osmanya { BOOST_SPIRIT_IS_TAG() };
+ struct phags_pa { BOOST_SPIRIT_IS_TAG() };
+ struct inscriptional_pahlavi { BOOST_SPIRIT_IS_TAG() };
+ struct phoenician { BOOST_SPIRIT_IS_TAG() };
+ struct inscriptional_parthian { BOOST_SPIRIT_IS_TAG() };
+ struct rejang { BOOST_SPIRIT_IS_TAG() };
+ struct runic { BOOST_SPIRIT_IS_TAG() };
+ struct samaritan { BOOST_SPIRIT_IS_TAG() };
+ struct old_south_arabian { BOOST_SPIRIT_IS_TAG() };
+ struct saurashtra { BOOST_SPIRIT_IS_TAG() };
+ struct shavian { BOOST_SPIRIT_IS_TAG() };
+ struct sinhala { BOOST_SPIRIT_IS_TAG() };
+ struct sundanese { BOOST_SPIRIT_IS_TAG() };
+ struct syloti_nagri { BOOST_SPIRIT_IS_TAG() };
+ struct syriac { BOOST_SPIRIT_IS_TAG() };
+ struct tagbanwa { BOOST_SPIRIT_IS_TAG() };
+ struct tai_le { BOOST_SPIRIT_IS_TAG() };
+ struct new_tai_lue { BOOST_SPIRIT_IS_TAG() };
+ struct tamil { BOOST_SPIRIT_IS_TAG() };
+ struct tai_viet { BOOST_SPIRIT_IS_TAG() };
+ struct telugu { BOOST_SPIRIT_IS_TAG() };
+ struct tifinagh { BOOST_SPIRIT_IS_TAG() };
+ struct tagalog { BOOST_SPIRIT_IS_TAG() };
+ struct thaana { BOOST_SPIRIT_IS_TAG() };
+ struct thai { BOOST_SPIRIT_IS_TAG() };
+ struct tibetan { BOOST_SPIRIT_IS_TAG() };
+ struct ugaritic { BOOST_SPIRIT_IS_TAG() };
+ struct vai { BOOST_SPIRIT_IS_TAG() };
+ struct old_persian { BOOST_SPIRIT_IS_TAG() };
+ struct cuneiform { BOOST_SPIRIT_IS_TAG() };
+ struct yi { BOOST_SPIRIT_IS_TAG() };
+ struct inherited { BOOST_SPIRIT_IS_TAG() };
+ struct common { BOOST_SPIRIT_IS_TAG() };
+ struct unknown { BOOST_SPIRIT_IS_TAG() };
#endif
///////////////////////////////////////////////////////////////////////////
@@ -269,10 +271,10 @@
struct char_code
: char_code_base<CharClass>, char_encoding_base<CharEncoding>
{
+ BOOST_SPIRIT_IS_TAG()
typedef CharEncoding char_encoding; // e.g. ascii
typedef CharClass char_class; // e.g. tag::alnum
};
-
}}}
namespace boost { namespace spirit { namespace char_class
Modified: branches/release/boost/spirit/home/support/common_terminals.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/common_terminals.hpp (original)
+++ branches/release/boost/spirit/home/support/common_terminals.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -136,8 +136,8 @@
// special tags (used mainly for stateful tag types)
namespace tag
{
- struct attr_cast {};
- struct as {};
+ struct attr_cast { BOOST_SPIRIT_IS_TAG() };
+ struct as { BOOST_SPIRIT_IS_TAG() };
}
}}
Modified: branches/release/boost/spirit/home/support/container.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/container.hpp (original)
+++ branches/release/boost/spirit/home/support/container.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -41,7 +41,7 @@
}
template <typename T, typename Enable/* = void*/>
- struct is_container
+ struct is_container
: mpl::bool_<
detail::has_value_type<T>::value &&
detail::has_iterator<T>::value &&
@@ -50,23 +50,29 @@
{};
template <typename T>
- struct is_container<T&>
- : is_container<T>
+ struct is_container<T&>
+ : is_container<T>
{};
template <typename T>
- struct is_container<boost::optional<T> >
- : is_container<T>
+ struct is_container<boost::optional<T> >
+ : is_container<T>
{};
#define BOOST_SPIRIT_IS_CONTAINER(z, N, data) \
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)> >
+ struct is_container<variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
: mpl::bool_<BOOST_PP_REPEAT(BOOST_VARIANT_LIMIT_TYPES
- , BOOST_SPIRIT_IS_CONTAINER, _) false>
+ , BOOST_SPIRIT_IS_CONTAINER, _) false>
{};
#undef BOOST_SPIRIT_IS_CONTAINER
@@ -91,7 +97,7 @@
};
template <typename T>
- struct remove_value_const<T const>
+ struct remove_value_const<T const>
: remove_value_const<T>
{};
@@ -113,25 +119,25 @@
//]
template <typename T>
- struct container_value<T&>
- : container_value<T>
+ struct container_value<T&>
+ : container_value<T>
{};
// this will be instantiated if the optional holds a container
template <typename T>
- struct container_value<boost::optional<T> >
- : container_value<T>
+ struct container_value<boost::optional<T> >
+ : container_value<T>
{};
// this will be instantiated if the variant holds a container
template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
struct container_value<variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
{
- typedef typename
- variant<BOOST_VARIANT_ENUM_PARAMS(T)>::types
+ typedef typename
+ variant<BOOST_VARIANT_ENUM_PARAMS(T)>::types
types;
- typedef typename
- mpl::find_if<types, is_container<mpl::_1> >::type
+ typedef typename
+ mpl::find_if<types, is_container<mpl::_1> >::type
iter;
typedef typename container_value<
@@ -387,7 +393,7 @@
///////////////////////////////////////////////////////////////////////////
template <typename Container, typename Enable/* = void*/>
- struct begin_container
+ struct begin_container
{
static typename container_iterator<Container>::type call(Container& c)
{
@@ -534,7 +540,7 @@
///////////////////////////////////////////////////////////////////////////
template <typename Container>
- struct begin
+ struct begin
: traits::container_iterator<Container>
{};
Modified: branches/release/boost/spirit/home/support/context.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/context.hpp (original)
+++ branches/release/boost/spirit/home/support/context.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -1,5 +1,7 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2001-2011 Hartmut Kaiser
+ Copyright (c) 2011 Thomas Heller
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)
@@ -12,11 +14,11 @@
#endif
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/home/support/nonterminal/expand_arg.hpp>
#include <boost/spirit/home/support/assert_msg.hpp>
#include <boost/spirit/home/support/argument.hpp>
-#include <boost/spirit/home/phoenix/core/actor.hpp>
-#include <boost/spirit/home/phoenix/core/argument.hpp>
+#include <boost/spirit/home/support/limits.hpp>
#include <boost/fusion/include/at.hpp>
#include <boost/fusion/include/size.hpp>
#include <boost/fusion/include/as_list.hpp>
@@ -24,37 +26,71 @@
#include <boost/mpl/size.hpp>
#include <boost/mpl/at.hpp>
-#if !defined(SPIRIT_ATTRIBUTES_LIMIT)
-# define SPIRIT_ATTRIBUTES_LIMIT PHOENIX_LIMIT
-#endif
-
+///////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
-#define SPIRIT_DECLARE_ATTRIBUTE(z, n, data) \
- typedef phoenix::actor<attribute<n> > const \
- BOOST_PP_CAT(BOOST_PP_CAT(_r, n), _type); \
- phoenix::actor<attribute<n> > const \
- BOOST_PP_CAT(_r, n) = attribute<n>();
-
-#define SPIRIT_USING_ATTRIBUTE(z, n, data) \
- using spirit::BOOST_PP_CAT(BOOST_PP_CAT(_r, n), _type); \
- using spirit::BOOST_PP_CAT(_r, n); \
+#define SPIRIT_DECLARE_ATTRIBUTE(z, n, data) \
+ typedef phoenix::actor<attribute<n> > \
+ BOOST_PP_CAT(BOOST_PP_CAT(_r, n), _type); \
+ phoenix::actor<attribute<n> > const \
+ BOOST_PP_CAT(_r, n) = BOOST_PP_CAT(BOOST_PP_CAT(_r, n), _type)();
+ /***/
+#define SPIRIT_USING_ATTRIBUTE(z, n, data) \
+ using spirit::BOOST_PP_CAT(BOOST_PP_CAT(_r, n), _type); \
+ using spirit::BOOST_PP_CAT(_r, n); \
/***/
#else
-#define SPIRIT_DECLARE_ATTRIBUTE(z, n, data) \
- typedef phoenix::actor<attribute<n> > const \
- BOOST_PP_CAT(BOOST_PP_CAT(_r, n), _type); \
-
-#define SPIRIT_USING_ATTRIBUTE(z, n, data) \
- using spirit::BOOST_PP_CAT(BOOST_PP_CAT(_r, n), _type); \
+#define SPIRIT_DECLARE_ATTRIBUTE(z, n, data) \
+ typedef phoenix::actor<attribute<n> > \
+ BOOST_PP_CAT(BOOST_PP_CAT(_r, n), _type); \
+ /***/
+#define SPIRIT_USING_ATTRIBUTE(z, n, data) \
+ using spirit::BOOST_PP_CAT(BOOST_PP_CAT(_r, n), _type); \
/***/
#endif
namespace boost { namespace spirit
{
+ template <int>
+ struct attribute;
+
+ template <int>
+ struct local_variable;
+}}
+
+BOOST_PHOENIX_DEFINE_CUSTOM_TERMINAL(
+ template <int N>
+ , boost::spirit::attribute<N>
+ , mpl::false_ // is not nullary
+ , v2_eval(
+ proto::make<
+ boost::spirit::attribute<N>()
+ >
+ , proto::call<
+ functional::env(proto::_state)
+ >
+ )
+)
+
+BOOST_PHOENIX_DEFINE_CUSTOM_TERMINAL(
+ template <int N>
+ , boost::spirit::local_variable<N>
+ , mpl::false_ // is not nullary
+ , v2_eval(
+ proto::make<
+ boost::spirit::local_variable<N>()
+ >
+ , proto::call<
+ functional::env(proto::_state)
+ >
+ )
+)
+
+namespace boost { namespace spirit
+{
template <typename Attributes, typename Locals>
struct context
{
@@ -100,6 +136,11 @@
};
template <typename Context>
+ struct attributes_of<Context &>
+ : attributes_of<Context>
+ {};
+
+ template <typename Context>
struct locals_of
{
typedef typename Context::locals_type type;
@@ -111,6 +152,12 @@
typedef typename Context::locals_type const type;
};
+ template <typename Context>
+ struct locals_of<Context &>
+ {
+ typedef typename Context::locals_type type;
+ };
+
template <int N>
struct attribute
{
@@ -182,21 +229,19 @@
return get_arg<N>((fusion::at_c<1>(env.args())).locals);
}
};
-
+
typedef phoenix::actor<attribute<0> > const _val_type;
typedef phoenix::actor<attribute<0> > const _r0_type;
typedef phoenix::actor<attribute<1> > const _r1_type;
typedef phoenix::actor<attribute<2> > const _r2_type;
#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
-
// _val refers to the 'return' value of a rule (same as _r0)
// _r1, _r2, ... refer to the rule arguments
- _val_type _val = attribute<0>();
- _r0_type _r0 = attribute<0>();
- _r1_type _r1 = attribute<1>();
- _r2_type _r2 = attribute<2>();
-
+ _val_type _val = _val_type();
+ _r0_type _r0 = _r0_type();
+ _r1_type _r1 = _r1_type();
+ _r2_type _r2 = _r2_type();
#endif
// Bring in the rest of the attributes (_r4 .. _rN+1), using PP
@@ -215,20 +260,19 @@
typedef phoenix::actor<local_variable<9> > const _j_type;
#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
-
// _a, _b, ... refer to the local variables of a rule
- _a_type _a = local_variable<0>();
- _b_type _b = local_variable<1>();
- _c_type _c = local_variable<2>();
- _d_type _d = local_variable<3>();
- _e_type _e = local_variable<4>();
- _f_type _f = local_variable<5>();
- _g_type _g = local_variable<6>();
- _h_type _h = local_variable<7>();
- _i_type _i = local_variable<8>();
- _j_type _j = local_variable<9>();
-
+ _a_type _a = _a_type();
+ _b_type _b = _b_type();
+ _c_type _c = _c_type();
+ _d_type _d = _d_type();
+ _e_type _e = _e_type();
+ _f_type _f = _f_type();
+ _g_type _g = _g_type();
+ _h_type _h = _h_type();
+ _i_type _i = _i_type();
+ _j_type _j = _j_type();
#endif
+
// You can bring these in with the using directive
// without worrying about bringing in too much.
namespace labels
Added: branches/release/boost/spirit/home/support/detail/is_spirit_tag.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/spirit/home/support/detail/is_spirit_tag.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -0,0 +1,20 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Hartmut Kaiser
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_SPIRIT_SUPPORT_DETAIL_IS_SPIRIT_TAG_MAR_28_2011_0341PM)
+#define BOOST_SPIRIT_SUPPORT_DETAIL_IS_SPIRIT_TAG_MAR_28_2011_0341PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
+#define BOOST_SPIRIT_IS_TAG()
+#else
+#define BOOST_SPIRIT_IS_TAG() typedef void is_spirit_tag;
+#endif
+
+#endif
Modified: branches/release/boost/spirit/home/support/detail/make_cons.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/make_cons.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/make_cons.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -12,6 +12,7 @@
#pragma once
#endif
+#include <boost/spirit/include/phoenix_limits.hpp> // needs to be included before proto
#include <boost/proto/proto.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/fusion/include/cons.hpp>
Modified: branches/release/boost/spirit/home/support/detail/pow10.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/pow10.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/pow10.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -16,77 +16,94 @@
#include <boost/config/no_tr1/cmath.hpp>
#include <limits>
#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/numeric_traits.hpp>
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
# pragma warning(push)
# pragma warning(disable: 4244) // conversion from 'double' to 'float', possible loss of data
#endif
-namespace boost { namespace spirit { namespace detail
+namespace boost { namespace spirit { namespace traits
{
- template <typename T>
- inline T pow10(unsigned dim)
+ template <typename T, typename Enable/* = void*/>
+ struct pow10_helper
{
- using namespace std; // allow for ADL to find the correct overload
- return pow(T(10), T(dim));
- }
+ static T call(unsigned dim)
+ {
+ using namespace std; // allow for ADL to find the correct overload
+ return pow(T(10), T(dim));
+ }
+ };
template <>
- inline unused_type pow10<unused_type>(unsigned)
+ struct pow10_helper<unused_type>
{
- return unused;
- }
+ static unused_type call(unused_type)
+ {
+ return unused;
+ }
+ };
#if (DBL_MAX_EXP == 308) // for IEEE-754
template <>
- inline double pow10<double>(unsigned dim)
+ struct pow10_helper<double>
{
- static double const exponents[] =
+ static double call(unsigned dim)
{
- 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
- 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
- 1e20, 1e21, 1e22, 1e23, 1e24, 1e25, 1e26, 1e27, 1e28, 1e29,
- 1e30, 1e31, 1e32, 1e33, 1e34, 1e35, 1e36, 1e37, 1e38, 1e39,
- 1e40, 1e41, 1e42, 1e43, 1e44, 1e45, 1e46, 1e47, 1e48, 1e49,
- 1e50, 1e51, 1e52, 1e53, 1e54, 1e55, 1e56, 1e57, 1e58, 1e59,
- 1e60, 1e61, 1e62, 1e63, 1e64, 1e65, 1e66, 1e67, 1e68, 1e69,
- 1e70, 1e71, 1e72, 1e73, 1e74, 1e75, 1e76, 1e77, 1e78, 1e79,
- 1e80, 1e81, 1e82, 1e83, 1e84, 1e85, 1e86, 1e87, 1e88, 1e89,
- 1e90, 1e91, 1e92, 1e93, 1e94, 1e95, 1e96, 1e97, 1e98, 1e99,
- 1e100, 1e101, 1e102, 1e103, 1e104, 1e105, 1e106, 1e107, 1e108, 1e109,
- 1e110, 1e111, 1e112, 1e113, 1e114, 1e115, 1e116, 1e117, 1e118, 1e119,
- 1e120, 1e121, 1e122, 1e123, 1e124, 1e125, 1e126, 1e127, 1e128, 1e129,
- 1e130, 1e131, 1e132, 1e133, 1e134, 1e135, 1e136, 1e137, 1e138, 1e139,
- 1e140, 1e141, 1e142, 1e143, 1e144, 1e145, 1e146, 1e147, 1e148, 1e149,
- 1e150, 1e151, 1e152, 1e153, 1e154, 1e155, 1e156, 1e157, 1e158, 1e159,
- 1e160, 1e161, 1e162, 1e163, 1e164, 1e165, 1e166, 1e167, 1e168, 1e169,
- 1e170, 1e171, 1e172, 1e173, 1e174, 1e175, 1e176, 1e177, 1e178, 1e179,
- 1e180, 1e181, 1e182, 1e183, 1e184, 1e185, 1e186, 1e187, 1e188, 1e189,
- 1e190, 1e191, 1e192, 1e193, 1e194, 1e195, 1e196, 1e197, 1e198, 1e199,
- 1e200, 1e201, 1e202, 1e203, 1e204, 1e205, 1e206, 1e207, 1e208, 1e209,
- 1e210, 1e211, 1e212, 1e213, 1e214, 1e215, 1e216, 1e217, 1e218, 1e219,
- 1e220, 1e221, 1e222, 1e223, 1e224, 1e225, 1e226, 1e227, 1e228, 1e229,
- 1e230, 1e231, 1e232, 1e233, 1e234, 1e235, 1e236, 1e237, 1e238, 1e239,
- 1e240, 1e241, 1e242, 1e243, 1e244, 1e245, 1e246, 1e247, 1e248, 1e249,
- 1e250, 1e251, 1e252, 1e253, 1e254, 1e255, 1e256, 1e257, 1e258, 1e259,
- 1e260, 1e261, 1e262, 1e263, 1e264, 1e265, 1e266, 1e267, 1e268, 1e269,
- 1e270, 1e271, 1e272, 1e273, 1e274, 1e275, 1e276, 1e277, 1e278, 1e279,
- 1e280, 1e281, 1e282, 1e283, 1e284, 1e285, 1e286, 1e287, 1e288, 1e289,
- 1e290, 1e291, 1e292, 1e293, 1e294, 1e295, 1e296, 1e297, 1e298, 1e299,
- 1e300, 1e301, 1e302, 1e303, 1e304, 1e305, 1e306, 1e307, 1e308,
- };
- BOOST_ASSERT(dim < sizeof(exponents)/sizeof(double));
- return exponents[dim];
- }
+ static double const exponents[] =
+ {
+ 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
+ 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
+ 1e20, 1e21, 1e22, 1e23, 1e24, 1e25, 1e26, 1e27, 1e28, 1e29,
+ 1e30, 1e31, 1e32, 1e33, 1e34, 1e35, 1e36, 1e37, 1e38, 1e39,
+ 1e40, 1e41, 1e42, 1e43, 1e44, 1e45, 1e46, 1e47, 1e48, 1e49,
+ 1e50, 1e51, 1e52, 1e53, 1e54, 1e55, 1e56, 1e57, 1e58, 1e59,
+ 1e60, 1e61, 1e62, 1e63, 1e64, 1e65, 1e66, 1e67, 1e68, 1e69,
+ 1e70, 1e71, 1e72, 1e73, 1e74, 1e75, 1e76, 1e77, 1e78, 1e79,
+ 1e80, 1e81, 1e82, 1e83, 1e84, 1e85, 1e86, 1e87, 1e88, 1e89,
+ 1e90, 1e91, 1e92, 1e93, 1e94, 1e95, 1e96, 1e97, 1e98, 1e99,
+ 1e100, 1e101, 1e102, 1e103, 1e104, 1e105, 1e106, 1e107, 1e108, 1e109,
+ 1e110, 1e111, 1e112, 1e113, 1e114, 1e115, 1e116, 1e117, 1e118, 1e119,
+ 1e120, 1e121, 1e122, 1e123, 1e124, 1e125, 1e126, 1e127, 1e128, 1e129,
+ 1e130, 1e131, 1e132, 1e133, 1e134, 1e135, 1e136, 1e137, 1e138, 1e139,
+ 1e140, 1e141, 1e142, 1e143, 1e144, 1e145, 1e146, 1e147, 1e148, 1e149,
+ 1e150, 1e151, 1e152, 1e153, 1e154, 1e155, 1e156, 1e157, 1e158, 1e159,
+ 1e160, 1e161, 1e162, 1e163, 1e164, 1e165, 1e166, 1e167, 1e168, 1e169,
+ 1e170, 1e171, 1e172, 1e173, 1e174, 1e175, 1e176, 1e177, 1e178, 1e179,
+ 1e180, 1e181, 1e182, 1e183, 1e184, 1e185, 1e186, 1e187, 1e188, 1e189,
+ 1e190, 1e191, 1e192, 1e193, 1e194, 1e195, 1e196, 1e197, 1e198, 1e199,
+ 1e200, 1e201, 1e202, 1e203, 1e204, 1e205, 1e206, 1e207, 1e208, 1e209,
+ 1e210, 1e211, 1e212, 1e213, 1e214, 1e215, 1e216, 1e217, 1e218, 1e219,
+ 1e220, 1e221, 1e222, 1e223, 1e224, 1e225, 1e226, 1e227, 1e228, 1e229,
+ 1e230, 1e231, 1e232, 1e233, 1e234, 1e235, 1e236, 1e237, 1e238, 1e239,
+ 1e240, 1e241, 1e242, 1e243, 1e244, 1e245, 1e246, 1e247, 1e248, 1e249,
+ 1e250, 1e251, 1e252, 1e253, 1e254, 1e255, 1e256, 1e257, 1e258, 1e259,
+ 1e260, 1e261, 1e262, 1e263, 1e264, 1e265, 1e266, 1e267, 1e268, 1e269,
+ 1e270, 1e271, 1e272, 1e273, 1e274, 1e275, 1e276, 1e277, 1e278, 1e279,
+ 1e280, 1e281, 1e282, 1e283, 1e284, 1e285, 1e286, 1e287, 1e288, 1e289,
+ 1e290, 1e291, 1e292, 1e293, 1e294, 1e295, 1e296, 1e297, 1e298, 1e299,
+ 1e300, 1e301, 1e302, 1e303, 1e304, 1e305, 1e306, 1e307, 1e308,
+ };
+ BOOST_ASSERT(dim < sizeof(exponents)/sizeof(double));
+ return exponents[dim];
+ }
+ };
template <>
- inline float pow10<float>(unsigned dim)
+ struct pow10_helper<double>
{
- return pow10<double>(dim);
- }
-
+ inline float pow10<float>(unsigned dim)
+ {
+ return pow10_helper<double>::call(dim);
+ }
+ };
#endif // for IEEE-754
+ template <typename T>
+ inline T pow10(unsigned dim)
+ {
+ return pow10_helper<T>::call(dim);
+ }
}}}
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
Modified: branches/release/boost/spirit/home/support/lazy.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/lazy.hpp (original)
+++ branches/release/boost/spirit/home/support/lazy.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -14,6 +14,7 @@
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/proto/proto.hpp>
#include <boost/spirit/home/support/modify.hpp>
+#include <boost/spirit/home/support/detail/is_spirit_tag.hpp>
namespace boost { namespace spirit
{
@@ -26,7 +27,10 @@
namespace tag
{
- struct lazy_eval {};
+ struct lazy_eval
+ {
+ BOOST_SPIRIT_IS_TAG()
+ };
}
template <typename Domain>
Modified: branches/release/boost/spirit/home/support/make_component.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/make_component.hpp (original)
+++ branches/release/boost/spirit/home/support/make_component.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -12,6 +12,7 @@
#pragma once
#endif
+#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/proto/proto.hpp>
#include <boost/spirit/home/support/detail/make_cons.hpp>
#include <boost/spirit/home/support/modify.hpp>
@@ -53,39 +54,79 @@
namespace boost { namespace spirit { namespace detail
{
- template <typename Domain>
- struct make_terminal : proto::transform<make_terminal<Domain> >
+ template <typename Expr, typename State, typename Data, typename Domain>
+ struct make_terminal_impl
+ : proto::transform_impl<Expr, State, Data>
{
- template<typename Expr, typename State, typename Data>
- struct impl : proto::transform_impl<Expr, State, Data>
+ typedef typename
+ proto::result_of::value<Expr>::type
+ value;
+
+ typedef typename result_of::make_cons<value>::type elements;
+
+ typedef
+ make_component<Domain, proto::tag::terminal>
+ make_component_;
+
+ typedef typename
+ make_component_::template
+ result<make_component_(elements, Data)>::type
+ result_type;
+
+ result_type operator()(
+ typename make_terminal_impl::expr_param expr
+ , typename make_terminal_impl::state_param /*state*/
+ , typename make_terminal_impl::data_param data
+ ) const
{
- typedef typename
- proto::result_of::value<Expr>::type
- value;
-
- typedef typename result_of::make_cons<value>::type elements;
+ return typename make_terminal_impl::make_component_()(
+ detail::make_cons(proto::value(expr))
+ , data
+ );
+ }
+ };
- typedef
- make_component<Domain, proto::tag::terminal>
- make_component_;
+ template <typename Expr, typename State, typename Data, typename Domain>
+ struct make_terminal_impl<phoenix::actor<Expr>, State, Data, Domain>
+ : proto::transform_impl<phoenix::actor<Expr>, State, Data>
+ {
+ typedef phoenix::actor<Expr> value;
+ typedef typename result_of::make_cons<value>::type elements;
+ typedef make_component<Domain, proto::tag::terminal> make_component_;
+
+ typedef typename
+ make_component_::template
+ result<make_component_(elements, Data)>::type
+ result_type;
+
+ result_type operator()(
+ typename make_terminal_impl::expr_param expr
+ , typename make_terminal_impl::state_param /*state*/
+ , typename make_terminal_impl::data_param data
+ ) const
+ {
+ return typename make_terminal_impl::make_component_()(
+ detail::make_cons(expr)
+ , data
+ );
+ }
+ };
- typedef typename
- make_component_::template
- result<make_component_(elements, Data)>::type
- result_type;
+ template <typename Expr, typename State, typename Data, typename Domain>
+ struct make_terminal_impl<phoenix::actor<Expr> &, State, Data, Domain>
+ : make_terminal_impl<phoenix::actor<Expr>, State, Data, Domain>
+ {};
+
+ template <typename Expr, typename State, typename Data, typename Domain>
+ struct make_terminal_impl<phoenix::actor<Expr> const &, State, Data, Domain>
+ : make_terminal_impl<phoenix::actor<Expr>, State, Data, Domain>
+ {};
- result_type operator()(
- typename impl::expr_param expr
- , typename impl::state_param /*state*/
- , typename impl::data_param data
- ) const
- {
- return typename impl::make_component_()(
- detail::make_cons(proto::value(expr))
- , data
- );
- }
- };
+ template <typename Domain>
+ struct make_terminal : proto::transform<make_terminal<Domain> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl : make_terminal_impl<Expr, State, Data, Domain> {};
};
template <typename Domain, typename Tag, typename Grammar>
@@ -321,11 +362,25 @@
)>::type
lhs_component;
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
typedef typename
proto::result_of::value<
typename proto::result_of::child_c<Expr, 1>::type
>::type
rhs_component;
+#else
+ typedef
+ typename mpl::eval_if_c<
+ phoenix::is_actor<
+ typename proto::result_of::child_c<Expr, 1>::type
+ >::type::value
+ , proto::result_of::child_c<Expr, 1>
+ , proto::result_of::value<
+ typename proto::result_of::child_c<Expr, 1>::type
+ >
+ >::type
+ rhs_component;
+#endif
typedef typename
result_of::make_cons<
@@ -341,6 +396,7 @@
result<make_component_(elements_type, Data)>::type
result_type;
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
result_type operator()(
typename impl::expr_param expr
, typename impl::state_param state
@@ -357,6 +413,60 @@
return make_component_()(elements, data);
}
+#else
+ result_type operator()(
+ typename impl::expr_param expr
+ , typename impl::state_param state
+ , typename impl::data_param data
+ ) const
+ {
+ return
+ (*this)(
+ expr
+ , state
+ , data
+ , typename phoenix::is_actor<
+ typename proto::result_of::child_c<Expr, 1>::type
+ >::type()
+ );
+ }
+
+ result_type operator()(
+ typename impl::expr_param expr
+ , typename impl::state_param state
+ , typename impl::data_param data
+ , mpl::false_
+ ) const
+ {
+ elements_type elements =
+ detail::make_cons(
+ Grammar()(
+ proto::child_c<0>(expr), state, data) // LHS
+ , detail::make_cons(
+ proto::value(proto::child_c<1>(expr))) // RHS
+ );
+
+ return make_component_()(elements, data);
+ }
+
+ result_type operator()(
+ typename impl::expr_param expr
+ , typename impl::state_param state
+ , typename impl::data_param data
+ , mpl::true_
+ ) const
+ {
+ elements_type elements =
+ detail::make_cons(
+ Grammar()(
+ proto::child_c<0>(expr), state, data) // LHS
+ , detail::make_cons(
+ proto::child_c<1>(expr)) // RHS
+ );
+
+ return make_component_()(elements, data);
+ }
+#endif
};
};
}}}
Modified: branches/release/boost/spirit/home/support/meta_compiler.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/meta_compiler.hpp (original)
+++ branches/release/boost/spirit/home/support/meta_compiler.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -13,7 +13,9 @@
#endif
#include <boost/config.hpp>
+#include <boost/spirit/include/phoenix_limits.hpp>
#include <boost/detail/workaround.hpp>
+#include <boost/spirit/include/phoenix_limits.hpp> // needs to be included before proto
#include <boost/proto/proto.hpp>
#include <boost/spirit/home/support/make_component.hpp>
#include <boost/spirit/home/support/modify.hpp>
Modified: branches/release/boost/spirit/home/support/modify.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/modify.hpp (original)
+++ branches/release/boost/spirit/home/support/modify.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -12,6 +12,7 @@
#pragma once
#endif
+#include <boost/spirit/include/phoenix_limits.hpp> // needs to be included before proto
#include <boost/proto/proto.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_base_of.hpp>
Modified: branches/release/boost/spirit/home/support/numeric_traits.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/numeric_traits.hpp (original)
+++ branches/release/boost/spirit/home/support/numeric_traits.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -92,6 +92,21 @@
template <>
struct is_real<long double> : mpl::true_ {};
+
+ ///////////////////////////////////////////////////////////////////////////
+ // customization points for numeric operations
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename T, typename Enable = void>
+ struct absolute_value;
+
+ template <typename T, typename Enable = void>
+ struct is_negative;
+
+ template <typename T, typename Enable = void>
+ struct is_zero;
+
+ template <typename T, typename Enable = void>
+ struct pow10_helper;
}}}
#endif
Modified: branches/release/boost/spirit/home/support/terminal.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/terminal.hpp (original)
+++ branches/release/boost/spirit/home/support/terminal.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -1,5 +1,7 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2001-2011 Hartmut Kaiser
+ Copyright (c) 2011 Thomas Heller
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)
@@ -11,15 +13,18 @@
#pragma once
#endif
-#include <boost/proto/proto.hpp>
-#include <boost/fusion/include/void.hpp>
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_function.hpp>
+#include <boost/proto/proto.hpp>
+#include <boost/fusion/include/void.hpp>
#include <boost/spirit/home/support/meta_compiler.hpp>
#include <boost/spirit/home/support/detail/make_vector.hpp>
#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/detail/is_spirit_tag.hpp>
#include <boost/preprocessor/tuple/elem.hpp>
+#include <boost/spirit/home/support/terminal_expression.hpp>
+
namespace boost { namespace spirit
{
template <typename Terminal, typename Args>
@@ -60,6 +65,13 @@
template <typename Domain, typename Terminal, int Arity, typename Enable = void>
struct use_lazy_directive : mpl::false_ {};
+ template <typename Terminal>
+ struct terminal;
+
+ template <typename Domain, typename Terminal>
+ struct use_terminal<Domain, terminal<Terminal> >
+ : use_terminal<Domain, Terminal> {};
+
template <typename Domain, typename Terminal, int Arity, typename Actor>
struct use_terminal<Domain, lazy_terminal<Terminal, Actor, Arity> >
: use_lazy_terminal<Domain, Terminal, Arity> {};
@@ -84,11 +96,7 @@
proto::terminal<
lazy_terminal<
typename F::terminal_type
- , phoenix::actor<
- typename phoenix::as_composite<
- phoenix::detail::function_eval<1>, F, A0
- >::type
- >
+ , typename phoenix::detail::expression::function_eval<F, A0>::type
, 1 // arity
>
>::type
@@ -100,7 +108,7 @@
{
typedef typename result_type::proto_child0 child_type;
return result_type::make(child_type(
- phoenix::compose<phoenix::detail::function_eval<1> >(f, _0)
+ phoenix::detail::expression::function_eval<F, A0>::make(f, _0)
, f.proto_base().child0
));
}
@@ -113,11 +121,7 @@
proto::terminal<
lazy_terminal<
typename F::terminal_type
- , phoenix::actor<
- typename phoenix::as_composite<
- phoenix::detail::function_eval<2>, F, A0, A1
- >::type
- >
+ , typename phoenix::detail::expression::function_eval<F, A0, A1>::type
, 2 // arity
>
>::type
@@ -129,7 +133,7 @@
{
typedef typename result_type::proto_child0 child_type;
return result_type::make(child_type(
- phoenix::compose<phoenix::detail::function_eval<2> >(f, _0, _1)
+ phoenix::detail::expression::function_eval<F, A0, A1>::make(f, _0, _1)
, f.proto_base().child0
));
}
@@ -142,11 +146,7 @@
proto::terminal<
lazy_terminal<
typename F::terminal_type
- , phoenix::actor<
- typename phoenix::as_composite<
- phoenix::detail::function_eval<3>, F, A0, A1, A2
- >::type
- >
+ , typename phoenix::detail::expression::function_eval<F, A0, A1, A2>::type
, 3 // arity
>
>::type
@@ -158,7 +158,7 @@
{
typedef typename result_type::proto_child0 child_type;
return result_type::make(child_type(
- phoenix::compose<phoenix::detail::function_eval<3> >(f, _0, _1, _2)
+ phoenix::detail::expression::function_eval<F, A0, A1, A2>::make(f, _0, _1, _2)
, f.proto_base().child0
));
}
@@ -167,14 +167,19 @@
namespace detail
{
// Helper struct for SFINAE purposes
- template <bool C>
- struct bool_;
+ template <bool C> struct bool_;
+
template <>
struct bool_<true> : mpl::bool_<true>
- { typedef bool_<true>* is_true; };
+ {
+ typedef bool_<true>* is_true;
+ };
+
template <>
struct bool_<false> : mpl::bool_<false>
- { typedef bool_<false>* is_false; };
+ {
+ typedef bool_<false>* is_false;
+ };
// Metafunction to detect if at least one arg is a Phoenix actor
template <
@@ -184,10 +189,10 @@
>
struct contains_actor
: bool_<
- phoenix::is_actor<A0>::value
- || phoenix::is_actor<A1>::value
- || phoenix::is_actor<A2>::value
- >
+ phoenix::is_actor<A0>::value
+ || phoenix::is_actor<A1>::value
+ || phoenix::is_actor<A2>::value
+ >
{};
// to_lazy_arg: convert a terminal arg type to the type make_lazy needs
@@ -200,6 +205,11 @@
struct to_lazy_arg<const A>
: to_lazy_arg<A>
{};
+
+ template <typename A>
+ struct to_lazy_arg<A &>
+ : to_lazy_arg<A>
+ {};
template <>
struct to_lazy_arg<unused_type>
@@ -221,6 +231,11 @@
: to_nonlazy_arg<A>
{};
+ template <typename A>
+ struct to_nonlazy_arg<A &>
+ : to_nonlazy_arg<A>
+ {};
+
template <>
struct to_nonlazy_arg<unused_type>
{
@@ -247,7 +262,8 @@
terminal() {}
terminal(Terminal const& t)
- : base_type(proto::terminal<Terminal>::type::make(t)) {}
+ : base_type(proto::terminal<Terminal>::type::make(t))
+ {}
template <
bool Lazy
@@ -307,6 +323,40 @@
type;
};
+ template <typename This, typename A0>
+ struct result<This(A0)>
+ {
+ typedef typename
+ result_helper<
+ detail::contains_actor<A0, unused_type, unused_type>::value
+ , A0, unused_type, unused_type
+ >::type
+ type;
+ };
+
+ template <typename This, typename A0, typename A1>
+ struct result<This(A0, A1)>
+ {
+ typedef typename
+ result_helper<
+ detail::contains_actor<A0, A1, unused_type>::value
+ , A0, A1, unused_type
+ >::type
+ type;
+ };
+
+
+ template <typename This, typename A0, typename A1, typename A2>
+ struct result<This(A0, A1, A2)>
+ {
+ typedef typename
+ result_helper<
+ detail::contains_actor<A0, A1, A2>::value
+ , A0, A1, A2
+ >::type
+ type;
+ };
+
// Note: in the following overloads, SFINAE cannot
// be done on return type because of gcc bug #24915:
// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24915
@@ -360,7 +410,6 @@
// Lazy overloads. Enabled when at
// least one arg is a Phoenix actor.
-
template <typename A0>
typename result<A0>::type
operator()(A0 const& _0
@@ -441,10 +490,13 @@
// support for stateful tag types
namespace tag
{
- template <typename Data, typename Tag
+ template <
+ typename Data, typename Tag
, typename DataTag1 = unused_type, typename DataTag2 = unused_type>
struct stateful_tag
{
+ BOOST_SPIRIT_IS_TAG()
+
typedef Data data_type;
stateful_tag() {}
@@ -458,7 +510,8 @@
};
}
- template <typename Data, typename Tag
+ template <
+ typename Data, typename Tag
, typename DataTag1 = unused_type, typename DataTag2 = unused_type>
struct stateful_tag_type
: spirit::terminal<tag::stateful_tag<Data, Tag, DataTag1, DataTag2> >
@@ -467,7 +520,8 @@
stateful_tag_type() {}
stateful_tag_type(Data const& data)
- : spirit::terminal<tag_type>(data) {}
+ : spirit::terminal<tag_type>(data)
+ {}
private:
// silence MSVC warning C4512: assignment operator could not be generated
@@ -493,6 +547,28 @@
}}
+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
+namespace boost { namespace phoenix
+{
+ template <typename Tag>
+ struct is_custom_terminal<Tag, typename Tag::is_spirit_tag>
+ : mpl::true_
+ {};
+
+ template <typename Tag>
+ struct custom_terminal<Tag, typename Tag::is_spirit_tag>
+ {
+ typedef spirit::terminal<Tag> result_type;
+
+ template <typename Context>
+ result_type operator()(Tag const & t, Context const &)
+ {
+ return spirit::terminal<Tag>(t);
+ }
+ };
+}}
+#endif
+
// Define a spirit terminal. This macro may be placed in any namespace.
// Common placeholders are placed in the main boost::spirit namespace
// (see common_terminals.hpp)
@@ -505,7 +581,7 @@
#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
#define BOOST_SPIRIT_TERMINAL_NAME(name, type_name) \
- namespace tag { struct name {}; } \
+ namespace tag { struct name { BOOST_SPIRIT_IS_TAG() }; } \
typedef boost::proto::terminal<tag::name>::type type_name; \
type_name const name = {{}}; \
inline void BOOST_PP_CAT(silence_unused_warnings_, name)() { (void) name; } \
@@ -514,7 +590,7 @@
#else
#define BOOST_SPIRIT_TERMINAL_NAME(name, type_name) \
- namespace tag { struct name {}; } \
+ namespace tag { struct name { BOOST_SPIRIT_IS_TAG() }; } \
typedef boost::proto::terminal<tag::name>::type type_name; \
/***/
@@ -543,7 +619,7 @@
#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
#define BOOST_SPIRIT_TERMINAL_NAME_EX(name, type_name) \
- namespace tag { struct name {}; } \
+ namespace tag { struct name { BOOST_SPIRIT_IS_TAG() }; } \
typedef boost::spirit::terminal<tag::name> type_name; \
type_name const name = type_name(); \
inline void BOOST_PP_CAT(silence_unused_warnings_, name)() { (void) name; } \
@@ -552,7 +628,7 @@
#else
#define BOOST_SPIRIT_TERMINAL_NAME_EX(name, type_name) \
- namespace tag { struct name {}; } \
+ namespace tag { struct name { BOOST_SPIRIT_IS_TAG() }; } \
typedef boost::spirit::terminal<tag::name> type_name; \
/***/
Copied: branches/release/boost/spirit/home/support/terminal_expression.hpp (from r70657, /trunk/boost/spirit/home/support/terminal_expression.hpp)
==============================================================================
--- /trunk/boost/spirit/home/support/terminal_expression.hpp (original)
+++ branches/release/boost/spirit/home/support/terminal_expression.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -11,17 +11,17 @@
#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
-namespace boost { namespace phoenix
+namespace boost { namespace phoenix { namespace detail
{
namespace expression
{
template <
typename F, typename A0 = void, typename A1 = void
, typename A2 = void, typename Dummy = void>
- struct function;
+ struct function_eval;
template <typename F, typename A0>
- struct function<F, A0>
+ struct function_eval<F, A0>
{
typedef phoenix::actor<
typename phoenix::as_composite<
@@ -37,7 +37,7 @@
};
template <typename F, typename A0, typename A1>
- struct function<F, A0, A1>
+ struct function_eval<F, A0, A1>
{
typedef phoenix::actor<
typename phoenix::as_composite<
@@ -53,7 +53,7 @@
};
template <typename F, typename A0, typename A1, typename A2>
- struct function<F, A0, A1, A2>
+ struct function_eval<F, A0, A1, A2>
{
typedef phoenix::actor<
typename phoenix::as_composite<
@@ -68,7 +68,7 @@
}
};
}
-}}
+}}}
#endif // !BOOST_SPIRIT_USE_PHOENIX_V3
Modified: branches/release/boost/spirit/home/support/utree/detail/utree_detail2.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/utree/detail/utree_detail2.hpp (original)
+++ branches/release/boost/spirit/home/support/utree/detail/utree_detail2.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -1497,6 +1497,7 @@
switch (get_type())
{
case type::string_type:
+ case type::string_range_type:
case type::binary_type:
case type::symbol_type:
boost::throw_exception(bad_type_exception());
@@ -1511,6 +1512,7 @@
switch (get_type())
{
case type::string_type:
+ case type::string_range_type:
case type::binary_type:
case type::symbol_type:
boost::throw_exception(bad_type_exception());
Modified: branches/release/boost/spirit/include/phoenix.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix.hpp (original)
+++ branches/release/boost/spirit/include/phoenix.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -8,5 +8,11 @@
=============================================================================*/
#ifndef BOOST_SPIRIT_INCLUDE_PHOENIX
#define BOOST_SPIRIT_INCLUDE_PHOENIX
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
#include <boost/spirit/home/phoenix.hpp>
+#else
+#include <boost/phoenix.hpp>
+#endif
+
#endif
Modified: branches/release/boost/spirit/include/phoenix_algorithm.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_algorithm.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_algorithm.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -8,5 +8,11 @@
=============================================================================*/
#ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_ALGORITHM
#define BOOST_SPIRIT_INCLUDE_PHOENIX_ALGORITHM
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
#include <boost/spirit/home/phoenix/algorithm.hpp>
+#else
+#include <boost/phoenix/algorithm.hpp>
+#endif
+
#endif
Modified: branches/release/boost/spirit/include/phoenix_bind.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_bind.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_bind.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -8,5 +8,11 @@
=============================================================================*/
#ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_BIND
#define BOOST_SPIRIT_INCLUDE_PHOENIX_BIND
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
#include <boost/spirit/home/phoenix/bind.hpp>
+#else
+#include <boost/phoenix/bind.hpp>
+#endif
+
#endif
Modified: branches/release/boost/spirit/include/phoenix_container.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_container.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_container.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -8,5 +8,11 @@
=============================================================================*/
#ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_CONTAINER
#define BOOST_SPIRIT_INCLUDE_PHOENIX_CONTAINER
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
#include <boost/spirit/home/phoenix/container.hpp>
+#else
+#include <boost/phoenix/stl/container.hpp>
+#endif
+
#endif
Modified: branches/release/boost/spirit/include/phoenix_core.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_core.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_core.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -8,5 +8,12 @@
=============================================================================*/
#ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_CORE
#define BOOST_SPIRIT_INCLUDE_PHOENIX_CORE
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
+#define BOOST_PHOENIX_DEFINE_CUSTOM_TERMINAL(A,B,C,D)
#include <boost/spirit/home/phoenix/core.hpp>
+#else
+#include <boost/phoenix/core.hpp>
+#endif
+
#endif
Modified: branches/release/boost/spirit/include/phoenix_function.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_function.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_function.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -8,5 +8,11 @@
=============================================================================*/
#ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_FUNCTION
#define BOOST_SPIRIT_INCLUDE_PHOENIX_FUNCTION
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
#include <boost/spirit/home/phoenix/function.hpp>
+#else
+#include <boost/phoenix/function.hpp>
+#endif
+
#endif
Modified: branches/release/boost/spirit/include/phoenix_fusion.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_fusion.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_fusion.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -8,5 +8,11 @@
=============================================================================*/
#ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_FUSION
#define BOOST_SPIRIT_INCLUDE_PHOENIX_FUSION
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
#include <boost/spirit/home/phoenix/fusion.hpp>
+#else
+#include <boost/phoenix/fusion.hpp>
+#endif
+
#endif
Modified: branches/release/boost/spirit/include/phoenix_object.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_object.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_object.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -8,5 +8,11 @@
=============================================================================*/
#ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_OBJECT
#define BOOST_SPIRIT_INCLUDE_PHOENIX_OBJECT
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
#include <boost/spirit/home/phoenix/object.hpp>
+#else
+#include <boost/phoenix/object.hpp>
+#endif
+
#endif
Modified: branches/release/boost/spirit/include/phoenix_operator.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_operator.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_operator.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -8,5 +8,11 @@
=============================================================================*/
#ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_OPERATOR
#define BOOST_SPIRIT_INCLUDE_PHOENIX_OPERATOR
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
#include <boost/spirit/home/phoenix/operator.hpp>
+#else
+#include <boost/phoenix/operator.hpp>
+#endif
+
#endif
Modified: branches/release/boost/spirit/include/phoenix_scope.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_scope.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_scope.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -8,5 +8,11 @@
=============================================================================*/
#ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_SCOPE
#define BOOST_SPIRIT_INCLUDE_PHOENIX_SCOPE
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
#include <boost/spirit/home/phoenix/scope.hpp>
+#else
+#include <boost/phoenix/scope.hpp>
+#endif
+
#endif
Modified: branches/release/boost/spirit/include/phoenix_statement.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_statement.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_statement.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -8,5 +8,11 @@
=============================================================================*/
#ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_STATEMENT
#define BOOST_SPIRIT_INCLUDE_PHOENIX_STATEMENT
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
#include <boost/spirit/home/phoenix/statement.hpp>
+#else
+#include <boost/phoenix/statement.hpp>
+#endif
+
#endif
Modified: branches/release/boost/spirit/include/phoenix_stl.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_stl.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_stl.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -8,5 +8,11 @@
=============================================================================*/
#ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_STL
#define BOOST_SPIRIT_INCLUDE_PHOENIX_STL
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
#include <boost/spirit/home/phoenix/stl.hpp>
+#else
+#include <boost/phoenix/stl.hpp>
+#endif
+
#endif
Modified: branches/release/boost/spirit/repository/home/support/confix.hpp
==============================================================================
--- branches/release/boost/spirit/repository/home/support/confix.hpp (original)
+++ branches/release/boost/spirit/repository/home/support/confix.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -15,7 +15,7 @@
namespace boost { namespace spirit { namespace repository
{
// The confix extended terminal
- BOOST_SPIRIT_DEFINE_TERMINALS_EX(( confix ))
+ BOOST_SPIRIT_DEFINE_TERMINALS_NAME_EX(( confix, confix_type ))
}}}
Modified: branches/release/boost/spirit/repository/home/support/distinct.hpp
==============================================================================
--- branches/release/boost/spirit/repository/home/support/distinct.hpp (original)
+++ branches/release/boost/spirit/repository/home/support/distinct.hpp 2011-04-14 10:12:45 EDT (Thu, 14 Apr 2011)
@@ -15,7 +15,7 @@
namespace boost { namespace spirit { namespace repository
{
// The distinct extended terminal
- BOOST_SPIRIT_DEFINE_TERMINALS_EX(( distinct ))
+ BOOST_SPIRIT_DEFINE_TERMINALS_NAME_EX(( distinct, distinct_type ))
}}}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk