summaryrefslogtreecommitdiff
path: root/boost/spirit/home/qi
diff options
context:
space:
mode:
Diffstat (limited to 'boost/spirit/home/qi')
-rw-r--r--boost/spirit/home/qi/detail/alternative_function.hpp3
-rw-r--r--boost/spirit/home/qi/detail/permute_function.hpp16
-rw-r--r--boost/spirit/home/qi/numeric/detail/numeric_utils.hpp37
-rw-r--r--boost/spirit/home/qi/numeric/detail/real_impl.hpp14
-rw-r--r--boost/spirit/home/qi/numeric/numeric_utils.hpp3
-rw-r--r--boost/spirit/home/qi/operator/permutation.hpp6
-rw-r--r--boost/spirit/home/qi/operator/sequential_or.hpp9
-rw-r--r--boost/spirit/home/qi/parse.hpp46
-rw-r--r--boost/spirit/home/qi/stream/stream.hpp5
-rw-r--r--boost/spirit/home/qi/string/detail/tst.hpp2
-rw-r--r--boost/spirit/home/qi/string/tst_map.hpp1
11 files changed, 50 insertions, 92 deletions
diff --git a/boost/spirit/home/qi/detail/alternative_function.hpp b/boost/spirit/home/qi/detail/alternative_function.hpp
index 88f6dad9a0..9bd0f73c7b 100644
--- a/boost/spirit/home/qi/detail/alternative_function.hpp
+++ b/boost/spirit/home/qi/detail/alternative_function.hpp
@@ -138,9 +138,8 @@ namespace boost { namespace spirit { namespace qi { namespace detail
template <typename Component>
bool call(Component const& component, mpl::false_) const
{
- // fix for alternative.cpp test case, FHE 2016-07-28
return call_optional_or_variant(
- component, mpl::not_<spirit::traits::not_is_optional<Attribute, qi::domain> >());
+ component, spirit::traits::not_is_variant<Attribute, qi::domain>());
}
template <typename Component>
diff --git a/boost/spirit/home/qi/detail/permute_function.hpp b/boost/spirit/home/qi/detail/permute_function.hpp
index 8b1ed8a596..4366568eb8 100644
--- a/boost/spirit/home/qi/detail/permute_function.hpp
+++ b/boost/spirit/home/qi/detail/permute_function.hpp
@@ -43,22 +43,6 @@ namespace boost { namespace spirit { namespace qi { namespace detail
return false;
}
- template <typename Component, typename Attribute>
- bool operator()(Component const& component, boost::optional<Attribute>& attr)
- {
- // return true if the parser succeeds and the slot is not yet taken
- Attribute val;
- if (!*taken && component.parse(first, last, context, skipper, val))
- {
- attr = val;
- *taken = true;
- ++taken;
- return true;
- }
- ++taken;
- return false;
- }
-
template <typename Component>
bool operator()(Component const& component)
{
diff --git a/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp b/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp
index 7f466ee65b..f1154dc92a 100644
--- a/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp
+++ b/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp
@@ -101,11 +101,9 @@ namespace boost { namespace spirit { namespace qi { namespace detail
template <typename Char>
inline static bool is_valid(Char ch)
{
- if (Radix <= 10)
- return (ch >= '0' && ch <= static_cast<Char>('0' + Radix -1));
- return (ch >= '0' && ch <= '9')
- || (ch >= 'a' && ch <= static_cast<Char>('a' + Radix -10 -1))
- || (ch >= 'A' && ch <= static_cast<Char>('A' + Radix -10 -1));
+ return (ch >= '0' && ch <= (Radix > 10 ? '9' : static_cast<Char>('0' + Radix -1)))
+ || (Radix > 10 && ch >= 'a' && ch <= static_cast<Char>('a' + Radix -10 -1))
+ || (Radix > 10 && ch >= 'A' && ch <= static_cast<Char>('A' + Radix -10 -1));
}
template <typename Char>
@@ -506,35 +504,6 @@ namespace boost { namespace spirit { namespace qi { namespace detail
};
#undef SPIRIT_NUMERIC_INNER_LOOP
-
- ///////////////////////////////////////////////////////////////////////////
- // Cast an signed integer to an unsigned integer
- ///////////////////////////////////////////////////////////////////////////
- template <typename T,
- bool force_unsigned
- = mpl::and_<is_integral<T>, is_signed<T> >::value>
- struct cast_unsigned;
-
- template <typename T>
- struct cast_unsigned<T, true>
- {
- typedef typename make_unsigned<T>::type unsigned_type;
- typedef typename make_unsigned<T>::type& unsigned_type_ref;
-
- inline static unsigned_type_ref call(T& n)
- {
- return unsigned_type_ref(n);
- }
- };
-
- template <typename T>
- struct cast_unsigned<T, false>
- {
- inline static T& call(T& n)
- {
- return n;
- }
- };
}}}}
#if defined(BOOST_MSVC)
diff --git a/boost/spirit/home/qi/numeric/detail/real_impl.hpp b/boost/spirit/home/qi/numeric/detail/real_impl.hpp
index 9aa5bb8bbd..c8d20876fa 100644
--- a/boost/spirit/home/qi/numeric/detail/real_impl.hpp
+++ b/boost/spirit/home/qi/numeric/detail/real_impl.hpp
@@ -81,12 +81,13 @@ namespace boost { namespace spirit { namespace traits
detail::compensate_roundoff(n, acc_n);
n /= pow10<T>(-min_exp);
- // return false if (-exp + min_exp) exceeds the -min_exp
+ // return false if exp still exceeds the min_exp
// do this check only for primitive types!
- if (is_floating_point<T>() && (-exp + min_exp) > -min_exp)
+ exp += -min_exp;
+ if (is_floating_point<T>() && exp < min_exp)
return false;
- n /= pow10<T>(-exp + min_exp);
+ n /= pow10<T>(-exp);
}
else
{
@@ -233,6 +234,7 @@ namespace boost { namespace spirit { namespace qi { namespace detail
// to zero (0) only if we already got a number.
if (p.parse_frac_n(first, last, acc_n, frac_digits))
{
+ BOOST_ASSERT(frac_digits >= 0);
}
else if (!got_a_number || !p.allow_trailing_dot)
{
@@ -285,13 +287,15 @@ namespace boost { namespace spirit { namespace qi { namespace detail
// by resetting 'first' prior to the exponent prefix (e|E)
first = e_pos;
// Scale the number by -frac_digits.
- traits::scale(-frac_digits, n, acc_n);
+ bool r = traits::scale(-frac_digits, n, acc_n);
+ BOOST_VERIFY(r);
}
}
else if (frac_digits)
{
// No exponent found. Scale the number by -frac_digits.
- traits::scale(-frac_digits, n, acc_n);
+ bool r = traits::scale(-frac_digits, n, acc_n);
+ BOOST_VERIFY(r);
}
else if (traits::is_equal_to_one(acc_n))
{
diff --git a/boost/spirit/home/qi/numeric/numeric_utils.hpp b/boost/spirit/home/qi/numeric/numeric_utils.hpp
index c37044a3b6..a1fb4730b3 100644
--- a/boost/spirit/home/qi/numeric/numeric_utils.hpp
+++ b/boost/spirit/home/qi/numeric/numeric_utils.hpp
@@ -69,8 +69,7 @@ namespace boost { namespace spirit { namespace qi
extract_type;
Iterator save = first;
- if (!extract_type::parse(first, last,
- detail::cast_unsigned<T>::call(attr_)))
+ if (!extract_type::parse(first, last, attr_))
{
first = save;
return false;
diff --git a/boost/spirit/home/qi/operator/permutation.hpp b/boost/spirit/home/qi/operator/permutation.hpp
index cadfa24e77..0934f74256 100644
--- a/boost/spirit/home/qi/operator/permutation.hpp
+++ b/boost/spirit/home/qi/operator/permutation.hpp
@@ -21,7 +21,6 @@
#include <boost/spirit/home/support/info.hpp>
#include <boost/fusion/include/size.hpp>
#include <boost/optional.hpp>
-#include <boost/foreach.hpp>
#include <boost/array.hpp>
namespace boost { namespace spirit
@@ -76,10 +75,7 @@ namespace boost { namespace spirit { namespace qi
f(first, last, context, skipper);
boost::array<bool, fusion::result_of::size<Elements>::value> flags;
- BOOST_FOREACH(bool& taken, flags)
- {
- taken = false;
- }
+ flags.fill(false);
// wrap the attribute in a tuple if it is not a tuple
typename traits::wrap_if_not_tuple<Attribute>::type attr_local(attr_);
diff --git a/boost/spirit/home/qi/operator/sequential_or.hpp b/boost/spirit/home/qi/operator/sequential_or.hpp
index a4c9c0ceca..96ac64e5d2 100644
--- a/boost/spirit/home/qi/operator/sequential_or.hpp
+++ b/boost/spirit/home/qi/operator/sequential_or.hpp
@@ -15,7 +15,7 @@
#include <boost/spirit/home/qi/detail/pass_function.hpp>
#include <boost/spirit/home/qi/detail/attributes.hpp>
#include <boost/spirit/home/support/detail/what_function.hpp>
-#include <boost/spirit/home/support/algorithm/any_if_ns.hpp>
+#include <boost/spirit/home/support/algorithm/any_if_ns_so.hpp>
#include <boost/spirit/home/support/handles_container.hpp>
#include <boost/fusion/include/as_vector.hpp>
#include <boost/fusion/include/for_each.hpp>
@@ -75,9 +75,10 @@ namespace boost { namespace spirit { namespace qi
typename traits::wrap_if_not_tuple<Attribute>::type attr_local(attr_);
// return true if *any* of the parsers succeed
- // (we use the non-short-circuiting version: any_if_ns
- // to force all elements to be tested)
- return spirit::any_if_ns(elements, attr_local, f, predicate());
+ // (we use the non-short-circuiting and strict order version:
+ // any_if_ns_so to force all the elements to be tested and
+ // in the defined order: first is first, last is last)
+ return spirit::any_if_ns_so(elements, attr_local, f, predicate());
}
template <typename Context>
diff --git a/boost/spirit/home/qi/parse.hpp b/boost/spirit/home/qi/parse.hpp
index 261df759cc..6f9406c51c 100644
--- a/boost/spirit/home/qi/parse.hpp
+++ b/boost/spirit/home/qi/parse.hpp
@@ -15,7 +15,7 @@
#include <boost/spirit/home/support/context.hpp>
#include <boost/spirit/home/support/nonterminal/locals.hpp>
#include <boost/spirit/home/qi/detail/parse.hpp>
-#include <boost/concept_check.hpp>
+#include <boost/iterator/iterator_concepts.hpp>
namespace boost { namespace spirit { namespace qi
{
@@ -27,11 +27,12 @@ namespace boost { namespace spirit { namespace qi
, Iterator last
, Expr const& expr)
{
- // Make sure the iterator is at least a forward_iterator. If you got a
- // compilation error here, then you are using an input_iterator while
- // calling this function, you need to supply at least a
- // forward_iterator instead.
- BOOST_CONCEPT_ASSERT((ForwardIterator<Iterator>));
+ // Make sure the iterator is at least a readable forward traversal iterator.
+ // If you got a compilation error here, then you are using a weaker iterator
+ // while calling this function, you need to supply a readable forward traversal
+ // iterator instead.
+ BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIteratorConcept<Iterator>));
+ BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversalConcept<Iterator>));
return detail::parse_impl<Expr>::call(first, last, expr);
}
@@ -71,11 +72,12 @@ namespace boost { namespace spirit { namespace qi
, Expr const& expr
, Attr& attr)
{
- // Make sure the iterator is at least a forward_iterator. If you got a
- // compilation error here, then you are using an input_iterator while
- // calling this function, you need to supply at least a
- // forward_iterator instead.
- BOOST_CONCEPT_ASSERT((ForwardIterator<Iterator>));
+ // Make sure the iterator is at least a readable forward traversal iterator.
+ // If you got a compilation error here, then you are using a weaker iterator
+ // while calling this function, you need to supply a readable forward traversal
+ // iterator instead.
+ BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIteratorConcept<Iterator>));
+ BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversalConcept<Iterator>));
// Report invalid expression error as early as possible.
// If you got an error_invalid_expression error message here,
@@ -108,11 +110,12 @@ namespace boost { namespace spirit { namespace qi
, Skipper const& skipper
, BOOST_SCOPED_ENUM(skip_flag) post_skip = skip_flag::postskip)
{
- // Make sure the iterator is at least a forward_iterator. If you got a
- // compilation error here, then you are using an input_iterator while
- // calling this function, you need to supply at least a
- // forward_iterator instead.
- BOOST_CONCEPT_ASSERT((ForwardIterator<Iterator>));
+ // Make sure the iterator is at least a readable forward traversal iterator.
+ // If you got a compilation error here, then you are using a weaker iterator
+ // while calling this function, you need to supply a readable forward traversal
+ // iterator instead.
+ BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIteratorConcept<Iterator>));
+ BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversalConcept<Iterator>));
return detail::phrase_parse_impl<Expr>::call(
first, last, expr, skipper, post_skip);
@@ -142,11 +145,12 @@ namespace boost { namespace spirit { namespace qi
, BOOST_SCOPED_ENUM(skip_flag) post_skip
, Attr& attr)
{
- // Make sure the iterator is at least a forward_iterator. If you got a
- // compilation error here, then you are using an input_iterator while
- // calling this function, you need to supply at least a
- // forward_iterator instead.
- BOOST_CONCEPT_ASSERT((ForwardIterator<Iterator>));
+ // Make sure the iterator is at least a readable forward traversal iterator.
+ // If you got a compilation error here, then you are using a weaker iterator
+ // while calling this function, you need to supply a readable forward traversal
+ // iterator instead.
+ BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIteratorConcept<Iterator>));
+ BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversalConcept<Iterator>));
// Report invalid expression error as early as possible.
// If you got an error_invalid_expression error message here,
diff --git a/boost/spirit/home/qi/stream/stream.hpp b/boost/spirit/home/qi/stream/stream.hpp
index 83b417df64..b11f6bcec9 100644
--- a/boost/spirit/home/qi/stream/stream.hpp
+++ b/boost/spirit/home/qi/stream/stream.hpp
@@ -71,7 +71,10 @@ namespace boost { namespace spirit { namespace qi
// advance the iterator if everything is ok
if (in) {
if (!in.eof()) {
- std::streamsize pos = in.tellg();
+ typedef typename
+ boost::iterator_difference<Iterator>::type diff_type;
+
+ diff_type pos = static_cast<diff_type>(in.tellg());
std::advance(first, pos);
} else {
first = last;
diff --git a/boost/spirit/home/qi/string/detail/tst.hpp b/boost/spirit/home/qi/string/detail/tst.hpp
index 168e4cf03e..4f551d289e 100644
--- a/boost/spirit/home/qi/string/detail/tst.hpp
+++ b/boost/spirit/home/qi/string/detail/tst.hpp
@@ -13,8 +13,6 @@
#include <boost/call_traits.hpp>
#include <boost/detail/iterator.hpp>
-#include <boost/foreach.hpp>
-#include <boost/assert.hpp>
namespace boost { namespace spirit { namespace qi { namespace detail
{
diff --git a/boost/spirit/home/qi/string/tst_map.hpp b/boost/spirit/home/qi/string/tst_map.hpp
index 19f977ddce..87a2975de7 100644
--- a/boost/spirit/home/qi/string/tst_map.hpp
+++ b/boost/spirit/home/qi/string/tst_map.hpp
@@ -15,6 +15,7 @@
#include <boost/spirit/home/qi/string/detail/tst.hpp>
#include <boost/unordered_map.hpp>
#include <boost/pool/object_pool.hpp>
+#include <boost/foreach.hpp>
namespace boost { namespace spirit { namespace qi
{