summaryrefslogtreecommitdiff
path: root/boost/spirit/home/x3
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2019-12-05 15:12:59 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2019-12-05 15:12:59 +0900
commitb8cf34c691623e4ec329053cbbf68522a855882d (patch)
tree34da08632a99677f6b79ecb65e5b655a5b69a67f /boost/spirit/home/x3
parent3fdc3e5ee96dca5b11d1694975a65200787eab86 (diff)
downloadboost-upstream/1.67.0.tar.gz
boost-upstream/1.67.0.tar.bz2
boost-upstream/1.67.0.zip
Imported Upstream version 1.67.0upstream/1.67.0
Diffstat (limited to 'boost/spirit/home/x3')
-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
44 files changed, 281 insertions, 217 deletions
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