diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-06 10:33:54 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-06 10:36:09 +0900 |
commit | d9ec475d945d3035377a0d89ed42e382d8988891 (patch) | |
tree | 34aff2cee4b209906243ab5499d61f3edee2982f /boost/spirit | |
parent | 71d216b90256936a9638f325af9bc69d720e75de (diff) | |
download | boost-d9ec475d945d3035377a0d89ed42e382d8988891.tar.gz boost-d9ec475d945d3035377a0d89ed42e382d8988891.tar.bz2 boost-d9ec475d945d3035377a0d89ed42e382d8988891.zip |
Imported Upstream version 1.60.0
Change-Id: Ie709530d6d5841088ceaba025cbe175a4ef43050
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/spirit')
-rw-r--r-- | boost/spirit/home/classic/tree/parse_tree.hpp | 1 | ||||
-rw-r--r-- | boost/spirit/home/karma/directive/duplicate.hpp | 2 | ||||
-rw-r--r-- | boost/spirit/home/karma/directive/left_alignment.hpp | 4 | ||||
-rw-r--r-- | boost/spirit/home/karma/string/lit.hpp | 3 | ||||
-rw-r--r-- | boost/spirit/home/qi/detail/assign_to.hpp | 11 | ||||
-rw-r--r-- | boost/spirit/home/qi/detail/attributes.hpp | 2 | ||||
-rw-r--r-- | boost/spirit/home/qi/numeric/detail/numeric_utils.hpp | 31 | ||||
-rw-r--r-- | boost/spirit/home/qi/numeric/detail/real_impl.hpp | 8 | ||||
-rw-r--r-- | boost/spirit/home/support/attributes.hpp | 5 | ||||
-rw-r--r-- | boost/spirit/home/support/char_encoding/ascii.hpp | 29 | ||||
-rw-r--r-- | boost/spirit/home/support/detail/endian/endian.hpp | 21 | ||||
-rw-r--r-- | boost/spirit/home/support/terminal.hpp | 44 | ||||
-rw-r--r-- | boost/spirit/home/x3/char/char_set.hpp | 4 |
13 files changed, 107 insertions, 58 deletions
diff --git a/boost/spirit/home/classic/tree/parse_tree.hpp b/boost/spirit/home/classic/tree/parse_tree.hpp index dcca9b3fb4..754d74a4aa 100644 --- a/boost/spirit/home/classic/tree/parse_tree.hpp +++ b/boost/spirit/home/classic/tree/parse_tree.hpp @@ -76,7 +76,6 @@ struct pt_tree_policy : template<typename MatchAT, typename MatchBT> static void concat(MatchAT& a, MatchBT const& b) { - typedef typename match_t::attr_t attr_t; BOOST_SPIRIT_ASSERT(a && b); std::copy(b.trees.begin(), b.trees.end(), diff --git a/boost/spirit/home/karma/directive/duplicate.hpp b/boost/spirit/home/karma/directive/duplicate.hpp index 8d9f3725a3..3a71592e4d 100644 --- a/boost/spirit/home/karma/directive/duplicate.hpp +++ b/boost/spirit/home/karma/directive/duplicate.hpp @@ -68,7 +68,7 @@ namespace boost { namespace spirit { namespace karma template <typename T , bool IsSequence = fusion::traits::is_sequence<T>::value> struct first_attribute_of_subject - : fusion::result_of::at_c<T, 0> + : remove_reference<typename fusion::result_of::at_c<T, 0>::type> {}; template <typename T> diff --git a/boost/spirit/home/karma/directive/left_alignment.hpp b/boost/spirit/home/karma/directive/left_alignment.hpp index 40b5d24d9a..949255f1ce 100644 --- a/boost/spirit/home/karma/directive/left_alignment.hpp +++ b/boost/spirit/home/karma/directive/left_alignment.hpp @@ -275,10 +275,10 @@ namespace boost { namespace spirit { namespace karma template <typename Terminal> result_type operator()(Terminal const& term, Subject const& subject - , unused_type) const + , Modifiers const& modifiers) const { return result_type(subject - , compile<karma::domain>(fusion::at_c<1>(term.args)) + , compile<karma::domain>(fusion::at_c<1>(term.args), modifiers) , fusion::at_c<0>(term.args)); } }; diff --git a/boost/spirit/home/karma/string/lit.hpp b/boost/spirit/home/karma/string/lit.hpp index 0b9a6414ce..bd84bb848e 100644 --- a/boost/spirit/home/karma/string/lit.hpp +++ b/boost/spirit/home/karma/string/lit.hpp @@ -175,9 +175,6 @@ namespace boost { namespace spirit { namespace karma // fail if attribute isn't matched by immediate literal typedef typename attribute<Context>::type attribute_type; - typedef typename spirit::result_of::extract_from<attribute_type, Attribute>::type - extracted_string_type; - using spirit::traits::get_c_string; if (!detail::string_compare( get_c_string( diff --git a/boost/spirit/home/qi/detail/assign_to.hpp b/boost/spirit/home/qi/detail/assign_to.hpp index 38142bf1b3..7e5b162d06 100644 --- a/boost/spirit/home/qi/detail/assign_to.hpp +++ b/boost/spirit/home/qi/detail/assign_to.hpp @@ -18,6 +18,7 @@ #include <boost/spirit/home/qi/detail/attributes.hpp> #include <boost/spirit/home/support/container.hpp> #include <boost/fusion/include/copy.hpp> +#include <boost/fusion/adapted/struct/detail/extension.hpp> #include <boost/ref.hpp> #include <boost/range/iterator_range.hpp> @@ -203,6 +204,16 @@ namespace boost { namespace spirit { namespace traits } }; + template <typename Attribute, int N, bool Const, typename T> + struct assign_to_attribute_from_value<fusion::extension::adt_attribute_proxy<Attribute, N, Const>, T> + { + static void + call(T const& val, typename fusion::extension::adt_attribute_proxy<Attribute, N, Const>& attr) + { + attr = val; + } + }; + namespace detail { template <typename A, typename B> diff --git a/boost/spirit/home/qi/detail/attributes.hpp b/boost/spirit/home/qi/detail/attributes.hpp index 0a66a65586..6e8ce13f83 100644 --- a/boost/spirit/home/qi/detail/attributes.hpp +++ b/boost/spirit/home/qi/detail/attributes.hpp @@ -90,7 +90,7 @@ namespace boost { namespace spirit { namespace qi static void post(boost::optional<Exposed>&, Transformed const&) {} static void fail(boost::optional<Exposed>& val) { - val = none_t(); // leave optional uninitialized if rhs failed + val = none; // leave optional uninitialized if rhs failed } }; diff --git a/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp b/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp index 7e96a3757f..ce9ad0f953 100644 --- a/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp +++ b/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp @@ -31,6 +31,7 @@ #include <boost/mpl/bool.hpp> #include <boost/mpl/and.hpp> #include <boost/limits.hpp> +#include <boost/integer_traits.hpp> #if defined(BOOST_MSVC) # pragma warning(push) @@ -115,6 +116,12 @@ namespace boost { namespace spirit { namespace qi { namespace detail return spirit::char_encoding::ascii::tolower(ch) - 'a' + 10; } }; + + template <typename T, T Val> + struct constexpr_int + { + BOOST_STATIC_CONSTEXPR T value = Val; + }; /////////////////////////////////////////////////////////////////////////// // positive_accumulator/negative_accumulator: Accumulator policies for @@ -135,17 +142,17 @@ namespace boost { namespace spirit { namespace qi { namespace detail inline static bool add(T& n, Char ch, mpl::true_) // checked add { // Ensure n *= Radix will not overflow - static T const max = (std::numeric_limits<T>::max)(); - static T const val = max / Radix; + typedef constexpr_int<T, boost::integer_traits<T>::const_max> max; + typedef constexpr_int<T, max::value / Radix> val; - if (n > val) + if (n > val::value) return false; n *= Radix; // Ensure n += digit will not overflow const int digit = radix_traits<Radix>::digit(ch); - if (n > max - digit) + if (n > max::value - digit) return false; n += static_cast<T>(digit); @@ -167,16 +174,17 @@ namespace boost { namespace spirit { namespace qi { namespace detail inline static bool add(T& n, Char ch, mpl::true_) // checked subtract { // Ensure n *= Radix will not underflow - static T const min = (std::numeric_limits<T>::min)(); - static T const val = (min + 1) / T(Radix); - if (n < val) + typedef constexpr_int<T, boost::integer_traits<T>::const_min> min; + typedef constexpr_int<T, (min::value + 1) / T(Radix)> val; + + if (n < val::value) return false; n *= Radix; // Ensure n -= digit will not underflow int const digit = radix_traits<Radix>::digit(ch); - if (n < min + digit) + if (n < min::value + digit) return false; n -= static_cast<T>(digit); @@ -194,10 +202,9 @@ namespace boost { namespace spirit { namespace qi { namespace detail inline static bool call(Char ch, std::size_t count, T& n, mpl::true_) { - static std::size_t const - overflow_free = digits_traits<T, Radix>::value - 1; + typedef constexpr_int<std::size_t, digits_traits<T, Radix>::value - 1> overflow_free; - if (!AlwaysCheckOverflow && (count < overflow_free)) + if (!AlwaysCheckOverflow && (count < overflow_free::value)) { Accumulator::add(n, ch, mpl::false_()); } @@ -316,7 +323,7 @@ namespace boost { namespace spirit { namespace qi { namespace detail if (!Accumulate) { // skip leading zeros - while (it != last && *it == '0' && leading_zeros < MaxDigits) + while (it != last && *it == '0' && (MaxDigits < 0 || leading_zeros < static_cast< std::size_t >(MaxDigits))) { ++it; ++leading_zeros; diff --git a/boost/spirit/home/qi/numeric/detail/real_impl.hpp b/boost/spirit/home/qi/numeric/detail/real_impl.hpp index cf92712a24..485df2727f 100644 --- a/boost/spirit/home/qi/numeric/detail/real_impl.hpp +++ b/boost/spirit/home/qi/numeric/detail/real_impl.hpp @@ -65,7 +65,7 @@ namespace boost { namespace spirit { namespace traits { if (exp >= 0) { - std::size_t max_exp = std::numeric_limits<T>::max_exponent10; + int max_exp = std::numeric_limits<T>::max_exponent10; // return false if exp exceeds the max_exp // do this check only for primitive types! @@ -284,7 +284,7 @@ namespace boost { namespace spirit { namespace qi { namespace detail // If there is no number, disregard the exponent altogether. // by resetting 'first' prior to the exponent prefix (e|E) first = e_pos; - n = acc_n; + n = static_cast<T>(acc_n); } } else if (frac_digits) @@ -306,11 +306,11 @@ namespace boost { namespace spirit { namespace qi { namespace detail return true; // got a NaN or Inf, return immediately } - n = acc_n; + n = static_cast<T>(acc_n); } else { - n = acc_n; + n = static_cast<T>(acc_n); } // If we got a negative sign, negate the number diff --git a/boost/spirit/home/support/attributes.hpp b/boost/spirit/home/support/attributes.hpp index 163f11cfe2..889e3a370b 100644 --- a/boost/spirit/home/support/attributes.hpp +++ b/boost/spirit/home/support/attributes.hpp @@ -1060,12 +1060,13 @@ namespace boost { namespace spirit { namespace traits typedef T type; }; +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) template <typename T> struct strip_single_element_vector<fusion::vector1<T> > { typedef T type; }; - +#endif template <typename T> struct strip_single_element_vector<fusion::vector<T> > { @@ -1153,7 +1154,7 @@ namespace boost { namespace spirit { namespace traits static void call(boost::optional<T>& val) { if (val) - val = none_t(); // leave optional uninitialized + val = none; // leave optional uninitialized } }; diff --git a/boost/spirit/home/support/char_encoding/ascii.hpp b/boost/spirit/home/support/char_encoding/ascii.hpp index 8bd6c11350..4e6aace036 100644 --- a/boost/spirit/home/support/char_encoding/ascii.hpp +++ b/boost/spirit/home/support/char_encoding/ascii.hpp @@ -167,6 +167,14 @@ namespace boost { namespace spirit { namespace char_encoding /* } 125 7d */ BOOST_CC_PUNCT, /* ~ 126 7e */ BOOST_CC_PUNCT, /* DEL 127 7f */ BOOST_CC_CTRL, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; /////////////////////////////////////////////////////////////////////////// @@ -191,7 +199,7 @@ namespace boost { namespace spirit { namespace char_encoding static bool isalnum(int ch) { - BOOST_ASSERT(isascii_(ch)); + BOOST_ASSERT(0 == (ch & ~UCHAR_MAX)); return (ascii_char_types[ch] & BOOST_CC_ALPHA) || (ascii_char_types[ch] & BOOST_CC_DIGIT); } @@ -199,28 +207,28 @@ namespace boost { namespace spirit { namespace char_encoding static bool isalpha(int ch) { - BOOST_ASSERT(isascii_(ch)); + BOOST_ASSERT(0 == (ch & ~UCHAR_MAX)); return (ascii_char_types[ch] & BOOST_CC_ALPHA) ? true : false; } static bool isdigit(int ch) { - BOOST_ASSERT(isascii_(ch)); + BOOST_ASSERT(0 == (ch & ~UCHAR_MAX)); return (ascii_char_types[ch] & BOOST_CC_DIGIT) ? true : false; } static bool isxdigit(int ch) { - BOOST_ASSERT(isascii_(ch)); + BOOST_ASSERT(0 == (ch & ~UCHAR_MAX)); return (ascii_char_types[ch] & BOOST_CC_XDIGIT) ? true : false; } static bool iscntrl(int ch) { - BOOST_ASSERT(isascii_(ch)); + BOOST_ASSERT(0 == (ch & ~UCHAR_MAX)); return (ascii_char_types[ch] & BOOST_CC_CTRL) ? true : false; } @@ -233,7 +241,7 @@ namespace boost { namespace spirit { namespace char_encoding static bool islower(int ch) { - BOOST_ASSERT(isascii_(ch)); + BOOST_ASSERT(0 == (ch & ~UCHAR_MAX)); return (ascii_char_types[ch] & BOOST_CC_LOWER) ? true : false; } @@ -246,14 +254,14 @@ namespace boost { namespace spirit { namespace char_encoding static bool ispunct(int ch) { - BOOST_ASSERT(isascii_(ch)); + BOOST_ASSERT(0 == (ch & ~UCHAR_MAX)); return (ascii_char_types[ch] & BOOST_CC_PUNCT) ? true : false; } static bool isspace(int ch) { - BOOST_ASSERT(isascii_(ch)); + BOOST_ASSERT(0 == (ch & ~UCHAR_MAX)); return (ascii_char_types[ch] & BOOST_CC_SPACE) ? true : false; } @@ -266,7 +274,7 @@ namespace boost { namespace spirit { namespace char_encoding static bool isupper(int ch) { - BOOST_ASSERT(isascii_(ch)); + BOOST_ASSERT(0 == (ch & ~UCHAR_MAX)); return (ascii_char_types[ch] & BOOST_CC_UPPER) ? true : false; } @@ -277,14 +285,12 @@ namespace boost { namespace spirit { namespace char_encoding static int tolower(int ch) { - BOOST_ASSERT(isascii_(ch)); return isupper(ch) ? (ch - 'A' + 'a') : ch; } static int toupper(int ch) { - BOOST_ASSERT(isascii_(ch)); return islower(ch) ? (ch - 'a' + 'A') : ch; } @@ -310,4 +316,3 @@ namespace boost { namespace spirit { namespace char_encoding #undef BOOST_CC_SPACE #endif - diff --git a/boost/spirit/home/support/detail/endian/endian.hpp b/boost/spirit/home/support/detail/endian/endian.hpp index c806b58473..ac1c13f86a 100644 --- a/boost/spirit/home/support/detail/endian/endian.hpp +++ b/boost/spirit/home/support/detail/endian/endian.hpp @@ -41,6 +41,7 @@ #undef BOOST_NO_IO_COVER_OPERATORS #undef BOOST_MINIMAL_INTEGER_COVER_OPERATORS #include <boost/type_traits/is_signed.hpp> +#include <boost/type_traits/make_unsigned.hpp> #include <boost/cstdint.hpp> #include <boost/static_assert.hpp> #include <boost/spirit/home/support/detail/scoped_enum_emulation.hpp> @@ -70,9 +71,9 @@ namespace boost { namespace spirit { typedef unrolled_byte_loops<T, n_bytes - 1, sign> next; - static T load_big(const unsigned char* bytes) + static typename boost::make_unsigned<T>::type load_big(const unsigned char* bytes) { return *(bytes - 1) | (next::load_big(bytes - 1) << 8); } - static T load_little(const unsigned char* bytes) + static typename boost::make_unsigned<T>::type load_little(const unsigned char* bytes) { return *bytes | (next::load_little(bytes + 1) << 8); } static void store_big(char* bytes, T value) @@ -104,10 +105,10 @@ namespace boost { namespace spirit template <typename T> struct unrolled_byte_loops<T, 1, true> { - static T load_big(const unsigned char* bytes) - { return *reinterpret_cast<const signed char*>(bytes - 1); } - static T load_little(const unsigned char* bytes) - { return *reinterpret_cast<const signed char*>(bytes); } + static typename boost::make_unsigned<T>::type load_big(const unsigned char* bytes) + { return *(bytes - 1); } + static typename boost::make_unsigned<T>::type load_little(const unsigned char* bytes) + { return *bytes; } static void store_big(char* bytes, T value) { *(bytes - 1) = static_cast<char>(value); } static void store_little(char* bytes, T value) @@ -118,8 +119,8 @@ namespace boost { namespace spirit inline T load_big_endian(const void* bytes) { - return unrolled_byte_loops<T, n_bytes>::load_big - (static_cast<const unsigned char*>(bytes) + n_bytes); + return static_cast<T>(unrolled_byte_loops<T, n_bytes>::load_big + (static_cast<const unsigned char*>(bytes) + n_bytes)); } template <> @@ -164,8 +165,8 @@ namespace boost { namespace spirit inline T load_little_endian(const void* bytes) { - return unrolled_byte_loops<T, n_bytes>::load_little - (static_cast<const unsigned char*>(bytes)); + return static_cast<T>(unrolled_byte_loops<T, n_bytes>::load_little + (static_cast<const unsigned char*>(bytes))); } template <> diff --git a/boost/spirit/home/support/terminal.hpp b/boost/spirit/home/support/terminal.hpp index 3ef8c83ae2..0497d5faf4 100644 --- a/boost/spirit/home/support/terminal.hpp +++ b/boost/spirit/home/support/terminal.hpp @@ -16,7 +16,6 @@ #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> @@ -236,12 +235,9 @@ namespace boost { namespace spirit : to_nonlazy_arg<A> {}; + // incomplete type: should not be appeared unused_type in nonlazy arg. template <> - struct to_nonlazy_arg<unused_type> - { - // unused arg: make_vector wants fusion::void_ - typedef fusion::void_ type; - }; + struct to_nonlazy_arg<unused_type>; } template <typename Terminal> @@ -268,13 +264,45 @@ namespace boost { namespace spirit template < bool Lazy , typename A0 - , typename A1 - , typename A2 + , typename A1 = unused_type + , typename A2 = unused_type > struct result_helper; template < typename A0 + > + struct result_helper<false, A0> + { + typedef typename + proto::terminal< + terminal_ex< + Terminal + , typename detail::result_of::make_vector< + typename detail::to_nonlazy_arg<A0>::type>::type> + >::type + type; + }; + + template < + typename A0 + , typename A1 + > + struct result_helper<false, A0, A1> + { + typedef typename + proto::terminal< + terminal_ex< + Terminal + , typename detail::result_of::make_vector< + typename detail::to_nonlazy_arg<A0>::type + , typename detail::to_nonlazy_arg<A1>::type>::type> + >::type + type; + }; + + template < + typename A0 , typename A1 , typename A2 > diff --git a/boost/spirit/home/x3/char/char_set.hpp b/boost/spirit/home/x3/char/char_set.hpp index 5a37ff6bea..3a8f986456 100644 --- a/boost/spirit/home/x3/char/char_set.hpp +++ b/boost/spirit/home/x3/char/char_set.hpp @@ -42,8 +42,8 @@ namespace boost { namespace spirit { namespace x3 char_type ch = char_type(ch_); // optimize for token based parsing return ((sizeof(Char) <= sizeof(char_type)) || encoding::ischar(ch_)) - && (get_case_compare<encoding>(context)(ch, from) > 0 ) - && (get_case_compare<encoding>(context)(ch , to) < 0 ); + && (get_case_compare<encoding>(context)(ch, from) >= 0 ) + && (get_case_compare<encoding>(context)(ch , to) <= 0 ); } char_type from, to; |