summaryrefslogtreecommitdiff
path: root/boost/spirit/home
diff options
context:
space:
mode:
Diffstat (limited to 'boost/spirit/home')
-rw-r--r--boost/spirit/home/classic/core/composite/actions.hpp3
-rw-r--r--boost/spirit/home/classic/core/composite/epsilon.hpp9
-rw-r--r--boost/spirit/home/classic/core/composite/no_actions.hpp8
-rw-r--r--boost/spirit/home/classic/core/match.hpp14
-rw-r--r--boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp2
-rw-r--r--boost/spirit/home/classic/core/primitives/impl/primitives.ipp6
-rw-r--r--boost/spirit/home/classic/core/primitives/primitives.hpp6
-rw-r--r--boost/spirit/home/classic/core/scanner/impl/skipper.ipp16
-rw-r--r--boost/spirit/home/classic/debug/impl/parser_names.ipp4
-rw-r--r--boost/spirit/home/classic/dynamic/for.hpp4
-rw-r--r--boost/spirit/home/classic/dynamic/impl/switch.ipp7
-rw-r--r--boost/spirit/home/classic/dynamic/while.hpp2
-rw-r--r--boost/spirit/home/classic/iterator/impl/file_iterator.ipp6
-rw-r--r--boost/spirit/home/classic/iterator/multi_pass.hpp22
-rw-r--r--boost/spirit/home/classic/meta/impl/refactoring.ipp2
-rw-r--r--boost/spirit/home/classic/phoenix/actor.hpp3
-rw-r--r--boost/spirit/home/classic/phoenix/composite.hpp12
-rw-r--r--boost/spirit/home/classic/phoenix/special_ops.hpp1
-rw-r--r--boost/spirit/home/classic/phoenix/tuples.hpp2
-rw-r--r--boost/spirit/home/classic/tree/ast.hpp12
-rw-r--r--boost/spirit/home/classic/tree/parse_tree.hpp12
-rw-r--r--boost/spirit/home/classic/utility.hpp2
-rw-r--r--boost/spirit/home/classic/utility/impl/escape_char.ipp2
-rw-r--r--boost/spirit/home/classic/version.hpp2
-rw-r--r--boost/spirit/home/karma/auxiliary/attr_cast.hpp2
-rw-r--r--boost/spirit/home/karma/char/char.hpp2
-rw-r--r--boost/spirit/home/karma/detail/alternative_function.hpp2
-rw-r--r--boost/spirit/home/karma/detail/output_iterator.hpp2
-rw-r--r--boost/spirit/home/karma/numeric/detail/real_utils.hpp8
-rw-r--r--boost/spirit/home/karma/stream/ostream_iterator.hpp6
-rw-r--r--boost/spirit/home/lex/lexer/lexertl/generate_static.hpp10
-rw-r--r--boost/spirit/home/lex/lexer/lexertl/token.hpp7
-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
-rw-r--r--boost/spirit/home/support/algorithm/any_if_ns_so.hpp92
-rw-r--r--boost/spirit/home/support/algorithm/any_ns_so.hpp106
-rw-r--r--boost/spirit/home/support/attributes.hpp15
-rw-r--r--boost/spirit/home/support/detail/hold_any.hpp37
-rw-r--r--boost/spirit/home/support/iterators/detail/multi_pass.hpp1
-rw-r--r--boost/spirit/home/support/iterators/line_pos_iterator.hpp34
-rw-r--r--boost/spirit/home/support/utree/detail/utree_detail2.hpp2
-rw-r--r--boost/spirit/home/x3/binary/binary.hpp4
-rw-r--r--boost/spirit/home/x3/char/char_set.hpp2
-rw-r--r--boost/spirit/home/x3/core/action.hpp4
-rw-r--r--boost/spirit/home/x3/core/call.hpp4
-rw-r--r--boost/spirit/home/x3/core/detail/parse_into_container.hpp24
-rw-r--r--boost/spirit/home/x3/core/parse.hpp24
-rw-r--r--boost/spirit/home/x3/core/parser.hpp10
-rw-r--r--boost/spirit/home/x3/directive/confix.hpp2
-rw-r--r--boost/spirit/home/x3/directive/expect.hpp4
-rw-r--r--boost/spirit/home/x3/directive/lexeme.hpp4
-rw-r--r--boost/spirit/home/x3/directive/no_case.hpp4
-rw-r--r--boost/spirit/home/x3/directive/no_skip.hpp4
-rw-r--r--boost/spirit/home/x3/directive/omit.hpp4
-rw-r--r--boost/spirit/home/x3/directive/repeat.hpp7
-rw-r--r--boost/spirit/home/x3/directive/skip.hpp4
-rw-r--r--boost/spirit/home/x3/directive/with.hpp43
-rw-r--r--boost/spirit/home/x3/nonterminal/rule.hpp16
-rw-r--r--boost/spirit/home/x3/numeric/bool.hpp4
-rw-r--r--boost/spirit/home/x3/numeric/bool_policies.hpp4
-rw-r--r--boost/spirit/home/x3/numeric/real.hpp4
-rw-r--r--boost/spirit/home/x3/numeric/real_policies.hpp6
-rw-r--r--boost/spirit/home/x3/operator/alternative.hpp4
-rw-r--r--boost/spirit/home/x3/operator/and_predicate.hpp4
-rw-r--r--boost/spirit/home/x3/operator/detail/alternative.hpp4
-rw-r--r--boost/spirit/home/x3/operator/detail/sequence.hpp62
-rw-r--r--boost/spirit/home/x3/operator/difference.hpp4
-rw-r--r--boost/spirit/home/x3/operator/kleene.hpp4
-rw-r--r--boost/spirit/home/x3/operator/list.hpp4
-rw-r--r--boost/spirit/home/x3/operator/not_predicate.hpp4
-rw-r--r--boost/spirit/home/x3/operator/optional.hpp4
-rw-r--r--boost/spirit/home/x3/operator/plus.hpp4
-rw-r--r--boost/spirit/home/x3/operator/sequence.hpp4
-rw-r--r--boost/spirit/home/x3/support/ast/variant.hpp61
-rw-r--r--boost/spirit/home/x3/support/numeric_utils/detail/extract_int.hpp29
-rw-r--r--boost/spirit/home/x3/support/numeric_utils/extract_int.hpp3
-rw-r--r--boost/spirit/home/x3/support/numeric_utils/extract_real.hpp5
-rw-r--r--boost/spirit/home/x3/support/numeric_utils/sign.hpp4
-rw-r--r--boost/spirit/home/x3/support/traits/attribute_category.hpp42
-rw-r--r--boost/spirit/home/x3/support/traits/container_traits.hpp11
-rw-r--r--boost/spirit/home/x3/support/traits/is_range.hpp27
-rw-r--r--boost/spirit/home/x3/support/traits/move_to.hpp19
-rw-r--r--boost/spirit/home/x3/support/traits/tuple_traits.hpp9
-rw-r--r--boost/spirit/home/x3/support/utility/error_reporting.hpp2
-rw-r--r--boost/spirit/home/x3/version.hpp2
94 files changed, 700 insertions, 425 deletions
diff --git a/boost/spirit/home/classic/core/composite/actions.hpp b/boost/spirit/home/classic/core/composite/actions.hpp
index 864211f710..43b638d7fa 100644
--- a/boost/spirit/home/classic/core/composite/actions.hpp
+++ b/boost/spirit/home/classic/core/composite/actions.hpp
@@ -11,6 +11,7 @@
#include <boost/spirit/home/classic/namespace.hpp>
#include <boost/spirit/home/classic/core/parser.hpp>
#include <boost/spirit/home/classic/core/composite/composite.hpp>
+#include <boost/core/ignore_unused.hpp>
namespace boost { namespace spirit {
@@ -107,7 +108,7 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
typedef typename ScannerT::iterator_t iterator_t;
typedef typename parser_result<self_t, ScannerT>::type result_t;
- scan.at_end(); // allow skipper to take effect
+ ignore_unused(scan.at_end()); // allow skipper to take effect
iterator_t save = scan.first;
result_t hit = this->subject().parse(scan);
if (hit)
diff --git a/boost/spirit/home/classic/core/composite/epsilon.hpp b/boost/spirit/home/classic/core/composite/epsilon.hpp
index f9654e2e51..1bea0e2968 100644
--- a/boost/spirit/home/classic/core/composite/epsilon.hpp
+++ b/boost/spirit/home/classic/core/composite/epsilon.hpp
@@ -16,6 +16,11 @@
#include <boost/spirit/home/classic/core/composite/composite.hpp>
#include <boost/spirit/home/classic/core/composite/no_actions.hpp>
+#if defined(BOOST_MSVC)
+# pragma warning(push)
+# pragma warning(disable: 4800) // forcing value to bool 'true' or 'false'
+#endif
+
////////////////////////////////////////////////////////////////////////////////
namespace boost { namespace spirit {
@@ -273,4 +278,8 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_END
}} // namespace BOOST_SPIRIT_CLASSIC_NS
+#ifdef BOOST_MSVC
+# pragma warning (pop)
+#endif
+
#endif
diff --git a/boost/spirit/home/classic/core/composite/no_actions.hpp b/boost/spirit/home/classic/core/composite/no_actions.hpp
index 638a29778f..472b0e83f8 100644
--- a/boost/spirit/home/classic/core/composite/no_actions.hpp
+++ b/boost/spirit/home/classic/core/composite/no_actions.hpp
@@ -38,10 +38,10 @@ struct no_actions_action_policy:
template<typename ActorT, typename AttrT, typename IteratorT>
void
do_action(
- ActorT const& actor,
- AttrT& val,
- IteratorT const& first,
- IteratorT const& last) const
+ ActorT const& /*actor*/,
+ AttrT& /*val*/,
+ IteratorT const& /*first*/,
+ IteratorT const& /*last*/) const
{}
};
diff --git a/boost/spirit/home/classic/core/match.hpp b/boost/spirit/home/classic/core/match.hpp
index 6f1822ece3..c82baa1489 100644
--- a/boost/spirit/home/classic/core/match.hpp
+++ b/boost/spirit/home/classic/core/match.hpp
@@ -17,6 +17,8 @@
#include <boost/spirit/home/classic/core/safe_bool.hpp>
#include <boost/spirit/home/classic/core/impl/match_attr_traits.ipp>
#include <boost/type_traits/add_const.hpp>
+#include <boost/type_traits/add_reference.hpp>
+#include <boost/type_traits/conditional.hpp>
#include <boost/type_traits/is_reference.hpp>
namespace boost { namespace spirit {
@@ -62,12 +64,20 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
template <typename T = nil_t>
class match : public safe_bool<match<T> >
{
+ typedef typename
+ conditional<
+ is_reference<T>::value
+ , T
+ , typename add_reference<
+ typename add_const<T>::type
+ >::type
+ >::type attr_ref_t;
public:
typedef typename boost::optional<T> optional_type;
- typedef typename optional_type::argument_type ctor_param_t;
- typedef typename optional_type::reference_const_type return_t;
+ typedef attr_ref_t ctor_param_t;
+ typedef attr_ref_t return_t;
typedef T attr_t;
match();
diff --git a/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp b/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp
index f5b187d14b..116c6e31ce 100644
--- a/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp
+++ b/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp
@@ -70,7 +70,7 @@ struct grammar_definition
{ // Does _not_ copy the helpers member !
}
- grammar_helper_list& operator=(grammar_helper_list const& x)
+ grammar_helper_list& operator=(grammar_helper_list const& /*x*/)
{ // Does _not_ copy the helpers member !
return *this;
}
diff --git a/boost/spirit/home/classic/core/primitives/impl/primitives.ipp b/boost/spirit/home/classic/core/primitives/impl/primitives.ipp
index 8a52251ac6..cd92154bbf 100644
--- a/boost/spirit/home/classic/core/primitives/impl/primitives.ipp
+++ b/boost/spirit/home/classic/core/primitives/impl/primitives.ipp
@@ -375,6 +375,12 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
return to_char_type<wchar_t>(towupper(to_int_type(c)));
}
+ inline bool
+ isblank_(bool)
+ {
+ return false;
+ }
+
#endif // !defined(BOOST_NO_CWCTYPE)
}
diff --git a/boost/spirit/home/classic/core/primitives/primitives.hpp b/boost/spirit/home/classic/core/primitives/primitives.hpp
index cd87c3dda8..93b5b22eb2 100644
--- a/boost/spirit/home/classic/core/primitives/primitives.hpp
+++ b/boost/spirit/home/classic/core/primitives/primitives.hpp
@@ -56,7 +56,7 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
if (this->derived().test(ch))
{
iterator_t save(scan.first);
- ++scan.first;
+ ++scan;
return scan.create_match(1, ch, save, scan.first);
}
}
@@ -589,14 +589,14 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
if (!scan.at_end() && *scan == '\r') // CR
{
- ++scan.first;
+ ++scan;
++len;
}
// Don't call skipper here
if (scan.first != scan.last && *scan == '\n') // LF
{
- ++scan.first;
+ ++scan;
++len;
}
diff --git a/boost/spirit/home/classic/core/scanner/impl/skipper.ipp b/boost/spirit/home/classic/core/scanner/impl/skipper.ipp
index fab74bde3a..1f1de8f19b 100644
--- a/boost/spirit/home/classic/core/scanner/impl/skipper.ipp
+++ b/boost/spirit/home/classic/core/scanner/impl/skipper.ipp
@@ -98,12 +98,12 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
ParserT const& p,
SkipT const& skip)
{
- typedef skip_parser_iteration_policy<SkipT> iter_policy_t;
- typedef scanner_policies<iter_policy_t> scanner_policies_t;
- typedef scanner<IteratorT, scanner_policies_t> scanner_t;
+ typedef skip_parser_iteration_policy<SkipT> it_policy_t;
+ typedef scanner_policies<it_policy_t> scan_policies_t;
+ typedef scanner<IteratorT, scan_policies_t> scanner_t;
- iter_policy_t iter_policy(skip);
- scanner_policies_t policies(iter_policy);
+ it_policy_t iter_policy(skip);
+ scan_policies_t policies(iter_policy);
IteratorT first = first_;
scanner_t scan(first, last, policies);
match<nil_t> hit = p.parse(scan);
@@ -124,9 +124,9 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
ParserT const& p,
space_parser const&)
{
- typedef skipper_iteration_policy<> iter_policy_t;
- typedef scanner_policies<iter_policy_t> scanner_policies_t;
- typedef scanner<IteratorT, scanner_policies_t> scanner_t;
+ typedef skipper_iteration_policy<> it_policy_t;
+ typedef scanner_policies<it_policy_t> scan_policies_t;
+ typedef scanner<IteratorT, scan_policies_t> scanner_t;
IteratorT first = first_;
scanner_t scan(first, last);
diff --git a/boost/spirit/home/classic/debug/impl/parser_names.ipp b/boost/spirit/home/classic/debug/impl/parser_names.ipp
index 5d75be2436..1701088aa2 100644
--- a/boost/spirit/home/classic/debug/impl/parser_names.ipp
+++ b/boost/spirit/home/classic/debug/impl/parser_names.ipp
@@ -218,7 +218,7 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
// from parser.hpp
template <typename DerivedT>
inline std::string
- parser_name(parser<DerivedT> const& p)
+ parser_name(parser<DerivedT> const& /*p*/)
{
return std::string("parser");
}
@@ -227,7 +227,7 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
// from primitives.hpp
template <typename DerivedT>
inline std::string
- parser_name(char_parser<DerivedT> const &p)
+ parser_name(char_parser<DerivedT> const &/*p*/)
{
return std::string("char_parser");
}
diff --git a/boost/spirit/home/classic/dynamic/for.hpp b/boost/spirit/home/classic/dynamic/for.hpp
index 45edd6a968..21c4b78969 100644
--- a/boost/spirit/home/classic/dynamic/for.hpp
+++ b/boost/spirit/home/classic/dynamic/for.hpp
@@ -108,15 +108,13 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
typename parser_result<self_t, ScannerT>::type
parse(ScannerT const &scan) const
{
- typedef typename parser_result<self_t, ScannerT>::type
- result_t;
typedef typename parser_result<parser_t, ScannerT>::type
body_result_t;
typename ScannerT::iterator_t save(scan.first);
std::size_t length = 0;
- int eval_length = 0;
+ std::ptrdiff_t eval_length = 0;
this->init();
while ((eval_length = this->evaluate(scan))>=0)
diff --git a/boost/spirit/home/classic/dynamic/impl/switch.ipp b/boost/spirit/home/classic/dynamic/impl/switch.ipp
index b881f9d121..db7471d3ec 100644
--- a/boost/spirit/home/classic/dynamic/impl/switch.ipp
+++ b/boost/spirit/home/classic/dynamic/impl/switch.ipp
@@ -12,6 +12,7 @@
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/static_assert.hpp>
+#include <boost/core/ignore_unused.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/inc.hpp>
@@ -328,8 +329,8 @@ struct compound_case_parser
case_chain<self_t>::depth < BOOST_SPIRIT_SWITCH_CASE_LIMIT
);
- typedef case_parser<N1, ParserT1, IsDefault1> right_t;
- return compound_case_parser<self_t, right_t, IsDefault1>(*this, p);
+ typedef case_parser<N1, ParserT1, IsDefault1> rhs_t;
+ return compound_case_parser<self_t, rhs_t, IsDefault1>(*this, p);
}
};
@@ -445,7 +446,7 @@ inline typename parser_result<
compound_case_parser<LeftT, RightT, IsDefault>::
parse(ScannerT const& scan, CondT const &cond) const
{
- scan.at_end(); // allow skipper to take effect
+ ignore_unused(scan.at_end()); // allow skipper to take effect
return parse_switch<value, case_chain<self_t>::depth, is_default>::
do_(*this, scan, cond(scan), scan.first);
}
diff --git a/boost/spirit/home/classic/dynamic/while.hpp b/boost/spirit/home/classic/dynamic/while.hpp
index e441e9c486..d0eae118ae 100644
--- a/boost/spirit/home/classic/dynamic/while.hpp
+++ b/boost/spirit/home/classic/dynamic/while.hpp
@@ -71,7 +71,7 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
iterator_t save(scan.first);
std::size_t length = 0;
- int eval_length = 0;
+ std::ptrdiff_t eval_length = 0;
bool dont_check_condition = is_do_parser;
diff --git a/boost/spirit/home/classic/iterator/impl/file_iterator.ipp b/boost/spirit/home/classic/iterator/impl/file_iterator.ipp
index 0fb92c72a3..4953e86a64 100644
--- a/boost/spirit/home/classic/iterator/impl/file_iterator.ipp
+++ b/boost/spirit/home/classic/iterator/impl/file_iterator.ipp
@@ -130,7 +130,7 @@ public:
void advance(std::ptrdiff_t n)
{
- m_pos += n * sizeof(CharT);
+ m_pos += static_cast<long>(n) * sizeof(CharT);
update_char();
}
@@ -141,14 +141,14 @@ public:
private:
boost::shared_ptr<std::FILE> m_file;
- std::size_t m_pos;
+ long m_pos;
CharT m_curChar;
bool m_eof;
void update_char(void)
{
using namespace std;
- if ((std::size_t)ftell(m_file.get()) != m_pos)
+ if (ftell(m_file.get()) != m_pos)
fseek(m_file.get(), m_pos, SEEK_SET);
m_eof = (fread(&m_curChar, sizeof(CharT), 1, m_file.get()) < 1);
diff --git a/boost/spirit/home/classic/iterator/multi_pass.hpp b/boost/spirit/home/classic/iterator/multi_pass.hpp
index fd9482ef31..260d2933e5 100644
--- a/boost/spirit/home/classic/iterator/multi_pass.hpp
+++ b/boost/spirit/home/classic/iterator/multi_pass.hpp
@@ -16,7 +16,6 @@
#include <algorithm> // for std::swap
#include <exception> // for std::exception
#include <boost/limits.hpp>
-#include <boost/iterator.hpp>
#include <boost/spirit/home/classic/namespace.hpp>
#include <boost/spirit/home/classic/core/assert.hpp> // for BOOST_SPIRIT_ASSERT
@@ -760,24 +759,19 @@ class inner
namespace iterator_ { namespace impl {
-// Meta-function to generate a std::iterator<> base class for multi_pass. This
-// is used mainly to improve conformance of compilers not supporting PTS
-// and thus relying on inheritance to recognize an iterator.
-// We are using boost::iterator<> because it offers an automatic workaround
-// for broken std::iterator<> implementations.
+// Meta-function to generate a std::iterator<>-like base class for multi_pass.
template <typename InputPolicyT, typename InputT>
struct iterator_base_creator
{
typedef typename InputPolicyT::BOOST_NESTED_TEMPLATE inner<InputT> input_t;
- typedef boost::iterator
- <
- std::forward_iterator_tag,
- typename input_t::value_type,
- typename input_t::difference_type,
- typename input_t::pointer,
- typename input_t::reference
- > type;
+ struct type {
+ typedef std::forward_iterator_tag iterator_category;
+ typedef typename input_t::value_type value_type;
+ typedef typename input_t::difference_type difference_type;
+ typedef typename input_t::pointer pointer;
+ typedef typename input_t::reference reference;
+ };
};
}}
diff --git a/boost/spirit/home/classic/meta/impl/refactoring.ipp b/boost/spirit/home/classic/meta/impl/refactoring.ipp
index 61cc6b57b1..cebad09370 100644
--- a/boost/spirit/home/classic/meta/impl/refactoring.ipp
+++ b/boost/spirit/home/classic/meta/impl/refactoring.ipp
@@ -324,7 +324,7 @@ namespace impl {
>
static typename parser_result<ParserT, ScannerT>::type
parse(ParserT const &, ScannerT const& scan, ActionT const &action,
- NestedT const& nested_d)
+ NestedT const& /*nested_d*/)
{
return action.parse(scan);
}
diff --git a/boost/spirit/home/classic/phoenix/actor.hpp b/boost/spirit/home/classic/phoenix/actor.hpp
index 67a4b02898..e05b4f84ff 100644
--- a/boost/spirit/home/classic/phoenix/actor.hpp
+++ b/boost/spirit/home/classic/phoenix/actor.hpp
@@ -10,6 +10,7 @@
///////////////////////////////////////////////////////////////////////////////
#include <boost/spirit/home/classic/phoenix/tuples.hpp>
+#include <boost/type_traits/remove_reference.hpp>
///////////////////////////////////////////////////////////////////////////////
namespace phoenix {
@@ -120,7 +121,7 @@ template <typename ActorT, typename TupleT>
struct actor_result {
typedef typename ActorT::template result<TupleT>::type type;
- typedef typename remove_reference<type>::type plain_type;
+ typedef typename boost::remove_reference<type>::type plain_type;
};
//////////////////////////////////
diff --git a/boost/spirit/home/classic/phoenix/composite.hpp b/boost/spirit/home/classic/phoenix/composite.hpp
index 3fed61de30..30bacbc735 100644
--- a/boost/spirit/home/classic/phoenix/composite.hpp
+++ b/boost/spirit/home/classic/phoenix/composite.hpp
@@ -1374,13 +1374,13 @@ namespace impl {
<OperationT, actor<BaseT>, B>::type type;
static type
- construct(actor<BaseT> const& _0, B const& _1)
+ construct(actor<BaseT> const& _0_, B const& _1_)
{
typedef typename make_composite
<OperationT, actor<BaseT>, B>::composite_type
ret_t;
- return ret_t(OperationT(), _0, as_actor<B>::convert(_1));
+ return ret_t(OperationT(), _0_, as_actor<B>::convert(_1_));
}
};
@@ -1392,13 +1392,13 @@ namespace impl {
<OperationT, A, actor<BaseT> >::type type;
static type
- construct(A const& _0, actor<BaseT> const& _1)
+ construct(A const& _0_, actor<BaseT> const& _1_)
{
typedef typename make_composite
<OperationT, A, actor<BaseT> >::composite_type
ret_t;
- return ret_t(OperationT(), as_actor<A>::convert(_0), _1);
+ return ret_t(OperationT(), as_actor<A>::convert(_0_), _1_);
}
};
@@ -1410,13 +1410,13 @@ namespace impl {
<OperationT, actor<BaseA>, actor<BaseB> >::type type;
static type
- construct(actor<BaseA> const& _0, actor<BaseB> const& _1)
+ construct(actor<BaseA> const& _0_, actor<BaseB> const& _1_)
{
typedef typename make_composite
<OperationT, actor<BaseA>, actor<BaseB> >::composite_type
ret_t;
- return ret_t(OperationT(), _0, _1);
+ return ret_t(OperationT(), _0_, _1_);
}
};
diff --git a/boost/spirit/home/classic/phoenix/special_ops.hpp b/boost/spirit/home/classic/phoenix/special_ops.hpp
index 12bf4b70fe..c0e5265ae8 100644
--- a/boost/spirit/home/classic/phoenix/special_ops.hpp
+++ b/boost/spirit/home/classic/phoenix/special_ops.hpp
@@ -20,6 +20,7 @@
///////////////////////////////////////////////////////////////////////////////
#include <boost/spirit/home/classic/phoenix/operators.hpp>
#include <iosfwd>
+#include <complex>
///////////////////////////////////////////////////////////////////////////////
#if defined(_STLPORT_VERSION) && defined(__STL_USE_OWN_NAMESPACE)
diff --git a/boost/spirit/home/classic/phoenix/tuples.hpp b/boost/spirit/home/classic/phoenix/tuples.hpp
index a52b4e1118..928206c499 100644
--- a/boost/spirit/home/classic/phoenix/tuples.hpp
+++ b/boost/spirit/home/classic/phoenix/tuples.hpp
@@ -207,7 +207,7 @@ struct tuple_element
typedef nil_t& rtype;
typedef nil_t const& crtype;
- static nil_t get(TupleT const& t) { return nil_t(); }
+ static nil_t get(TupleT const&) { return nil_t(); }
};
//////////////////////////////////
diff --git a/boost/spirit/home/classic/tree/ast.hpp b/boost/spirit/home/classic/tree/ast.hpp
index 0aa59f6dc7..b405d2007e 100644
--- a/boost/spirit/home/classic/tree/ast.hpp
+++ b/boost/spirit/home/classic/tree/ast.hpp
@@ -301,15 +301,15 @@ ast_parse(
SkipT const& skip_,
AstFactoryT const & /*dummy_*/ = AstFactoryT())
{
- typedef skip_parser_iteration_policy<SkipT> iter_policy_t;
+ typedef skip_parser_iteration_policy<SkipT> it_policy_t;
typedef ast_match_policy<IteratorT, AstFactoryT> ast_match_policy_t;
typedef
- scanner_policies<iter_policy_t, ast_match_policy_t>
- scanner_policies_t;
- typedef scanner<IteratorT, scanner_policies_t> scanner_t;
+ scanner_policies<it_policy_t, ast_match_policy_t>
+ scan_policies_t;
+ typedef scanner<IteratorT, scan_policies_t> scanner_t;
- iter_policy_t iter_policy(skip_);
- scanner_policies_t policies(iter_policy);
+ it_policy_t iter_policy(skip_);
+ scan_policies_t policies(iter_policy);
IteratorT first = first_;
scanner_t scan(first, last_, policies);
tree_match<IteratorT, AstFactoryT> hit = parser.derived().parse(scan);
diff --git a/boost/spirit/home/classic/tree/parse_tree.hpp b/boost/spirit/home/classic/tree/parse_tree.hpp
index 754d74a4aa..dcb55461c7 100644
--- a/boost/spirit/home/classic/tree/parse_tree.hpp
+++ b/boost/spirit/home/classic/tree/parse_tree.hpp
@@ -210,15 +210,15 @@ pt_parse(
SkipT const& skip,
NodeFactoryT const& /*dummy_*/ = NodeFactoryT())
{
- typedef skip_parser_iteration_policy<SkipT> iter_policy_t;
+ typedef skip_parser_iteration_policy<SkipT> it_policy_t;
typedef pt_match_policy<IteratorT, NodeFactoryT> pt_match_policy_t;
typedef
- scanner_policies<iter_policy_t, pt_match_policy_t>
- scanner_policies_t;
- typedef scanner<IteratorT, scanner_policies_t> scanner_t;
+ scanner_policies<it_policy_t, pt_match_policy_t>
+ scan_policies_t;
+ typedef scanner<IteratorT, scan_policies_t> scanner_t;
- iter_policy_t iter_policy(skip);
- scanner_policies_t policies(iter_policy);
+ it_policy_t iter_policy(skip);
+ scan_policies_t policies(iter_policy);
IteratorT first = first_;
scanner_t scan(first, last, policies);
tree_match<IteratorT, NodeFactoryT> hit = p.derived().parse(scan);
diff --git a/boost/spirit/home/classic/utility.hpp b/boost/spirit/home/classic/utility.hpp
index 8eec51a7f7..d04c51dc60 100644
--- a/boost/spirit/home/classic/utility.hpp
+++ b/boost/spirit/home/classic/utility.hpp
@@ -34,7 +34,9 @@
// Utility.Support
#include <boost/spirit/home/classic/utility/flush_multi_pass.hpp>
+#ifdef BOOST_SPIRIT_THREADSAFE
#include <boost/spirit/home/classic/utility/scoped_lock.hpp>
+#endif
#endif // !defined(BOOST_SPIRIT_UTILITY_MAIN_HPP)
diff --git a/boost/spirit/home/classic/utility/impl/escape_char.ipp b/boost/spirit/home/classic/utility/impl/escape_char.ipp
index 55ab158472..a592a49312 100644
--- a/boost/spirit/home/classic/utility/impl/escape_char.ipp
+++ b/boost/spirit/home/classic/utility/impl/escape_char.ipp
@@ -33,7 +33,7 @@ const unsigned long lex_escapes = c_escapes << 1;
namespace impl {
//////////////////////////////////
-#if (defined(BOOST_MSVC) && (BOOST_MSVC <= 1310))
+#if defined(BOOST_MSVC)
#pragma warning(push)
#pragma warning(disable:4127)
#endif
diff --git a/boost/spirit/home/classic/version.hpp b/boost/spirit/home/classic/version.hpp
index 77371ed37c..d9357c27e1 100644
--- a/boost/spirit/home/classic/version.hpp
+++ b/boost/spirit/home/classic/version.hpp
@@ -24,7 +24,7 @@
// This is the version of the current Spirit distribution
//
///////////////////////////////////////////////////////////////////////////////
-#define SPIRIT_VERSION 0x1806
+#define SPIRIT_VERSION 0x1808
#define SPIRIT_PIZZA_VERSION SPIRIT_MEGA_VEGGI // :-)
#endif // defined(SPIRIT_VERSION_HPP)
diff --git a/boost/spirit/home/karma/auxiliary/attr_cast.hpp b/boost/spirit/home/karma/auxiliary/attr_cast.hpp
index 2e67b6b391..9df226bd0a 100644
--- a/boost/spirit/home/karma/auxiliary/attr_cast.hpp
+++ b/boost/spirit/home/karma/auxiliary/attr_cast.hpp
@@ -31,9 +31,7 @@ namespace boost { namespace spirit
namespace boost { namespace spirit { namespace karma
{
-#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
using spirit::attr_cast;
-#endif
///////////////////////////////////////////////////////////////////////////
// attr_cast_generator consumes the attribute of subject generator without
diff --git a/boost/spirit/home/karma/char/char.hpp b/boost/spirit/home/karma/char/char.hpp
index 0d9b4f6b28..7992aebbad 100644
--- a/boost/spirit/home/karma/char/char.hpp
+++ b/boost/spirit/home/karma/char/char.hpp
@@ -180,7 +180,7 @@ namespace boost { namespace spirit { namespace karma
bool test(Attribute const& attr, CharParam& ch_, Context&) const
{
// fail if attribute isn't matched my immediate literal
- ch_ = attr;
+ ch_ = static_cast<char_type>(attr);
return attr == ch;
}
diff --git a/boost/spirit/home/karma/detail/alternative_function.hpp b/boost/spirit/home/karma/detail/alternative_function.hpp
index 54906b256e..8e369b42e3 100644
--- a/boost/spirit/home/karma/detail/alternative_function.hpp
+++ b/boost/spirit/home/karma/detail/alternative_function.hpp
@@ -90,7 +90,7 @@ namespace boost { namespace spirit { namespace karma { namespace detail
component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
#endif
return call(component, sink, ctx, d, attr
- , spirit::traits::not_is_variant<Attribute, karma::domain>());
+ , spirit::traits::not_is_variant_or_variant_in_optional<Attribute, karma::domain>());
}
template <typename OutputIterator, typename Context, typename Delimiter>
diff --git a/boost/spirit/home/karma/detail/output_iterator.hpp b/boost/spirit/home/karma/detail/output_iterator.hpp
index 87980b7690..75c984a9bc 100644
--- a/boost/spirit/home/karma/detail/output_iterator.hpp
+++ b/boost/spirit/home/karma/detail/output_iterator.hpp
@@ -304,7 +304,7 @@ namespace boost { namespace spirit { namespace karma { namespace detail
struct no_buffering_policy
{
no_buffering_policy() {}
- no_buffering_policy(no_counting_policy const&) {}
+ no_buffering_policy(no_buffering_policy const&) {}
template <typename T>
bool output(T const& /*value*/)
diff --git a/boost/spirit/home/karma/numeric/detail/real_utils.hpp b/boost/spirit/home/karma/numeric/detail/real_utils.hpp
index 526985d280..84ea67dd4b 100644
--- a/boost/spirit/home/karma/numeric/detail/real_utils.hpp
+++ b/boost/spirit/home/karma/numeric/detail/real_utils.hpp
@@ -105,7 +105,13 @@ namespace boost { namespace spirit { namespace karma
if (exp != -dim)
++exp;
dim = static_cast<U>(-exp);
- n *= spirit::traits::pow10<U>(exp);
+ // detect and handle denormalized numbers to prevent overflow in pow10
+ if (exp > std::numeric_limits<U>::max_exponent10)
+ {
+ n *= spirit::traits::pow10<U>(std::numeric_limits<U>::max_exponent10);
+ n *= spirit::traits::pow10<U>(exp - std::numeric_limits<U>::max_exponent10);
+ } else
+ n *= spirit::traits::pow10<U>(exp);
}
}
diff --git a/boost/spirit/home/karma/stream/ostream_iterator.hpp b/boost/spirit/home/karma/stream/ostream_iterator.hpp
index 8a517287a7..0aabfac149 100644
--- a/boost/spirit/home/karma/stream/ostream_iterator.hpp
+++ b/boost/spirit/home/karma/stream/ostream_iterator.hpp
@@ -25,9 +25,13 @@ namespace boost { namespace spirit { namespace karma
typename T, typename Elem = char
, typename Traits = std::char_traits<Elem> >
class ostream_iterator
- : public std::iterator<std::output_iterator_tag, void, void, void, void>
{
public:
+ typedef std::output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
typedef Elem char_type;
typedef Traits traits_type;
typedef std::basic_ostream<Elem, Traits> ostream_type;
diff --git a/boost/spirit/home/lex/lexer/lexertl/generate_static.hpp b/boost/spirit/home/lex/lexer/lexertl/generate_static.hpp
index 72b8014611..6a07ffde0a 100644
--- a/boost/spirit/home/lex/lexer/lexertl/generate_static.hpp
+++ b/boost/spirit/home/lex/lexer/lexertl/generate_static.hpp
@@ -415,7 +415,7 @@ namespace boost { namespace spirit { namespace lex { namespace lexertl
{
os_ << " std::size_t index = *curr_++\n";
}
- os_ << " bol = (index == '\n') ? true : false;\n";
+ os_ << " bol = (index == '\\n') ? true : false;\n";
os_ << " std::size_t const state_ = ptr_[\n";
os_ << " lookup_[static_cast<std::size_t>(index)]];\n";
@@ -442,7 +442,7 @@ namespace boost { namespace spirit { namespace lex { namespace lexertl
{
os_ << " std::size_t index = *curr_++\n";
}
- os_ << " bol = (index == '\n') ? true : false;\n";
+ os_ << " bol = (index == '\\n') ? true : false;\n";
os_ << " std::size_t const state_ = ptr_[\n";
os_ << " lookup_[static_cast<std::size_t>(index)]];\n";
@@ -469,7 +469,7 @@ namespace boost { namespace spirit { namespace lex { namespace lexertl
{
os_ << " std::size_t index = *curr_++\n";
}
- os_ << " bol = (index == '\n') ? true : false;\n";
+ os_ << " bol = (index == '\\n') ? true : false;\n";
os_ << " std::size_t const state_ = ptr_[\n";
os_ << " lookup_[static_cast<std::size_t>(index)]];\n";
@@ -577,7 +577,7 @@ namespace boost { namespace spirit { namespace lex { namespace lexertl
if (sm_.data()._seen_BOL_assertion)
{
- os_ << " bol_ = (*start_token_ == '\n') ? true : false;\n";
+ os_ << " bol_ = (*start_token_ == '\\n') ? true : false;\n";
}
os_ << " id_ = npos;\n";
@@ -749,7 +749,7 @@ namespace boost { namespace spirit { namespace lex { namespace lexertl
}
if (iter_->eol_index != boost::lexer::npos)
{
- os_ << "\n if (ch_ == '\n') goto state" << dfa_
+ os_ << "\n if (ch_ == '\\n') goto state" << dfa_
<< '_' << iter_->eol_index << ";\n";
}
os_ << " ++curr_;\n";
diff --git a/boost/spirit/home/lex/lexer/lexertl/token.hpp b/boost/spirit/home/lex/lexer/lexertl/token.hpp
index 9f4bdb3872..f795bcacac 100644
--- a/boost/spirit/home/lex/lexer/lexertl/token.hpp
+++ b/boost/spirit/home/lex/lexer/lexertl/token.hpp
@@ -33,6 +33,7 @@
#include <boost/mpl/vector.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/or.hpp>
+#include <boost/type_traits/integral_promotion.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/static_assert.hpp>
@@ -155,10 +156,10 @@ namespace boost { namespace spirit { namespace lex { namespace lexertl
// this default conversion operator is needed to allow the direct
// usage of tokens in conjunction with the primitive parsers defined
// in Qi
- operator id_type() const { return id_; }
+ operator id_type() const { return static_cast<id_type>(id_); }
// Retrieve or set the token id of this token instance.
- id_type id() const { return id_; }
+ id_type id() const { return static_cast<id_type>(id_); }
void id(id_type newid) { id_ = newid; }
std::size_t state() const { return 0; } // always '0' (INITIAL state)
@@ -187,7 +188,7 @@ namespace boost { namespace spirit { namespace lex { namespace lexertl
#endif
protected:
- id_type id_; // token id, 0 if nothing has been matched
+ typename boost::integral_promotion<id_type>::type id_; // token id, 0 if nothing has been matched
};
#if defined(BOOST_SPIRIT_DEBUG)
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
{
diff --git a/boost/spirit/home/support/algorithm/any_if_ns_so.hpp b/boost/spirit/home/support/algorithm/any_if_ns_so.hpp
new file mode 100644
index 0000000000..d0279cf037
--- /dev/null
+++ b/boost/spirit/home/support/algorithm/any_if_ns_so.hpp
@@ -0,0 +1,92 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Hartmut Kaiser
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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_ANY_IF_NS_SO_DECEMBER_03_2017_0826PM)
+#define BOOST_SPIRIT_ANY_IF_NS_SO_DECEMBER_03_2017_0826PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/algorithm/any_ns_so.hpp>
+
+namespace boost { namespace spirit
+{
+ ///////////////////////////////////////////////////////////////////////////
+ // This is a special version for a binary fusion::any. The predicate
+ // is used to decide whether to advance the second iterator or not.
+ // This is needed for sequences containing components with unused
+ // attributes. The second iterator is advanced only if the attribute
+ // of the corresponding component iterator is not unused.
+ //
+ // This is a non-short circuiting (ns) strict order (so) version of the
+ // any_if algorithm.
+ ///////////////////////////////////////////////////////////////////////////
+ namespace detail
+ {
+ template <
+ typename Pred, typename First1, typename Last1, typename First2
+ , typename Last2, typename F
+ >
+ inline bool
+ any_if_ns_so(First1 const&, First2 const&, Last1 const&, Last2 const&
+ , F const&, mpl::true_)
+ {
+ return false;
+ }
+
+ template <
+ typename Pred, typename First1, typename Last1, typename First2
+ , typename Last2, typename F
+ >
+ inline bool
+ any_if_ns_so(First1 const& first1, First2 const& first2
+ , Last1 const& last1, Last2 const& last2, F& f, mpl::false_)
+ {
+ bool head = f(*first1, spirit::detail::attribute_value<Pred, First1, Last2>(first2));
+ bool tail =
+ detail::any_if_ns_so<Pred>(
+ fusion::next(first1)
+ , attribute_next<Pred, First1, Last2>(first2)
+ , last1, last2
+ , f
+ , fusion::result_of::equal_to<
+ typename fusion::result_of::next<First1>::type, Last1>());
+ return head || tail;
+ }
+ }
+
+ template <typename Pred, typename Sequence1, typename Sequence2, typename F>
+ inline bool
+ any_if_ns_so(Sequence1 const& seq1, Sequence2& seq2, F f, Pred)
+ {
+ return detail::any_if_ns_so<Pred>(
+ fusion::begin(seq1), fusion::begin(seq2)
+ , fusion::end(seq1), fusion::end(seq2)
+ , f
+ , fusion::result_of::equal_to<
+ typename fusion::result_of::begin<Sequence1>::type
+ , typename fusion::result_of::end<Sequence1>::type>());
+ }
+
+ template <typename Pred, typename Sequence, typename F>
+ inline bool
+ any_if_ns_so(Sequence const& seq, unused_type const, F f, Pred)
+ {
+ return detail::any_ns_so(
+ fusion::begin(seq)
+ , fusion::end(seq)
+ , f
+ , fusion::result_of::equal_to<
+ typename fusion::result_of::begin<Sequence>::type
+ , typename fusion::result_of::end<Sequence>::type>());
+ }
+
+}}
+
+#endif
+
diff --git a/boost/spirit/home/support/algorithm/any_ns_so.hpp b/boost/spirit/home/support/algorithm/any_ns_so.hpp
new file mode 100644
index 0000000000..e0b0e495a2
--- /dev/null
+++ b/boost/spirit/home/support/algorithm/any_ns_so.hpp
@@ -0,0 +1,106 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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_ANY_NS_SO_DECEMBER_03_2017_0826PM)
+#define BOOST_SPIRIT_ANY_NS_SO_DECEMBER_03_2017_0826PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/mpl/bool.hpp>
+#include <boost/fusion/include/equal_to.hpp>
+#include <boost/fusion/include/next.hpp>
+#include <boost/fusion/include/deref.hpp>
+#include <boost/fusion/include/begin.hpp>
+#include <boost/fusion/include/end.hpp>
+#include <boost/fusion/include/any.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+
+namespace boost { namespace spirit
+{
+ // A non-short circuiting (ns) strict order (so) version of the any
+ // algorithm
+
+ namespace detail
+ {
+ template <typename First1, typename Last, typename First2, typename F>
+ inline bool
+ any_ns_so(First1 const&, First2 const&, Last const&, F const&, mpl::true_)
+ {
+ return false;
+ }
+
+ template <typename First1, typename Last, typename First2, typename F>
+ inline bool
+ any_ns_so(First1 const& first1, First2 const& first2, Last const& last, F& f, mpl::false_)
+ {
+ bool head = f(*first1, *first2);
+ bool tail =
+ detail::any_ns_so(
+ fusion::next(first1)
+ , fusion::next(first2)
+ , last
+ , f
+ , fusion::result_of::equal_to<
+ typename fusion::result_of::next<First1>::type, Last>());
+ return head || tail;
+ }
+
+ template <typename First, typename Last, typename F>
+ inline bool
+ any_ns_so(First const&, Last const&, F const&, mpl::true_)
+ {
+ return false;
+ }
+
+ template <typename First, typename Last, typename F>
+ inline bool
+ any_ns_so(First const& first, Last const& last, F& f, mpl::false_)
+ {
+ bool head = f(*first);
+ bool tail =
+ detail::any_ns_so(
+ fusion::next(first)
+ , last
+ , f
+ , fusion::result_of::equal_to<
+ typename fusion::result_of::next<First>::type, Last>());
+ return head || tail;
+ }
+ }
+
+ template <typename Sequence1, typename Sequence2, typename F>
+ inline bool
+ any_ns_so(Sequence1 const& seq1, Sequence2& seq2, F f)
+ {
+ return detail::any_ns_so(
+ fusion::begin(seq1)
+ , fusion::begin(seq2)
+ , fusion::end(seq1)
+ , f
+ , fusion::result_of::equal_to<
+ typename fusion::result_of::begin<Sequence1>::type
+ , typename fusion::result_of::end<Sequence1>::type>());
+ }
+
+ template <typename Sequence, typename F>
+ inline bool
+ any_ns_so(Sequence const& seq, unused_type, F f)
+ {
+ return detail::any_ns_so(
+ fusion::begin(seq)
+ , fusion::end(seq)
+ , f
+ , fusion::result_of::equal_to<
+ typename fusion::result_of::begin<Sequence>::type
+ , typename fusion::result_of::end<Sequence>::type>());
+ }
+
+}}
+
+#endif
+
diff --git a/boost/spirit/home/support/attributes.hpp b/boost/spirit/home/support/attributes.hpp
index dd89521404..ceba157fcf 100644
--- a/boost/spirit/home/support/attributes.hpp
+++ b/boost/spirit/home/support/attributes.hpp
@@ -28,7 +28,6 @@
#include <boost/fusion/include/for_each.hpp>
#include <boost/fusion/include/is_view.hpp>
#include <boost/fusion/include/mpl.hpp>
-#include <boost/foreach.hpp>
#include <boost/utility/value_init.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_convertible.hpp>
@@ -279,11 +278,6 @@ namespace boost { namespace spirit { namespace traits
: mpl::false_
{};
- template <typename T, typename Domain>
- struct not_is_variant<boost::optional<T>, Domain>
- : not_is_variant<T, Domain>
- {};
-
// we treat every type as if it where the variant (as this meta function is
// invoked for variant types only)
template <typename T>
@@ -296,6 +290,11 @@ namespace boost { namespace spirit { namespace traits
: variant_type<T>
{};
+ template <typename T, typename Domain>
+ struct not_is_variant_or_variant_in_optional
+ : not_is_variant<typename variant_type<T>::type, Domain>
+ {};
+
///////////////////////////////////////////////////////////////////////////
// The compute_compatible_component_variant
///////////////////////////////////////////////////////////////////////////
@@ -339,7 +338,7 @@ namespace boost { namespace spirit { namespace traits
template <typename Variant, typename Expected>
struct compute_compatible_component_variant<Variant, Expected, mpl::false_
- , typename enable_if<detail::has_types<Variant> >::type>
+ , typename enable_if<detail::has_types<typename variant_type<Variant>::type> >::type>
{
typedef typename traits::variant_type<Variant>::type variant_type;
typedef typename variant_type::types types;
@@ -372,7 +371,7 @@ namespace boost { namespace spirit { namespace traits
template <typename Expected, typename Attribute, typename Domain>
struct compute_compatible_component
: compute_compatible_component_variant<Attribute, Expected
- , typename spirit::traits::not_is_variant<Attribute, Domain>::type> {};
+ , typename not_is_variant_or_variant_in_optional<Attribute, Domain>::type> {};
template <typename Expected, typename Domain>
struct compute_compatible_component<Expected, unused_type, Domain>
diff --git a/boost/spirit/home/support/detail/hold_any.hpp b/boost/spirit/home/support/detail/hold_any.hpp
index f9a3ff1bfa..e03e3f1731 100644
--- a/boost/spirit/home/support/detail/hold_any.hpp
+++ b/boost/spirit/home/support/detail/hold_any.hpp
@@ -101,13 +101,13 @@ namespace boost { namespace spirit
*reinterpret_cast<T*>(dest) =
*reinterpret_cast<T const*>(src);
}
- static std::basic_istream<Char>&
+ static std::basic_istream<Char>&
stream_in (std::basic_istream<Char>& i, void** obj)
{
i >> *reinterpret_cast<T*>(obj);
return i;
}
- static std::basic_ostream<Char>&
+ static std::basic_ostream<Char>&
stream_out(std::basic_ostream<Char>& o, void* const* obj)
{
o << *reinterpret_cast<T const*>(obj);
@@ -146,13 +146,13 @@ namespace boost { namespace spirit
**reinterpret_cast<T**>(dest) =
**reinterpret_cast<T* const*>(src);
}
- static std::basic_istream<Char>&
+ static std::basic_istream<Char>&
stream_in(std::basic_istream<Char>& i, void** obj)
{
i >> **reinterpret_cast<T**>(obj);
return i;
}
- static std::basic_ostream<Char>&
+ static std::basic_ostream<Char>&
stream_out(std::basic_ostream<Char>& o, void* const* obj)
{
o << **reinterpret_cast<T* const*>(obj);
@@ -198,7 +198,7 @@ namespace boost { namespace spirit
// value of the required type to the hold_any instance you want to
// stream to. This assignment has to be executed before the actual
// call to the operator>>().
- BOOST_ASSERT(false &&
+ BOOST_ASSERT(false &&
"Tried to insert from a std istream into an empty "
"hold_any instance");
return i;
@@ -222,10 +222,8 @@ namespace boost { namespace spirit
explicit basic_hold_any(T const& x)
: table(spirit::detail::get_table<T>::template get<Char>()), object(0)
{
- if (spirit::detail::get_table<T>::is_small::value)
- new (&object) T(x);
- else
- object = new T(x);
+ new_object(object, x,
+ typename spirit::detail::get_table<T>::is_small());
}
basic_hold_any()
@@ -297,6 +295,18 @@ namespace boost { namespace spirit
return *this;
}
+ template <typename T>
+ static void new_object(void*& object, T const& x, mpl::true_)
+ {
+ new (&object) T(x);
+ }
+
+ template <typename T>
+ static void new_object(void*& object, T const& x, mpl::false_)
+ {
+ object = new T(x);
+ }
+
// assignment operator
#ifdef BOOST_HAS_RVALUE_REFS
template <typename T>
@@ -317,6 +327,11 @@ namespace boost { namespace spirit
return assign(x);
}
#endif
+ // copy assignment operator
+ basic_hold_any& operator=(basic_hold_any const& x)
+ {
+ return assign(x);
+ }
// utility functions
basic_hold_any& swap(basic_hold_any& x)
@@ -369,14 +384,14 @@ namespace boost { namespace spirit
// because spirit::hold_any is used only in contexts where these operators
// do exist
template <typename Char_>
- friend inline std::basic_istream<Char_>&
+ friend inline std::basic_istream<Char_>&
operator>> (std::basic_istream<Char_>& i, basic_hold_any<Char_>& obj)
{
return obj.table->stream_in(i, &obj.object);
}
template <typename Char_>
- friend inline std::basic_ostream<Char_>&
+ friend inline std::basic_ostream<Char_>&
operator<< (std::basic_ostream<Char_>& o, basic_hold_any<Char_> const& obj)
{
return obj.table->stream_out(o, &obj.object);
diff --git a/boost/spirit/home/support/iterators/detail/multi_pass.hpp b/boost/spirit/home/support/iterators/detail/multi_pass.hpp
index 8f8e6c71d3..124100a6b4 100644
--- a/boost/spirit/home/support/iterators/detail/multi_pass.hpp
+++ b/boost/spirit/home/support/iterators/detail/multi_pass.hpp
@@ -9,7 +9,6 @@
#include <boost/config.hpp>
#include <boost/spirit/home/support/iterators/multi_pass_fwd.hpp>
-#include <boost/iterator.hpp>
#include <boost/mpl/bool.hpp>
#include <iterator>
#include <algorithm>
diff --git a/boost/spirit/home/support/iterators/line_pos_iterator.hpp b/boost/spirit/home/support/iterators/line_pos_iterator.hpp
index 0b2aec8ce9..558fdca5d5 100644
--- a/boost/spirit/home/support/iterators/line_pos_iterator.hpp
+++ b/boost/spirit/home/support/iterators/line_pos_iterator.hpp
@@ -1,6 +1,7 @@
/*==============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2010 Bryce Lelbach
+ Copyright (c) 2014 Tomoki Imai
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)
@@ -126,17 +127,30 @@ namespace boost { namespace spirit
inline Iterator get_line_start(Iterator lower_bound, Iterator current)
{
Iterator latest = lower_bound;
-
+ bool prev_was_newline = false;
for (Iterator i = lower_bound; i != current; ++i) {
- switch (*i) {
- case '\r':
- case '\n':
- latest = i;
- }
+ if (prev_was_newline) {
+ latest = i;
+ }
+ prev_was_newline = (*i == '\r') || (*i == '\n');
+ }
+ if (prev_was_newline) {
+ latest = current;
}
-
return latest;
}
+
+ template <class Iterator>
+ inline Iterator get_line_end(Iterator current, Iterator upper_bound)
+ {
+ for (Iterator i = current; i != upper_bound; ++i) {
+ if ((*i == '\n') || (*i == '\r')) {
+ return i;
+ }
+ }
+ return upper_bound;
+ }
+
template <class Iterator>
inline iterator_range<Iterator>
@@ -145,11 +159,7 @@ namespace boost { namespace spirit
Iterator upper_bound)
{
Iterator first = get_line_start(lower_bound, current);
- Iterator last = get_line_start(current, upper_bound);
-
- if (last == current)
- last = upper_bound;
-
+ Iterator last = get_line_end(current, upper_bound);
return iterator_range<Iterator>(first, last);
}
diff --git a/boost/spirit/home/support/utree/detail/utree_detail2.hpp b/boost/spirit/home/support/utree/detail/utree_detail2.hpp
index d4be2c5bde..cc3cb2fd43 100644
--- a/boost/spirit/home/support/utree/detail/utree_detail2.hpp
+++ b/boost/spirit/home/support/utree/detail/utree_detail2.hpp
@@ -77,7 +77,7 @@ namespace boost { namespace spirit { namespace detail
template <typename Iterator>
inline void fast_string::construct(Iterator f, Iterator l)
{
- unsigned const size = l-f;
+ std::size_t const size = static_cast<std::size_t>(l-f);
char* str;
if (size < max_string_len)
{
diff --git a/boost/spirit/home/x3/binary/binary.hpp b/boost/spirit/home/x3/binary/binary.hpp
index 551e5b3865..bdf9c5e41e 100644
--- a/boost/spirit/home/x3/binary/binary.hpp
+++ b/boost/spirit/home/x3/binary/binary.hpp
@@ -37,7 +37,7 @@ namespace boost { namespace spirit { namespace x3
template <typename Iterator, typename Context, typename Attribute>
bool parse(Iterator& first, Iterator const& last
- , Context& context, unused_type, Attribute& attr_param) const
+ , Context const& context, unused_type, Attribute& attr_param) const
{
x3::skip_over(first, last, context);
@@ -69,7 +69,7 @@ namespace boost { namespace spirit { namespace x3
template <typename Iterator, typename Context, typename Attribute>
bool parse(Iterator& first, Iterator const& last
- , Context& context, unused_type, Attribute& attr_param) const
+ , Context const& context, unused_type, Attribute& attr_param) const
{
x3::skip_over(first, last, context);
diff --git a/boost/spirit/home/x3/char/char_set.hpp b/boost/spirit/home/x3/char/char_set.hpp
index 1bff83ec6b..26e15478dc 100644
--- a/boost/spirit/home/x3/char/char_set.hpp
+++ b/boost/spirit/home/x3/char/char_set.hpp
@@ -37,7 +37,7 @@ namespace boost { namespace spirit { namespace x3
: from(from_), to(to_) {}
template <typename Char, typename Context>
- bool test(Char ch_, Context& context) const
+ bool test(Char ch_, Context const& context) const
{
char_type ch = char_type(ch_); // optimize for token based parsing
diff --git a/boost/spirit/home/x3/core/action.hpp b/boost/spirit/home/x3/core/action.hpp
index 7c34ac0ece..3bd33f57ff 100644
--- a/boost/spirit/home/x3/core/action.hpp
+++ b/boost/spirit/home/x3/core/action.hpp
@@ -4,8 +4,8 @@
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(SPIRIT_ACTION_JANUARY_07_2007_1128AM)
-#define SPIRIT_ACTION_JANUARY_07_2007_1128AM
+#if !defined(BOOST_SPIRIT_X3_ACTION_JANUARY_07_2007_1128AM)
+#define BOOST_SPIRIT_X3_ACTION_JANUARY_07_2007_1128AM
#include <boost/spirit/home/x3/support/context.hpp>
#include <boost/spirit/home/x3/support/traits/attribute_of.hpp>
diff --git a/boost/spirit/home/x3/core/call.hpp b/boost/spirit/home/x3/core/call.hpp
index 8a5deedb73..caae13f389 100644
--- a/boost/spirit/home/x3/core/call.hpp
+++ b/boost/spirit/home/x3/core/call.hpp
@@ -4,8 +4,8 @@
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(SPIRIT_CALL_CONTEXT_MAY_26_2014_0234PM)
-#define SPIRIT_CALL_CONTEXT_MAY_26_2014_0234PM
+#if !defined(BOOST_SPIRIT_X3_CALL_CONTEXT_MAY_26_2014_0234PM)
+#define BOOST_SPIRIT_X3_CALL_CONTEXT_MAY_26_2014_0234PM
#include <type_traits>
diff --git a/boost/spirit/home/x3/core/detail/parse_into_container.hpp b/boost/spirit/home/x3/core/detail/parse_into_container.hpp
index 45ecc41ae0..4f2310a8e5 100644
--- a/boost/spirit/home/x3/core/detail/parse_into_container.hpp
+++ b/boost/spirit/home/x3/core/detail/parse_into_container.hpp
@@ -4,8 +4,8 @@
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(SPIRIT_PARSE_INTO_CONTAINER_JAN_15_2013_0957PM)
-#define SPIRIT_PARSE_INTO_CONTAINER_JAN_15_2013_0957PM
+#if !defined(BOOST_SPIRIT_X3_PARSE_INTO_CONTAINER_JAN_15_2013_0957PM)
+#define BOOST_SPIRIT_X3_PARSE_INTO_CONTAINER_JAN_15_2013_0957PM
#include <type_traits>
@@ -17,6 +17,7 @@
#include <boost/spirit/home/x3/support/traits/is_substitute.hpp>
#include <boost/spirit/home/x3/support/traits/move_to.hpp>
#include <boost/mpl/and.hpp>
+#include <boost/fusion/include/at_key.hpp>
#include <boost/fusion/include/front.hpp>
#include <boost/fusion/include/back.hpp>
#include <boost/variant/apply_visitor.hpp>
@@ -37,10 +38,6 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
}
};
-/* $$$ clang reports: warning: class template partial specialization contains
- * a template parameter that can not be deduced; this partial specialization
- * will never be used $$$
- *
// save to associative fusion container where Key
// is variant over possible keys
template <typename ...T>
@@ -54,7 +51,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
apply_visitor(saver_visitor<Attribute, Value>(attr, value), key);
}
};
-*/
+
template <typename Attribute, typename Value>
struct saver_visitor : boost::static_visitor<void>
{
@@ -245,18 +242,27 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
parser, first, last, context, rcontext, attr);
}
+ template <typename Iterator>
+ static bool call(
+ Parser const& parser
+ , Iterator& first, Iterator const& last
+ , Context const& context, RContext& rcontext, unused_type attr, mpl::true_)
+ {
+ return parser.parse(first, last, context, rcontext, attr);
+ }
+
template <typename Iterator, typename Attribute>
static bool call(
Parser const& parser
, Iterator& first, Iterator const& last
, Context const& context, RContext& rcontext, Attribute& attr, mpl::true_)
{
- if (attr.empty())
+ if (traits::is_empty(attr))
return parser.parse(first, last, context, rcontext, attr);
Attribute rest;
bool r = parser.parse(first, last, context, rcontext, rest);
if (r)
- attr.insert(attr.end(), rest.begin(), rest.end());
+ traits::append(attr, rest.begin(), rest.end());
return r;
}
diff --git a/boost/spirit/home/x3/core/parse.hpp b/boost/spirit/home/x3/core/parse.hpp
index 63878e0756..21162409d8 100644
--- a/boost/spirit/home/x3/core/parse.hpp
+++ b/boost/spirit/home/x3/core/parse.hpp
@@ -10,7 +10,7 @@
#include <boost/spirit/home/x3/support/context.hpp>
#include <boost/spirit/home/x3/core/parser.hpp>
#include <boost/spirit/home/x3/core/skip_over.hpp>
-#include <boost/concept_check.hpp>
+#include <boost/iterator/iterator_concepts.hpp>
namespace boost { namespace spirit { namespace x3
{
@@ -23,11 +23,12 @@ namespace boost { namespace spirit { namespace x3
, Parser const& p
, Attribute& 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>));
// If you get an error no matching function for call to 'as_parser'
// here, then p is not a parser or there is no suitable conversion
@@ -101,11 +102,12 @@ namespace boost { namespace spirit { namespace x3
, Attribute& attr
, skip_flag post_skip = skip_flag::post_skip)
{
- // 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>));
static_assert(!std::is_same<Skipper, unused_type>::value,
"Error! Skipper cannot be unused_type.");
diff --git a/boost/spirit/home/x3/core/parser.hpp b/boost/spirit/home/x3/core/parser.hpp
index 27115b8de4..d8019c8a99 100644
--- a/boost/spirit/home/x3/core/parser.hpp
+++ b/boost/spirit/home/x3/core/parser.hpp
@@ -51,17 +51,15 @@ namespace boost { namespace spirit { namespace x3
}
template <typename Action>
- action<Derived, Action>
- operator[](Action f) const
+ action<Derived, Action> operator[](Action f) const
{
- return action<Derived, Action>(this->derived(), f);
+ return { this->derived(), f };
}
template <typename Handler>
- guard<Derived, Handler>
- on_error(Handler f) const
+ guard<Derived, Handler> on_error(Handler f) const
{
- return guard<Derived, Handler>(this->derived(), f);
+ return { this->derived(), f };
}
};
diff --git a/boost/spirit/home/x3/directive/confix.hpp b/boost/spirit/home/x3/directive/confix.hpp
index 0d99e58f4e..079aac122f 100644
--- a/boost/spirit/home/x3/directive/confix.hpp
+++ b/boost/spirit/home/x3/directive/confix.hpp
@@ -35,7 +35,7 @@ namespace boost { namespace spirit { namespace x3
, typename RContext, typename Attribute>
bool parse(
Iterator& first, Iterator const& last
- , Context& context, RContext& rcontext, Attribute& attr) const
+ , Context const& context, RContext& rcontext, Attribute& attr) const
{
Iterator save = first;
diff --git a/boost/spirit/home/x3/directive/expect.hpp b/boost/spirit/home/x3/directive/expect.hpp
index fe4491a22e..418ecf9b0d 100644
--- a/boost/spirit/home/x3/directive/expect.hpp
+++ b/boost/spirit/home/x3/directive/expect.hpp
@@ -4,8 +4,8 @@
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(SPIRIT_EXPECT_MARCH_16_2012_1024PM)
-#define SPIRIT_EXPECT_MARCH_16_2012_1024PM
+#if !defined(BOOST_SPIRIT_X3_EXPECT_MARCH_16_2012_1024PM)
+#define BOOST_SPIRIT_X3_EXPECT_MARCH_16_2012_1024PM
#include <boost/spirit/home/x3/support/context.hpp>
#include <boost/spirit/home/x3/core/parser.hpp>
diff --git a/boost/spirit/home/x3/directive/lexeme.hpp b/boost/spirit/home/x3/directive/lexeme.hpp
index ce3a6def80..6f250c80ed 100644
--- a/boost/spirit/home/x3/directive/lexeme.hpp
+++ b/boost/spirit/home/x3/directive/lexeme.hpp
@@ -4,8 +4,8 @@
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(SPIRIT_LEXEME_MARCH_24_2007_0802AM)
-#define SPIRIT_LEXEME_MARCH_24_2007_0802AM
+#if !defined(BOOST_SPIRIT_X3_LEXEME_MARCH_24_2007_0802AM)
+#define BOOST_SPIRIT_X3_LEXEME_MARCH_24_2007_0802AM
#include <boost/spirit/home/x3/support/context.hpp>
#include <boost/spirit/home/x3/support/unused.hpp>
diff --git a/boost/spirit/home/x3/directive/no_case.hpp b/boost/spirit/home/x3/directive/no_case.hpp
index b00315614a..7a91e330e4 100644
--- a/boost/spirit/home/x3/directive/no_case.hpp
+++ b/boost/spirit/home/x3/directive/no_case.hpp
@@ -4,8 +4,8 @@
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(SPIRIT_NO_CASE_SEPT_16_2014_0912PM)
-#define SPIRIT_NO_CASE_SEPT_16_2014_0912PM
+#if !defined(BOOST_SPIRIT_X3_NO_CASE_SEPT_16_2014_0912PM)
+#define BOOST_SPIRIT_X3_NO_CASE_SEPT_16_2014_0912PM
#include <boost/spirit/home/x3/support/context.hpp>
#include <boost/spirit/home/x3/support/unused.hpp>
diff --git a/boost/spirit/home/x3/directive/no_skip.hpp b/boost/spirit/home/x3/directive/no_skip.hpp
index c6245f577a..6a7504bd3b 100644
--- a/boost/spirit/home/x3/directive/no_skip.hpp
+++ b/boost/spirit/home/x3/directive/no_skip.hpp
@@ -6,8 +6,8 @@
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(SPIRIT_NO_SKIP_JAN_16_2010_0802PM)
-#define SPIRIT_NO_SKIP_JAN_16_2010_0802PM
+#if !defined(BOOST_SPIRIT_X3_NO_SKIP_JAN_16_2010_0802PM)
+#define BOOST_SPIRIT_X3_NO_SKIP_JAN_16_2010_0802PM
#include <boost/spirit/home/x3/support/context.hpp>
#include <boost/spirit/home/x3/support/unused.hpp>
diff --git a/boost/spirit/home/x3/directive/omit.hpp b/boost/spirit/home/x3/directive/omit.hpp
index 3053676983..fa0f6d9aee 100644
--- a/boost/spirit/home/x3/directive/omit.hpp
+++ b/boost/spirit/home/x3/directive/omit.hpp
@@ -4,8 +4,8 @@
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(SPIRIT_OMIT_MARCH_24_2007_0802AM)
-#define SPIRIT_OMIT_MARCH_24_2007_0802AM
+#if !defined(BOOST_SPIRIT_X3_OMIT_MARCH_24_2007_0802AM)
+#define BOOST_SPIRIT_X3_OMIT_MARCH_24_2007_0802AM
#include <boost/spirit/home/x3/support/unused.hpp>
#include <boost/spirit/home/x3/core/parser.hpp>
diff --git a/boost/spirit/home/x3/directive/repeat.hpp b/boost/spirit/home/x3/directive/repeat.hpp
index 1cdee97fb9..9c4d923255 100644
--- a/boost/spirit/home/x3/directive/repeat.hpp
+++ b/boost/spirit/home/x3/directive/repeat.hpp
@@ -9,8 +9,6 @@
#if !defined(SPIRIT_X3_REPEAT_APRIL_16_2014_0848AM)
#define SPIRIT_X3_REPEAT_APRIL_16_2014_0848AM
-#include <boost/function_types/function_type.hpp>
-#include <boost/function_types/parameter_types.hpp>
#include <boost/spirit/home/x3/core/parser.hpp>
#include <boost/spirit/home/x3/operator/kleene.hpp>
@@ -98,10 +96,9 @@ namespace boost { namespace spirit { namespace x3
struct repeat_gen
{
template<typename Subject>
- kleene<typename extension::as_parser<Subject>::value_type>
- operator[](Subject const& subject) const
+ auto operator[](Subject const& subject) const
{
- return { as_parser(subject) };
+ return *as_parser(subject);
}
template <typename T>
diff --git a/boost/spirit/home/x3/directive/skip.hpp b/boost/spirit/home/x3/directive/skip.hpp
index 8d8bc78aca..321e32bee2 100644
--- a/boost/spirit/home/x3/directive/skip.hpp
+++ b/boost/spirit/home/x3/directive/skip.hpp
@@ -5,8 +5,8 @@
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(SPIRIT_SKIP_JANUARY_26_2008_0422PM)
-#define SPIRIT_SKIP_JANUARY_26_2008_0422PM
+#if !defined(BOOST_SPIRIT_X3_SKIP_JANUARY_26_2008_0422PM)
+#define BOOST_SPIRIT_X3_SKIP_JANUARY_26_2008_0422PM
#include <boost/spirit/home/x3/support/context.hpp>
#include <boost/spirit/home/x3/support/unused.hpp>
diff --git a/boost/spirit/home/x3/directive/with.hpp b/boost/spirit/home/x3/directive/with.hpp
index 153c236b22..a092d35c35 100644
--- a/boost/spirit/home/x3/directive/with.hpp
+++ b/boost/spirit/home/x3/directive/with.hpp
@@ -21,18 +21,18 @@ namespace boost { namespace spirit { namespace x3
{
typedef unary_parser<Subject, Derived> base_type;
mutable T val;
- with_value_holder(Subject const& subject, T const& val)
+ with_value_holder(Subject const& subject, T&& val)
: base_type(subject)
- , val(val) {}
+ , val(std::forward<T>(val)) {}
};
template <typename Subject, typename Derived, typename T>
- struct with_value_holder<Subject, Derived, T const>
+ struct with_value_holder<Subject, Derived, T&>
: unary_parser<Subject, Derived>
{
typedef unary_parser<Subject, Derived> base_type;
- T val;
- with_value_holder(Subject const& subject, T const& val)
+ T& val;
+ with_value_holder(Subject const& subject, T& val)
: base_type(subject)
, val(val) {}
};
@@ -47,8 +47,8 @@ namespace boost { namespace spirit { namespace x3
typedef Subject subject_type;
- with_directive(Subject const& subject, T const& val)
- : base_type(subject, val) {}
+ with_directive(Subject const& subject, T&& val)
+ : base_type(subject, std::forward<T>(val)) {}
template <typename Iterator, typename Context
, typename RContext, typename Attribute>
@@ -63,44 +63,23 @@ namespace boost { namespace spirit { namespace x3
}
};
- template <typename ID, typename T, typename NextContext = unused_type>
- struct with_context
- {
- typedef context<ID, T, NextContext> type;
- };
-
- template <typename ID, typename T>
- struct with_context<ID, T, unused_type>
- {
- typedef context<ID, T> type;
- };
-
template <typename ID, typename T>
struct with_gen
{
- T& val;
-
- with_gen(T& val)
- : val(val) {}
+ T&& val;
template <typename Subject>
with_directive<typename extension::as_parser<Subject>::value_type, ID, T>
operator[](Subject const& subject) const
{
- return { as_parser(subject), val };
+ return { as_parser(subject), std::forward<T>(val) };
}
};
template <typename ID, typename T>
- inline with_gen<ID, T> with(T& val)
- {
- return { val };
- }
-
- template <typename ID, typename T>
- inline with_gen<ID, T const> with(T const& val)
+ inline with_gen<ID, T> with(T&& val)
{
- return { val };
+ return { std::forward<T>(val) };
}
}}}
diff --git a/boost/spirit/home/x3/nonterminal/rule.hpp b/boost/spirit/home/x3/nonterminal/rule.hpp
index ffed1fe965..10734deb7f 100644
--- a/boost/spirit/home/x3/nonterminal/rule.hpp
+++ b/boost/spirit/home/x3/nonterminal/rule.hpp
@@ -151,6 +151,21 @@ namespace boost { namespace spirit { namespace x3
BOOST_SPIRIT_DECLARE_, _, BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__)) \
/***/
+#if BOOST_WORKAROUND(BOOST_MSVC, < 1910)
+#define BOOST_SPIRIT_DEFINE_(r, data, rule_name) \
+ using BOOST_PP_CAT(rule_name, _synonym) = decltype(rule_name); \
+ template <typename Iterator, typename Context, typename Attribute> \
+ inline bool parse_rule( \
+ BOOST_PP_CAT(rule_name, _synonym) /* rule_ */ \
+ , Iterator& first, Iterator const& last \
+ , Context const& context, Attribute& attr) \
+ { \
+ using boost::spirit::x3::unused; \
+ static auto const def_ = (rule_name = BOOST_PP_CAT(rule_name, _def)); \
+ return def_.parse(first, last, context, unused, attr); \
+ } \
+ /***/
+#else
#define BOOST_SPIRIT_DEFINE_(r, data, rule_name) \
template <typename Iterator, typename Context, typename Attribute> \
inline bool parse_rule( \
@@ -163,6 +178,7 @@ namespace boost { namespace spirit { namespace x3
return def_.parse(first, last, context, unused, attr); \
} \
/***/
+#endif
#define BOOST_SPIRIT_DEFINE(...) BOOST_PP_SEQ_FOR_EACH( \
BOOST_SPIRIT_DEFINE_, _, BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__)) \
diff --git a/boost/spirit/home/x3/numeric/bool.hpp b/boost/spirit/home/x3/numeric/bool.hpp
index d5c53c0474..5fcc1862d7 100644
--- a/boost/spirit/home/x3/numeric/bool.hpp
+++ b/boost/spirit/home/x3/numeric/bool.hpp
@@ -70,7 +70,7 @@ namespace boost { namespace spirit { namespace x3
template <typename Iterator, typename Context>
bool parse_main(Iterator& first, Iterator const& last
- , Context& context, T& attr) const
+ , Context const& context, T& attr) const
{
x3::skip_over(first, last, context);
return (n_ && policies.parse_true(first, last, attr, get_case_compare<encoding>(context)))
@@ -79,7 +79,7 @@ namespace boost { namespace spirit { namespace x3
template <typename Iterator, typename Context>
bool parse(Iterator& first, Iterator const& last
- , Context& context, unused_type, T& attr) const
+ , Context const& context, unused_type, T& attr) const
{
return parse_main(first, last, context, attr);
}
diff --git a/boost/spirit/home/x3/numeric/bool_policies.hpp b/boost/spirit/home/x3/numeric/bool_policies.hpp
index 7e5227e2a1..0f8076c939 100644
--- a/boost/spirit/home/x3/numeric/bool_policies.hpp
+++ b/boost/spirit/home/x3/numeric/bool_policies.hpp
@@ -5,8 +5,8 @@
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(SPIRIT_QI_BOOL_POLICIES_SEP_29_2009_0710AM)
-#define SPIRIT_QI_BOOL_POLICIES_SEP_29_2009_0710AM
+#if !defined(BOOST_SPIRIT_X3_BOOL_POLICIES_SEP_29_2009_0710AM)
+#define BOOST_SPIRIT_X3_BOOL_POLICIES_SEP_29_2009_0710AM
#include <boost/spirit/home/x3/string/detail/string_parse.hpp>
#include <boost/spirit/home/x3/support/traits/move_to.hpp>
diff --git a/boost/spirit/home/x3/numeric/real.hpp b/boost/spirit/home/x3/numeric/real.hpp
index 91da536421..a7a9573058 100644
--- a/boost/spirit/home/x3/numeric/real.hpp
+++ b/boost/spirit/home/x3/numeric/real.hpp
@@ -28,7 +28,7 @@ namespace boost { namespace spirit { namespace x3
template <typename Iterator, typename Context>
bool parse(Iterator& first, Iterator const& last
- , Context& context, unused_type, T& attr_) const
+ , Context const& context, unused_type, T& attr_) const
{
x3::skip_over(first, last, context);
return extract_real<T, RealPolicies>::parse(first, last, attr_, policies);
@@ -36,7 +36,7 @@ namespace boost { namespace spirit { namespace x3
template <typename Iterator, typename Context, typename Attribute>
bool parse(Iterator& first, Iterator const& last
- , Context& context, unused_type, Attribute& attr_param) const
+ , Context const& context, unused_type, Attribute& attr_param) const
{
// this case is called when Attribute is not T
T attr_;
diff --git a/boost/spirit/home/x3/numeric/real_policies.hpp b/boost/spirit/home/x3/numeric/real_policies.hpp
index b8fb38c387..193ed84d39 100644
--- a/boost/spirit/home/x3/numeric/real_policies.hpp
+++ b/boost/spirit/home/x3/numeric/real_policies.hpp
@@ -5,8 +5,8 @@
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(SPIRIT_REAL_POLICIES_APRIL_17_2006_1158PM)
-#define SPIRIT_REAL_POLICIES_APRIL_17_2006_1158PM
+#if !defined(BOOST_SPIRIT_X3_REAL_POLICIES_APRIL_17_2006_1158PM)
+#define BOOST_SPIRIT_X3_REAL_POLICIES_APRIL_17_2006_1158PM
#include <boost/spirit/home/x3/string/detail/string_parse.hpp>
#include <boost/spirit/home/x3/support/numeric_utils/extract_int.hpp>
@@ -112,7 +112,7 @@ namespace boost { namespace spirit { namespace x3
// nan[(...)] ?
if (detail::string_parse("nan", "NAN", first, last, unused))
{
- if (*first == '(')
+ if (first != last && *first == '(')
{
// skip trailing (...) part
Iterator i = first;
diff --git a/boost/spirit/home/x3/operator/alternative.hpp b/boost/spirit/home/x3/operator/alternative.hpp
index c3a1e40f3f..1a436e1e69 100644
--- a/boost/spirit/home/x3/operator/alternative.hpp
+++ b/boost/spirit/home/x3/operator/alternative.hpp
@@ -4,8 +4,8 @@
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(SPIRIT_ALTERNATIVE_JAN_07_2013_1131AM)
-#define SPIRIT_ALTERNATIVE_JAN_07_2013_1131AM
+#if !defined(BOOST_SPIRIT_X3_ALTERNATIVE_JAN_07_2013_1131AM)
+#define BOOST_SPIRIT_X3_ALTERNATIVE_JAN_07_2013_1131AM
#include <boost/spirit/home/x3/support/traits/attribute_of.hpp>
#include <boost/spirit/home/x3/core/parser.hpp>
diff --git a/boost/spirit/home/x3/operator/and_predicate.hpp b/boost/spirit/home/x3/operator/and_predicate.hpp
index 1d650f7521..0ee1652555 100644
--- a/boost/spirit/home/x3/operator/and_predicate.hpp
+++ b/boost/spirit/home/x3/operator/and_predicate.hpp
@@ -4,8 +4,8 @@
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(SPIRIT_AND_PREDICATE_MARCH_23_2007_0617PM)
-#define SPIRIT_AND_PREDICATE_MARCH_23_2007_0617PM
+#if !defined(BOOST_SPIRIT_X3_AND_PREDICATE_MARCH_23_2007_0617PM)
+#define BOOST_SPIRIT_X3_AND_PREDICATE_MARCH_23_2007_0617PM
#include <boost/spirit/home/x3/core/parser.hpp>
diff --git a/boost/spirit/home/x3/operator/detail/alternative.hpp b/boost/spirit/home/x3/operator/detail/alternative.hpp
index 0043710320..2c87fa0376 100644
--- a/boost/spirit/home/x3/operator/detail/alternative.hpp
+++ b/boost/spirit/home/x3/operator/detail/alternative.hpp
@@ -4,8 +4,8 @@
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(SPIRIT_ALTERNATIVE_DETAIL_JAN_07_2013_1245PM)
-#define SPIRIT_ALTERNATIVE_DETAIL_JAN_07_2013_1245PM
+#if !defined(BOOST_SPIRIT_X3_ALTERNATIVE_DETAIL_JAN_07_2013_1245PM)
+#define BOOST_SPIRIT_X3_ALTERNATIVE_DETAIL_JAN_07_2013_1245PM
#include <boost/spirit/home/x3/support/traits/attribute_of.hpp>
#include <boost/spirit/home/x3/support/traits/is_variant.hpp>
diff --git a/boost/spirit/home/x3/operator/detail/sequence.hpp b/boost/spirit/home/x3/operator/detail/sequence.hpp
index 2c804cc78a..2d3bfec4da 100644
--- a/boost/spirit/home/x3/operator/detail/sequence.hpp
+++ b/boost/spirit/home/x3/operator/detail/sequence.hpp
@@ -4,8 +4,8 @@
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(SPIRIT_SEQUENCE_DETAIL_JAN_06_2013_1015AM)
-#define SPIRIT_SEQUENCE_DETAIL_JAN_06_2013_1015AM
+#if !defined(BOOST_SPIRIT_X3_SEQUENCE_DETAIL_JAN_06_2013_1015AM)
+#define BOOST_SPIRIT_X3_SEQUENCE_DETAIL_JAN_06_2013_1015AM
#include <boost/spirit/home/x3/support/traits/attribute_of.hpp>
#include <boost/spirit/home/x3/support/traits/attribute_category.hpp>
@@ -13,11 +13,13 @@
#include <boost/spirit/home/x3/support/traits/has_attribute.hpp>
#include <boost/spirit/home/x3/support/traits/is_substitute.hpp>
#include <boost/spirit/home/x3/support/traits/container_traits.hpp>
+#include <boost/spirit/home/x3/support/traits/tuple_traits.hpp>
#include <boost/spirit/home/x3/core/detail/parse_into_container.hpp>
#include <boost/fusion/include/begin.hpp>
#include <boost/fusion/include/end.hpp>
#include <boost/fusion/include/advance.hpp>
+#include <boost/fusion/include/deref.hpp>
#include <boost/fusion/include/empty.hpp>
#include <boost/fusion/include/front.hpp>
#include <boost/fusion/include/iterator_range.hpp>
@@ -79,14 +81,16 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
};
template <typename Attribute>
- struct pass_sequence_attribute_front
+ struct pass_sequence_attribute_size_one_view
{
- typedef typename fusion::result_of::front<Attribute>::type type;
+ typedef typename fusion::result_of::deref<
+ typename fusion::result_of::begin<Attribute>::type
+ >::type type;
static typename add_reference<type>::type
call(Attribute& attr)
{
- return fusion::front(attr);
+ return fusion::deref(fusion::begin(attr));
}
};
@@ -103,30 +107,30 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
}
};
- template <typename Parser, typename Attribute, bool pass_through>
+ template <typename Parser, typename Attribute>
struct pass_sequence_attribute_used :
- mpl::if_c<
- (!pass_through && traits::is_size_one_sequence<Attribute>::value)
- , pass_sequence_attribute_front<Attribute>
+ mpl::if_<
+ traits::is_size_one_view<Attribute>
+ , pass_sequence_attribute_size_one_view<Attribute>
, pass_through_sequence_attribute<Attribute>>::type {};
- template <typename Parser, typename Attribute, bool pass_through = false, typename Enable = void>
+ template <typename Parser, typename Attribute, typename Enable = void>
struct pass_sequence_attribute :
mpl::if_<
fusion::result_of::empty<Attribute>
, pass_sequence_attribute_unused
- , pass_sequence_attribute_used<Parser, Attribute, pass_through>>::type {};
+ , pass_sequence_attribute_used<Parser, Attribute>>::type {};
- template <typename L, typename R, typename Attribute, bool pass_through>
- struct pass_sequence_attribute<sequence<L, R>, Attribute, pass_through>
+ template <typename L, typename R, typename Attribute>
+ struct pass_sequence_attribute<sequence<L, R>, Attribute>
: pass_through_sequence_attribute<Attribute> {};
template <typename Parser, typename Attribute>
struct pass_sequence_attribute_subject :
pass_sequence_attribute<typename Parser::subject_type, Attribute> {};
- template <typename Parser, typename Attribute, bool pass_through>
- struct pass_sequence_attribute<Parser, Attribute, pass_through
+ template <typename Parser, typename Attribute>
+ struct pass_sequence_attribute<Parser, Attribute
, typename enable_if_c<(Parser::is_pass_through_unary)>::type>
: pass_sequence_attribute_subject<Parser, Attribute> {};
@@ -150,8 +154,8 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
typedef typename fusion::result_of::end<Attribute>::type r_end;
typedef fusion::iterator_range<l_begin, l_end> l_part;
typedef fusion::iterator_range<l_end, r_end> r_part;
- typedef pass_sequence_attribute<L, l_part, false> l_pass;
- typedef pass_sequence_attribute<R, r_part, false> r_pass;
+ typedef pass_sequence_attribute<L, l_part> l_pass;
+ typedef pass_sequence_attribute<R, r_part> r_pass;
static l_part left(Attribute& s)
{
@@ -175,7 +179,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
typedef unused_type l_part;
typedef Attribute& r_part;
typedef pass_sequence_attribute_unused l_pass;
- typedef pass_sequence_attribute<R, Attribute, true> r_pass;
+ typedef pass_sequence_attribute<R, Attribute> r_pass;
static unused_type left(Attribute&)
{
@@ -195,7 +199,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
{
typedef Attribute& l_part;
typedef unused_type r_part;
- typedef pass_sequence_attribute<L, Attribute, true> l_pass;
+ typedef pass_sequence_attribute<L, Attribute> l_pass;
typedef pass_sequence_attribute_unused r_pass;
static Attribute& left(Attribute& s)
@@ -359,6 +363,26 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
return parse_sequence_plain(parser, first, last, context, rcontext, attr);
}
+ template <typename Parser, typename Iterator, typename Context
+ , typename RContext, typename Attribute>
+ bool parse_sequence(
+ Parser const& parser, Iterator& first, Iterator const& last
+ , Context const& context, RContext& rcontext, Attribute& attr
+ , traits::optional_attribute)
+ {
+ return parse_sequence_plain(parser, first, last, context, rcontext, attr);
+ }
+
+ template <typename Parser, typename Iterator, typename Context
+ , typename RContext, typename Attribute>
+ bool parse_sequence(
+ Parser const& parser, Iterator& first, Iterator const& last
+ , Context const& context, RContext& rcontext, Attribute& attr
+ , traits::range_attribute)
+ {
+ return parse_sequence_plain(parser, first, last, context, rcontext, attr);
+ }
+
template <typename Left, typename Right, typename Iterator
, typename Context, typename RContext, typename Attribute>
bool parse_sequence(
diff --git a/boost/spirit/home/x3/operator/difference.hpp b/boost/spirit/home/x3/operator/difference.hpp
index a75e713821..8ca2a96888 100644
--- a/boost/spirit/home/x3/operator/difference.hpp
+++ b/boost/spirit/home/x3/operator/difference.hpp
@@ -4,8 +4,8 @@
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(SPIRIT_DIFFERENCE_FEBRUARY_11_2007_1250PM)
-#define SPIRIT_DIFFERENCE_FEBRUARY_11_2007_1250PM
+#if !defined(BOOST_SPIRIT_X3_DIFFERENCE_FEBRUARY_11_2007_1250PM)
+#define BOOST_SPIRIT_X3_DIFFERENCE_FEBRUARY_11_2007_1250PM
#include <boost/spirit/home/x3/support/traits/attribute_of.hpp>
#include <boost/spirit/home/x3/support/traits/has_attribute.hpp>
diff --git a/boost/spirit/home/x3/operator/kleene.hpp b/boost/spirit/home/x3/operator/kleene.hpp
index b0fb5a1df1..1a9dcfaa56 100644
--- a/boost/spirit/home/x3/operator/kleene.hpp
+++ b/boost/spirit/home/x3/operator/kleene.hpp
@@ -5,8 +5,8 @@
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(SPIRIT_KLEENE_JANUARY_07_2007_0818AM)
-#define SPIRIT_KLEENE_JANUARY_07_2007_0818AM
+#if !defined(BOOST_SPIRIT_X3_KLEENE_JANUARY_07_2007_0818AM)
+#define BOOST_SPIRIT_X3_KLEENE_JANUARY_07_2007_0818AM
#include <boost/spirit/home/x3/core/parser.hpp>
#include <boost/spirit/home/x3/support/traits/container_traits.hpp>
diff --git a/boost/spirit/home/x3/operator/list.hpp b/boost/spirit/home/x3/operator/list.hpp
index 23b398b128..392a9646a1 100644
--- a/boost/spirit/home/x3/operator/list.hpp
+++ b/boost/spirit/home/x3/operator/list.hpp
@@ -5,8 +5,8 @@
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(SPIRIT_LIST_MARCH_24_2007_1031AM)
-#define SPIRIT_LIST_MARCH_24_2007_1031AM
+#if !defined(BOOST_SPIRIT_X3_LIST_MARCH_24_2007_1031AM)
+#define BOOST_SPIRIT_X3_LIST_MARCH_24_2007_1031AM
#include <boost/spirit/home/x3/core/parser.hpp>
#include <boost/spirit/home/x3/support/traits/container_traits.hpp>
diff --git a/boost/spirit/home/x3/operator/not_predicate.hpp b/boost/spirit/home/x3/operator/not_predicate.hpp
index d0302e6142..2fe6edab49 100644
--- a/boost/spirit/home/x3/operator/not_predicate.hpp
+++ b/boost/spirit/home/x3/operator/not_predicate.hpp
@@ -4,8 +4,8 @@
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(SPIRIT_NOT_PREDICATE_MARCH_23_2007_0618PM)
-#define SPIRIT_NOT_PREDICATE_MARCH_23_2007_0618PM
+#if !defined(BOOST_SPIRIT_X3_NOT_PREDICATE_MARCH_23_2007_0618PM)
+#define BOOST_SPIRIT_X3_NOT_PREDICATE_MARCH_23_2007_0618PM
#include <boost/spirit/home/x3/core/parser.hpp>
diff --git a/boost/spirit/home/x3/operator/optional.hpp b/boost/spirit/home/x3/operator/optional.hpp
index a40228849a..70beefef21 100644
--- a/boost/spirit/home/x3/operator/optional.hpp
+++ b/boost/spirit/home/x3/operator/optional.hpp
@@ -5,8 +5,8 @@
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(SPIRIT_OPTIONAL_MARCH_23_2007_1117PM)
-#define SPIRIT_OPTIONAL_MARCH_23_2007_1117PM
+#if !defined(BOOST_SPIRIT_X3_OPTIONAL_MARCH_23_2007_1117PM)
+#define BOOST_SPIRIT_X3_OPTIONAL_MARCH_23_2007_1117PM
#include <boost/spirit/home/x3/core/proxy.hpp>
#include <boost/spirit/home/x3/core/detail/parse_into_container.hpp>
diff --git a/boost/spirit/home/x3/operator/plus.hpp b/boost/spirit/home/x3/operator/plus.hpp
index 152731e622..caf7333892 100644
--- a/boost/spirit/home/x3/operator/plus.hpp
+++ b/boost/spirit/home/x3/operator/plus.hpp
@@ -5,8 +5,8 @@
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(SPIRIT_PLUS_MARCH_13_2007_0127PM)
-#define SPIRIT_PLUS_MARCH_13_2007_0127PM
+#if !defined(BOOST_SPIRIT_X3_PLUS_MARCH_13_2007_0127PM)
+#define BOOST_SPIRIT_X3_PLUS_MARCH_13_2007_0127PM
#include <boost/spirit/home/x3/core/parser.hpp>
#include <boost/spirit/home/x3/support/traits/container_traits.hpp>
diff --git a/boost/spirit/home/x3/operator/sequence.hpp b/boost/spirit/home/x3/operator/sequence.hpp
index 661a23cd37..ecf7f45e08 100644
--- a/boost/spirit/home/x3/operator/sequence.hpp
+++ b/boost/spirit/home/x3/operator/sequence.hpp
@@ -4,8 +4,8 @@
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(SPIRIT_SEQUENCE_JAN_06_2013_1015AM)
-#define SPIRIT_SEQUENCE_JAN_06_2013_1015AM
+#if !defined(BOOST_SPIRIT_X3_SEQUENCE_JAN_06_2013_1015AM)
+#define BOOST_SPIRIT_X3_SEQUENCE_JAN_06_2013_1015AM
#include <boost/spirit/home/x3/support/traits/attribute_of.hpp>
#include <boost/spirit/home/x3/core/parser.hpp>
diff --git a/boost/spirit/home/x3/support/ast/variant.hpp b/boost/spirit/home/x3/support/ast/variant.hpp
index 052e6e5f8a..e52e61a339 100644
--- a/boost/spirit/home/x3/support/ast/variant.hpp
+++ b/boost/spirit/home/x3/support/ast/variant.hpp
@@ -7,9 +7,10 @@
#if !defined(BOOST_SPIRIT_X3_VARIANT_AUGUST_6_2011_0859AM)
#define BOOST_SPIRIT_X3_VARIANT_AUGUST_6_2011_0859AM
+#include <boost/config.hpp>
#include <boost/variant.hpp>
#include <boost/mpl/list.hpp>
-#include <boost/type_traits/is_base_of.hpp>
+#include <utility>
#include <type_traits>
///////////////////////////////////////////////////////////////////////////////
@@ -29,7 +30,7 @@ namespace boost { namespace spirit { namespace x3
forward_ast(forward_ast const& operand)
: p_(new T(operand.get())) {}
- forward_ast(forward_ast&& operand)
+ forward_ast(forward_ast&& operand) BOOST_NOEXCEPT
: p_(operand.p_)
{
operand.p_ = 0;
@@ -46,7 +47,7 @@ namespace boost { namespace spirit { namespace x3
boost::checked_delete(p_);
}
- forward_ast& operator=(forward_ast const& rhs)
+ forward_ast& operator=(forward_ast const& rhs) BOOST_NOEXCEPT_IF(std::is_nothrow_copy_assignable<T>{})
{
assign(rhs.get());
return *this;
@@ -59,7 +60,7 @@ namespace boost { namespace spirit { namespace x3
p_ = temp;
}
- forward_ast& operator=(T const& rhs)
+ forward_ast& operator=(T const& rhs) BOOST_NOEXCEPT_IF(std::is_nothrow_copy_assignable<T>{})
{
assign(rhs);
return *this;
@@ -71,24 +72,24 @@ namespace boost { namespace spirit { namespace x3
return *this;
}
- forward_ast& operator=(T&& rhs)
+ forward_ast& operator=(T&& rhs) BOOST_NOEXCEPT_IF(std::is_nothrow_move_assignable<T>{})
{
get() = std::move(rhs);
return *this;
}
- T& get() { return *get_pointer(); }
- const T& get() const { return *get_pointer(); }
+ T& get() BOOST_NOEXCEPT { return *get_pointer(); }
+ const T& get() const BOOST_NOEXCEPT { return *get_pointer(); }
- T* get_pointer() { return p_; }
- const T* get_pointer() const { return p_; }
+ T* get_pointer() BOOST_NOEXCEPT { return p_; }
+ const T* get_pointer() const BOOST_NOEXCEPT { return p_; }
- operator T const&() const { return this->get(); }
- operator T&() { return this->get(); }
+ operator T const&() const BOOST_NOEXCEPT { return this->get(); }
+ operator T&() BOOST_NOEXCEPT { return this->get(); }
private:
- void assign(const T& rhs)
+ void assign(const T& rhs) BOOST_NOEXCEPT_IF(std::is_nothrow_copy_assignable<T>{})
{
this->get() = rhs;
}
@@ -135,46 +136,46 @@ namespace boost { namespace spirit { namespace x3
::value)
>;
- variant() : var() {}
+ variant() BOOST_NOEXCEPT_IF(std::is_nothrow_default_constructible<variant_type>{}) : var() {}
template <typename T, class = non_self_t<T>>
- explicit variant(T const& rhs)
+ explicit variant(T const& rhs) BOOST_NOEXCEPT_IF((std::is_nothrow_constructible<variant_type, T const&>{}))
: var(rhs) {}
template <typename T, class = non_self_t<T>>
- explicit variant(T&& rhs)
+ explicit variant(T&& rhs) BOOST_NOEXCEPT_IF((std::is_nothrow_constructible<variant_type, T&&>::value)) // `::value` is a workaround for the VS2015 bug
: var(std::forward<T>(rhs)) {}
- variant(variant const& rhs)
+ variant(variant const& rhs) BOOST_NOEXCEPT_IF(std::is_nothrow_copy_constructible<variant_type>{})
: var(rhs.var) {}
- variant(variant& rhs)
+ variant(variant& rhs) BOOST_NOEXCEPT_IF((std::is_nothrow_constructible<variant_type, variant_type&>{}))
: var(rhs.var) {}
- variant(variant&& rhs)
- : var(std::forward<variant_type>(rhs.var)) {}
+ variant(variant&& rhs) BOOST_NOEXCEPT_IF(std::is_nothrow_move_constructible<variant_type>{})
+ : var(std::move(rhs.var)) {}
- variant& operator=(variant const& rhs)
+ variant& operator=(variant const& rhs) BOOST_NOEXCEPT_IF(std::is_nothrow_copy_assignable<variant_type>{})
{
var = rhs.get();
return *this;
}
- variant& operator=(variant&& rhs)
+ variant& operator=(variant&& rhs) BOOST_NOEXCEPT_IF(std::is_nothrow_move_assignable<variant_type>{})
{
- var = std::forward<variant_type>(rhs.get());
+ var = std::move(rhs.get());
return *this;
}
template <typename T, class = non_self_t<T>>
- variant& operator=(T const& rhs)
+ variant& operator=(T const& rhs) BOOST_NOEXCEPT_IF((std::is_nothrow_assignable<variant_type, T const&>{}))
{
var = rhs;
return *this;
}
template <typename T, class = non_self_t<T>>
- variant& operator=(T&& rhs)
+ variant& operator=(T&& rhs) BOOST_NOEXCEPT_IF((std::is_nothrow_assignable<variant_type, T&&>::value)) // `::value` is a workaround for the VS2015 bug
{
var = std::forward<T>(rhs);
return *this;
@@ -204,12 +205,12 @@ namespace boost { namespace spirit { namespace x3
return var.apply_visitor(v);
}
- variant_type const& get() const
+ variant_type const& get() const BOOST_NOEXCEPT
{
return var;
}
- variant_type& get()
+ variant_type& get() BOOST_NOEXCEPT
{
return var;
}
@@ -227,28 +228,28 @@ namespace boost
{
template <typename T, typename ...Types>
inline T const&
- get(boost::spirit::x3::variant<Types...> const& x)
+ get(boost::spirit::x3::variant<Types...> const& x) BOOST_NOEXCEPT
{
return boost::get<T>(x.get());
}
template <typename T, typename ...Types>
inline T&
- get(boost::spirit::x3::variant<Types...>& x)
+ get(boost::spirit::x3::variant<Types...>& x) BOOST_NOEXCEPT
{
return boost::get<T>(x.get());
}
template <typename T, typename ...Types>
inline T const*
- get(boost::spirit::x3::variant<Types...> const* x)
+ get(boost::spirit::x3::variant<Types...> const* x) BOOST_NOEXCEPT
{
return boost::get<T>(&x->get());
}
template <typename T, typename ...Types>
inline T*
- get(boost::spirit::x3::variant<Types...>* x)
+ get(boost::spirit::x3::variant<Types...>* x) BOOST_NOEXCEPT
{
return boost::get<T>(&x->get());
}
diff --git a/boost/spirit/home/x3/support/numeric_utils/detail/extract_int.hpp b/boost/spirit/home/x3/support/numeric_utils/detail/extract_int.hpp
index 4ebd66f182..2115903e6c 100644
--- a/boost/spirit/home/x3/support/numeric_utils/detail/extract_int.hpp
+++ b/boost/spirit/home/x3/support/numeric_utils/detail/extract_int.hpp
@@ -474,35 +474,6 @@ namespace boost { namespace spirit { namespace x3 { 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;
- }
- };
}}}}
#endif
diff --git a/boost/spirit/home/x3/support/numeric_utils/extract_int.hpp b/boost/spirit/home/x3/support/numeric_utils/extract_int.hpp
index 621275f4c8..6e59d42bd1 100644
--- a/boost/spirit/home/x3/support/numeric_utils/extract_int.hpp
+++ b/boost/spirit/home/x3/support/numeric_utils/extract_int.hpp
@@ -62,8 +62,7 @@ namespace boost { namespace spirit { namespace x3
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/x3/support/numeric_utils/extract_real.hpp b/boost/spirit/home/x3/support/numeric_utils/extract_real.hpp
index ea1f0df949..9749fbec1f 100644
--- a/boost/spirit/home/x3/support/numeric_utils/extract_real.hpp
+++ b/boost/spirit/home/x3/support/numeric_utils/extract_real.hpp
@@ -6,8 +6,8 @@
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(SPIRIT_EXTRACT_REAL_APRIL_18_2006_0901AM)
-#define SPIRIT_EXTRACT_REAL_APRIL_18_2006_0901AM
+#if !defined(BOOST_SPIRIT_X3_EXTRACT_REAL_APRIL_18_2006_0901AM)
+#define BOOST_SPIRIT_X3_EXTRACT_REAL_APRIL_18_2006_0901AM
#include <cmath>
#include <boost/limits.hpp>
@@ -180,6 +180,7 @@ namespace boost { namespace spirit { namespace x3
if (!is_same<T, unused_type>::value)
frac_digits =
static_cast<int>(std::distance(savef, first));
+ BOOST_ASSERT(frac_digits >= 0);
}
else if (!got_a_number || !p.allow_trailing_dot)
{
diff --git a/boost/spirit/home/x3/support/numeric_utils/sign.hpp b/boost/spirit/home/x3/support/numeric_utils/sign.hpp
index 2ee4142de6..3ca326f3ec 100644
--- a/boost/spirit/home/x3/support/numeric_utils/sign.hpp
+++ b/boost/spirit/home/x3/support/numeric_utils/sign.hpp
@@ -6,8 +6,8 @@
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(SPIRIT_SIGN_MAR_11_2009_0734PM)
-#define SPIRIT_SIGN_MAR_11_2009_0734PM
+#if !defined(BOOST_SPIRIT_X3_SIGN_MAR_11_2009_0734PM)
+#define BOOST_SPIRIT_X3_SIGN_MAR_11_2009_0734PM
#include <boost/config/no_tr1/cmath.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
diff --git a/boost/spirit/home/x3/support/traits/attribute_category.hpp b/boost/spirit/home/x3/support/traits/attribute_category.hpp
index 53e806c613..fdca18fb71 100644
--- a/boost/spirit/home/x3/support/traits/attribute_category.hpp
+++ b/boost/spirit/home/x3/support/traits/attribute_category.hpp
@@ -15,7 +15,9 @@
#include <boost/fusion/include/is_sequence.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/spirit/home/x3/support/traits/is_variant.hpp>
+#include <boost/spirit/home/x3/support/traits/is_range.hpp>
#include <boost/spirit/home/x3/support/traits/container_traits.hpp>
+#include <boost/spirit/home/x3/support/traits/optional_traits.hpp>
namespace boost { namespace spirit { namespace x3
{
@@ -31,6 +33,7 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
struct associative_attribute {};
struct variant_attribute {};
struct optional_attribute {};
+ struct range_attribute {};
template <typename T, typename Enable = void>
struct attribute_category
@@ -46,21 +49,21 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
template <typename T>
struct attribute_category< T
- , typename enable_if<
- typename mpl::eval_if<
- fusion::traits::is_sequence<T>
- , fusion::traits::is_associative<T>
- , mpl::false_
- >::type >::type >
+ , typename enable_if<
+ typename mpl::eval_if<
+ fusion::traits::is_sequence<T>
+ , fusion::traits::is_associative<T>
+ , mpl::false_
+ >::type >::type >
: mpl::identity<associative_attribute> {};
template <typename T>
struct attribute_category< T
- , typename enable_if<
- mpl::and_<
- fusion::traits::is_sequence<T>
- , mpl::not_<fusion::traits::is_associative<T> >
- > >::type >
+ , typename enable_if<
+ mpl::and_<
+ fusion::traits::is_sequence<T>
+ , mpl::not_<fusion::traits::is_associative<T> >
+ > >::type >
: mpl::identity<tuple_attribute> {};
template <typename T>
@@ -70,7 +73,22 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
template <typename T>
struct attribute_category<T,
- typename enable_if<traits::is_container<T>>::type>
+ typename enable_if<traits::is_optional<T>>::type>
+ : mpl::identity<optional_attribute> {};
+
+ template <typename T>
+ struct attribute_category<T,
+ typename enable_if<traits::is_range<T>>::type>
+ : mpl::identity<range_attribute> {};
+
+ template <typename T>
+ struct attribute_category< T
+ , typename enable_if<
+ mpl::and_<
+ traits::is_container<T>
+ , mpl::not_<fusion::traits::is_sequence<T> >
+ , mpl::not_<traits::is_range<T> >
+ > >::type >
: mpl::identity<container_attribute> {};
}}}}
diff --git a/boost/spirit/home/x3/support/traits/container_traits.hpp b/boost/spirit/home/x3/support/traits/container_traits.hpp
index 7dcf798958..f2d1086dd2 100644
--- a/boost/spirit/home/x3/support/traits/container_traits.hpp
+++ b/boost/spirit/home/x3/support/traits/container_traits.hpp
@@ -14,7 +14,6 @@
#include <boost/detail/iterator.hpp>
#include <boost/fusion/include/deque.hpp>
#include <boost/tti/has_type.hpp>
-#include <boost/tti/has_member_function.hpp>
#include <boost/mpl/identity.hpp>
#include <vector>
@@ -35,7 +34,6 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
BOOST_TTI_HAS_TYPE(size_type)
BOOST_TTI_HAS_TYPE(reference)
BOOST_TTI_HAS_TYPE(key_type)
- BOOST_TTI_HAS_MEMBER_FUNCTION(reserve)
}
template <typename T>
@@ -49,9 +47,12 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
using is_associative = mpl::bool_<
detail::has_type_key_type<T>::value>;
- template <typename T>
- using is_reservable = mpl::bool_<
- detail::has_member_function_reserve<T, void, mpl::vector<size_t>>::value>;
+ template<typename T, typename Enable = void>
+ struct is_reservable : mpl::false_ {};
+
+ template<typename T>
+ struct is_reservable<T, decltype(std::declval<T&>().reserve(0))>
+ : mpl::true_ {};
///////////////////////////////////////////////////////////////////////////
namespace detail
diff --git a/boost/spirit/home/x3/support/traits/is_range.hpp b/boost/spirit/home/x3/support/traits/is_range.hpp
new file mode 100644
index 0000000000..5995eee39e
--- /dev/null
+++ b/boost/spirit/home/x3/support/traits/is_range.hpp
@@ -0,0 +1,27 @@
+/*=============================================================================
+ Copyright (c) 2001-2014 Joel de Guzman
+ http://spirit.sourceforge.net/
+
+ 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_X3_IS_RANGE_DEC_06_2017_1900PM)
+#define BOOST_SPIRIT_X3_IS_RANGE_DEC_06_2017_1900PM
+
+#include <boost/range/iterator_range.hpp>
+#include <boost/mpl/bool.hpp>
+
+namespace boost { namespace spirit { namespace x3 { namespace traits
+{
+ template <typename T, typename Enable = void>
+ struct is_range
+ : mpl::false_
+ {};
+
+ template <typename T>
+ struct is_range<boost::iterator_range<T>>
+ : mpl::true_
+ {};
+}}}}
+
+#endif
diff --git a/boost/spirit/home/x3/support/traits/move_to.hpp b/boost/spirit/home/x3/support/traits/move_to.hpp
index 2e3665bd0b..2275182f2c 100644
--- a/boost/spirit/home/x3/support/traits/move_to.hpp
+++ b/boost/spirit/home/x3/support/traits/move_to.hpp
@@ -17,7 +17,6 @@
#include <boost/fusion/include/size.hpp>
#include <boost/fusion/include/move.hpp>
#include <boost/fusion/include/is_sequence.hpp>
-#include <boost/range/iterator_range.hpp>
#include <utility>
namespace boost { namespace spirit { namespace x3 { namespace traits
@@ -152,6 +151,13 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
move_to(src, dest, tag, is_size_one_sequence<Source>());
}
+ template <typename Source, typename Dest>
+ inline void
+ move_to(Source&& src, Dest& dest, optional_attribute)
+ {
+ dest = std::move(src);
+ }
+
template <typename Iterator>
inline void
move_to(Iterator, Iterator, unused_type, unused_attribute) {}
@@ -165,10 +171,19 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
else
append(dest, first, last);
}
+
+ template <typename Iterator, typename Dest>
+ inline typename enable_if<
+ is_size_one_sequence<Dest>
+ >::type
+ move_to(Iterator first, Iterator last, Dest& dest, tuple_attribute)
+ {
+ traits::move_to(first, last, fusion::front(dest));
+ }
template <typename Iterator>
inline void
- move_to(Iterator first, Iterator last, boost::iterator_range<Iterator>& rng, container_attribute)
+ move_to(Iterator first, Iterator last, boost::iterator_range<Iterator>& rng, range_attribute)
{
rng = {first, last};
}
diff --git a/boost/spirit/home/x3/support/traits/tuple_traits.hpp b/boost/spirit/home/x3/support/traits/tuple_traits.hpp
index 46e4246b74..20e88de663 100644
--- a/boost/spirit/home/x3/support/traits/tuple_traits.hpp
+++ b/boost/spirit/home/x3/support/traits/tuple_traits.hpp
@@ -8,6 +8,7 @@
#define BOOST_SPIRIT_X3_TUPLE_TRAITS_JANUARY_2012_1132PM
#include <boost/fusion/include/is_sequence.hpp>
+#include <boost/fusion/include/is_view.hpp>
#include <boost/fusion/include/size.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/and.hpp>
@@ -43,6 +44,14 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
, has_size<Seq, 1>
>
{};
+
+ template <typename View>
+ struct is_size_one_view
+ : mpl::and_<
+ fusion::traits::is_view<View>
+ , has_size<View, 1>
+ >
+ {};
}}}}
#endif
diff --git a/boost/spirit/home/x3/support/utility/error_reporting.hpp b/boost/spirit/home/x3/support/utility/error_reporting.hpp
index 51ac403728..69815a232a 100644
--- a/boost/spirit/home/x3/support/utility/error_reporting.hpp
+++ b/boost/spirit/home/x3/support/utility/error_reporting.hpp
@@ -178,7 +178,7 @@ namespace boost { namespace spirit { namespace x3
if (prev != '\r') ++line;
break;
case '\r':
- if (prev != '\n') ++line;
+ ++line;
break;
default:
break;
diff --git a/boost/spirit/home/x3/version.hpp b/boost/spirit/home/x3/version.hpp
index 3add2f4149..99c69696ac 100644
--- a/boost/spirit/home/x3/version.hpp
+++ b/boost/spirit/home/x3/version.hpp
@@ -14,6 +14,6 @@
// This is the version of the current Spirit X3 distribution
//
///////////////////////////////////////////////////////////////////////////////
-#define SPIRIT_X3_VERSION 0x3000
+#define SPIRIT_X3_VERSION 0x3001
#endif