diff options
Diffstat (limited to 'boost/spirit')
42 files changed, 294 insertions, 144 deletions
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 002d221eeb..f5b187d14b 100644 --- a/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp +++ b/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp @@ -15,7 +15,7 @@ #include <boost/spirit/home/classic/core/non_terminal/impl/object_with_id.ipp> #include <algorithm> #include <functional> -#include <memory> // for std::auto_ptr +#include <boost/move/unique_ptr.hpp> #include <boost/weak_ptr.hpp> #endif @@ -156,7 +156,7 @@ struct grammar_definition if (definitions[id]!=0) return *definitions[id]; - std::auto_ptr<definition_t> + boost::movelib::unique_ptr<definition_t> result(new definition_t(target_grammar->derived())); #ifdef BOOST_SPIRIT_THREADSAFE @@ -286,18 +286,10 @@ struct grammar_definition helper_list_t& helpers = grammartract_helper_list::do_(self); -# if defined(BOOST_INTEL_CXX_VERSION) typedef typename helper_list_t::vector_t::reverse_iterator iterator_t; for (iterator_t i = helpers.rbegin(); i != helpers.rend(); ++i) (*i)->undefine(self); -# else - typedef impl::grammar_helper_base<GrammarT> helper_base_t; - - std::for_each(helpers.rbegin(), helpers.rend(), - std::bind2nd(std::mem_fun(&helper_base_t::undefine), self)); -# endif - #else (void)self; #endif diff --git a/boost/spirit/home/classic/error_handling/exceptions.hpp b/boost/spirit/home/classic/error_handling/exceptions.hpp index c2e0c86983..0fb036a205 100644 --- a/boost/spirit/home/classic/error_handling/exceptions.hpp +++ b/boost/spirit/home/classic/error_handling/exceptions.hpp @@ -140,7 +140,6 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN parse(ScannerT const& scan) const { typedef typename parser_result<ParserT, ScannerT>::type result_t; - typedef typename ScannerT::iterator_t iterator_t; result_t hit = this->subject().parse(scan); if (!hit) diff --git a/boost/spirit/home/classic/phoenix/special_ops.hpp b/boost/spirit/home/classic/phoenix/special_ops.hpp index 4a007b23ae..12bf4b70fe 100644 --- a/boost/spirit/home/classic/phoenix/special_ops.hpp +++ b/boost/spirit/home/classic/phoenix/special_ops.hpp @@ -30,18 +30,6 @@ #endif /////////////////////////////////////////////////////////////////////////////// -//#if !defined(PHOENIX_NO_STD_NAMESPACE) -namespace PHOENIX_STD -{ -//#endif - - template<typename T> class complex; - -//#if !defined(PHOENIX_NO_STD_NAMESPACE) -} -//#endif - -/////////////////////////////////////////////////////////////////////////////// namespace phoenix { diff --git a/boost/spirit/home/classic/symbols/impl/tst.ipp b/boost/spirit/home/classic/symbols/impl/tst.ipp index 1a4a0c1052..60932c94ce 100644 --- a/boost/spirit/home/classic/symbols/impl/tst.ipp +++ b/boost/spirit/home/classic/symbols/impl/tst.ipp @@ -10,7 +10,7 @@ #define BOOST_SPIRIT_TST_IPP /////////////////////////////////////////////////////////////////////////////// -#include <memory> // for std::auto_ptr +#include <boost/move/unique_ptr.hpp> #include <boost/spirit/home/classic/core/assert.hpp> /////////////////////////////////////////////////////////////////////////////// @@ -62,7 +62,7 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN tst_node* clone() const { - std::auto_ptr<tst_node> copy(new tst_node(value)); + boost::movelib::unique_ptr<tst_node> copy(new tst_node(value)); if (left) copy->left = left->clone(); @@ -75,7 +75,7 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN } else { - std::auto_ptr<T> mid_data(new T(*middle.data)); + boost::movelib::unique_ptr<T> mid_data(new T(*middle.data)); copy->middle.data = mid_data.release(); } diff --git a/boost/spirit/home/karma/auxiliary/lazy.hpp b/boost/spirit/home/karma/auxiliary/lazy.hpp index 32d55fa49a..49cdf12d81 100644 --- a/boost/spirit/home/karma/auxiliary/lazy.hpp +++ b/boost/spirit/home/karma/auxiliary/lazy.hpp @@ -59,7 +59,7 @@ namespace boost { namespace spirit { namespace karma , typename Delimiter, typename Attribute> bool lazy_generate_impl(Generator const& g, OutputIterator& sink , Context& context, Delimiter const& delim - , Attribute const& attr, mpl::true_) + , Attribute const& /* attr */, mpl::true_) { // If DeducedAuto is false (semantic actions is present), the // component's attribute is unused. diff --git a/boost/spirit/home/karma/nonterminal/rule.hpp b/boost/spirit/home/karma/nonterminal/rule.hpp index 99d195fa5f..ab7db1265d 100644 --- a/boost/spirit/home/karma/nonterminal/rule.hpp +++ b/boost/spirit/home/karma/nonterminal/rule.hpp @@ -178,7 +178,7 @@ namespace boost { namespace spirit { namespace karma } template <typename Auto, typename Expr> - static void define(rule& lhs, Expr const& expr, mpl::false_) + static void define(rule& /* lhs */, Expr const& /* expr */, mpl::false_) { // Report invalid expression error as early as possible. // If you got an error_invalid_expression error message here, diff --git a/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp b/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp index 2ce7b743ad..a36893e57e 100644 --- a/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp +++ b/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp @@ -68,7 +68,7 @@ namespace boost { namespace spirit { namespace traits typedef unsignedtype type; \ static type call(signedtype n) \ { \ - return (n >= 0) ? n : (unsignedtype)(-n); \ + return static_cast<unsignedtype>((n >= 0) ? n : -n); \ } \ } \ /**/ @@ -285,7 +285,7 @@ namespace boost { namespace spirit { namespace traits { static bool call(T n) { - if (!std::numeric_limits<T>::has_infinity) + if (!std::numeric_limits<T>::has_infinity) return false; return (n == std::numeric_limits<T>::infinity()) ? true : false; } @@ -771,4 +771,3 @@ namespace boost { namespace spirit { namespace karma }}} #endif - diff --git a/boost/spirit/home/lex/lexer/lexertl/functor.hpp b/boost/spirit/home/lex/lexer/lexertl/functor.hpp index 79e5f073b4..d7b22413a8 100644 --- a/boost/spirit/home/lex/lexer/lexertl/functor.hpp +++ b/boost/spirit/home/lex/lexer/lexertl/functor.hpp @@ -98,11 +98,7 @@ namespace boost { namespace spirit { namespace lex { namespace lexertl }; public: - functor() -#if defined(__PGI) - : eof() -#endif - {} + functor() {} #if BOOST_WORKAROUND(BOOST_MSVC, <= 1310) // somehow VC7.1 needs this (meaningless) assignment operator diff --git a/boost/spirit/home/lex/qi/plain_token.hpp b/boost/spirit/home/lex/qi/plain_token.hpp index b77e2a9548..11961e3464 100644 --- a/boost/spirit/home/lex/qi/plain_token.hpp +++ b/boost/spirit/home/lex/qi/plain_token.hpp @@ -159,7 +159,7 @@ namespace boost { namespace spirit { namespace qi typedef typename token_type::id_type id_type; token_type const& t = *first; - if (id_type(idmin) >= t.id() && id_type(idmin) <= t.id()) + if (id_type(idmax) >= t.id() && id_type(idmin) <= t.id()) { spirit::traits::assign_to(t, attr); ++first; diff --git a/boost/spirit/home/qi/detail/alternative_function.hpp b/boost/spirit/home/qi/detail/alternative_function.hpp index 0c400a90d4..88f6dad9a0 100644 --- a/boost/spirit/home/qi/detail/alternative_function.hpp +++ b/boost/spirit/home/qi/detail/alternative_function.hpp @@ -23,7 +23,7 @@ namespace boost { namespace spirit { namespace qi { namespace detail template <typename Variant, typename Expected> struct find_substitute { - // Get the typr from the variant that can be a substitute for Expected. + // Get the type from the variant that can be a substitute for Expected. // If none is found, just return Expected typedef Variant variant_type; @@ -138,8 +138,9 @@ 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, spirit::traits::not_is_variant<Attribute, qi::domain>()); + component, mpl::not_<spirit::traits::not_is_optional<Attribute, qi::domain> >()); } template <typename Component> diff --git a/boost/spirit/home/qi/detail/construct.hpp b/boost/spirit/home/qi/detail/construct.hpp index 5d8122f6a5..829190e98e 100644 --- a/boost/spirit/home/qi/detail/construct.hpp +++ b/boost/spirit/home/qi/detail/construct.hpp @@ -143,20 +143,20 @@ namespace boost { namespace spirit { namespace traits #ifdef BOOST_HAS_LONG_LONG template <typename Iterator> - struct assign_to_attribute_from_iterators<long_long_type, Iterator> + struct assign_to_attribute_from_iterators<boost::long_long_type, Iterator> { static void - call(Iterator const& first, Iterator const& last, long_long_type& attr) + call(Iterator const& first, Iterator const& last, boost::long_long_type& attr) { Iterator first_ = first; qi::parse(first_, last, long_long_type(), attr); } }; template <typename Iterator> - struct assign_to_attribute_from_iterators<ulong_long_type, Iterator> + struct assign_to_attribute_from_iterators<boost::ulong_long_type, Iterator> { static void - call(Iterator const& first, Iterator const& last, ulong_long_type& attr) + call(Iterator const& first, Iterator const& last, boost::ulong_long_type& attr) { Iterator first_ = first; qi::parse(first_, last, ulong_long_type(), attr); diff --git a/boost/spirit/home/qi/detail/expectation_failure.hpp b/boost/spirit/home/qi/detail/expectation_failure.hpp new file mode 100644 index 0000000000..3571e2f3f1 --- /dev/null +++ b/boost/spirit/home/qi/detail/expectation_failure.hpp @@ -0,0 +1,34 @@ +/*============================================================================= +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(SPIRIT_EXPECTATION_FAILURE_JULY_19_2016) +#define SPIRIT_EXPECTATION_FAILURE_JULY_19_2016 + +#if defined(_MSC_VER) +#pragma once +#endif + +#include <boost/spirit/home/support/info.hpp> + +#include <stdexcept> + +namespace boost { namespace spirit { namespace qi { + template <typename Iterator> + struct expectation_failure : std::runtime_error + { + expectation_failure(Iterator first_, Iterator last_, info const& what) + : std::runtime_error("boost::spirit::qi::expectation_failure") + , first(first_), last(last_), what_(what) + {} + ~expectation_failure() throw() {} + + Iterator first; + Iterator last; + info what_; + }; +}}} + +#endif diff --git a/boost/spirit/home/qi/directive.hpp b/boost/spirit/home/qi/directive.hpp index 6d97ce491d..71e56f4efd 100644 --- a/boost/spirit/home/qi/directive.hpp +++ b/boost/spirit/home/qi/directive.hpp @@ -22,5 +22,6 @@ #include <boost/spirit/home/qi/directive/raw.hpp> #include <boost/spirit/home/qi/directive/repeat.hpp> #include <boost/spirit/home/qi/directive/skip.hpp> +#include <boost/spirit/home/qi/directive/expect.hpp> #endif diff --git a/boost/spirit/home/qi/directive/expect.hpp b/boost/spirit/home/qi/directive/expect.hpp new file mode 100644 index 0000000000..7892c9c32d --- /dev/null +++ b/boost/spirit/home/qi/directive/expect.hpp @@ -0,0 +1,113 @@ +/*============================================================================= +Copyright (c) 2016 Frank Hein, maxence business consulting gmbh + +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_JULY_13_2016) +#define SPIRIT_EXPECT_JULY_13_2016 + +#if defined(_MSC_VER) +#pragma once +#endif + +#include <boost/spirit/home/qi/meta_compiler.hpp> +#include <boost/spirit/home/support/has_semantic_action.hpp> +#include <boost/spirit/home/qi/detail/attributes.hpp> +#include <boost/spirit/home/qi/detail/expectation_failure.hpp> +#include <boost/spirit/home/support/common_terminals.hpp> +#include <boost/spirit/home/support/handles_container.hpp> +#include <boost/spirit/home/support/unused.hpp> +#include <boost/spirit/home/support/info.hpp> + +namespace boost { namespace spirit { + /////////////////////////////////////////////////////////////////////////// + // Enablers + /////////////////////////////////////////////////////////////////////////// + template <> + struct use_directive<qi::domain, tag::expect> // enables expect[p] + : mpl::true_ {}; +}} + +namespace boost { namespace spirit { namespace qi { + +#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS + using spirit::expect; +#endif + using spirit::expect_type; + + template <typename Subject> + struct expect_directive : unary_parser<expect_directive<Subject> > + { + typedef result_of::compile<domain, Subject> subject_type; + + template <typename Context, typename Iterator> + struct attribute + { + typedef traits::attribute_of<subject_type, Context, Iterator> + type; + }; + + expect_directive(Subject const& subject_) : subject(subject_) {} + + template <typename Iterator, typename Context + , typename Skipper, typename Attribute> + bool parse(Iterator& first, Iterator const& last + , Context& context, Skipper const& skipper + , Attribute& attr_) const + { + typedef expectation_failure<Iterator> exception; + + if (!subject.parse(first, last, context, skipper, attr_)) + { + boost::throw_exception( + exception(first, last, subject.what(context))); +#if defined(BOOST_NO_EXCEPTIONS) + return false; // for systems not supporting exceptions +#endif + } + return true; + } + + template <typename Context> + info what(Context& context) const + { + return info("expect", subject.what(context)); + } + + Subject subject; + }; + + /////////////////////////////////////////////////////////////////////////// + // Parser generators: make_xxx function (objects) + /////////////////////////////////////////////////////////////////////////// + template <typename Subject, typename Modifiers> + struct make_directive<tag::expect, Subject, Modifiers> + { + typedef expect_directive<Subject> result_type; + + result_type operator() + (unused_type, Subject const& subject, unused_type) const + { + return result_type(subject); + } + }; + +}}} + +namespace boost { namespace spirit { namespace traits { + /////////////////////////////////////////////////////////////////////////// + template <typename Subject> + struct has_semantic_action<qi::expect_directive<Subject> > + : unary_has_semantic_action<Subject> {}; + + /////////////////////////////////////////////////////////////////////////// + template <typename Subject, typename Attribute + , typename Context, typename Iterator> + struct handles_container< + qi::expect_directive<Subject>, Attribute, Context, Iterator + > + : unary_handles_container<Subject, Attribute, Context, Iterator> {}; +}}} + +#endif diff --git a/boost/spirit/home/qi/nonterminal/debug_handler.hpp b/boost/spirit/home/qi/nonterminal/debug_handler.hpp index 6a9f536699..b7bab6fe6d 100644 --- a/boost/spirit/home/qi/nonterminal/debug_handler.hpp +++ b/boost/spirit/home/qi/nonterminal/debug_handler.hpp @@ -14,7 +14,7 @@ #include <boost/spirit/home/support/unused.hpp> #include <boost/spirit/home/qi/nonterminal/rule.hpp> #include <boost/spirit/home/qi/nonterminal/debug_handler_state.hpp> -#include <boost/spirit/home/qi/operator/expect.hpp> +#include <boost/spirit/home/qi/detail/expectation_failure.hpp> #include <boost/function.hpp> #include <boost/fusion/include/at.hpp> #include <boost/fusion/include/vector.hpp> diff --git a/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp b/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp index ce9ad0f953..7f466ee65b 100644 --- a/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp +++ b/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp @@ -278,14 +278,20 @@ namespace boost { namespace spirit { namespace qi { namespace detail #define SPIRIT_NUMERIC_INNER_LOOP(z, x, data) \ if (!check_max_digits<MaxDigits>::call(count + leading_zeros) \ || it == last) \ + { \ break; \ + } \ ch = *it; \ if (!radix_check::is_valid(ch)) \ + { \ break; \ + } \ if (!extractor::call(ch, count, val)) \ { \ if (IgnoreOverflowDigits) \ + { \ first = it; \ + } \ traits::assign_to(val, attr); \ return IgnoreOverflowDigits; \ } \ @@ -386,10 +392,14 @@ namespace boost { namespace spirit { namespace qi { namespace detail /////////////////////////////////////////////////////////////////////////// #define SPIRIT_NUMERIC_INNER_LOOP(z, x, data) \ if (it == last) \ + { \ break; \ + } \ ch = *it; \ if (!radix_check::is_valid(ch)) \ + { \ break; \ + } \ if (!extractor::call(ch, count, val)) \ { \ traits::assign_to(val, attr); \ diff --git a/boost/spirit/home/qi/numeric/detail/real_impl.hpp b/boost/spirit/home/qi/numeric/detail/real_impl.hpp index 485df2727f..9aa5bb8bbd 100644 --- a/boost/spirit/home/qi/numeric/detail/real_impl.hpp +++ b/boost/spirit/home/qi/numeric/detail/real_impl.hpp @@ -32,7 +32,7 @@ namespace boost { namespace spirit { namespace traits { using spirit::traits::pow10; - + namespace detail { template <typename T, typename AccT> @@ -44,14 +44,14 @@ namespace boost { namespace spirit { namespace traits n = T((acc_n / comp) * comp); n += T(acc_n % comp); } - + template <typename T, typename AccT> void compensate_roundoff(T& n, AccT acc_n, mpl::false_) { // no need to compensate n = acc_n; } - + template <typename T, typename AccT> void compensate_roundoff(T& n, AccT acc_n) { @@ -66,7 +66,7 @@ namespace boost { namespace spirit { namespace traits if (exp >= 0) { int max_exp = std::numeric_limits<T>::max_exponent10; - + // return false if exp exceeds the max_exp // do this check only for primitive types! if (is_floating_point<T>() && exp > max_exp) @@ -80,7 +80,7 @@ namespace boost { namespace spirit { namespace traits int min_exp = std::numeric_limits<T>::min_exponent10; detail::compensate_roundoff(n, acc_n); n /= pow10<T>(-min_exp); - + // return false if (-exp + min_exp) exceeds the -min_exp // do this check only for primitive types! if (is_floating_point<T>() && (-exp + min_exp) > -min_exp) @@ -284,7 +284,8 @@ namespace boost { namespace spirit { namespace qi { namespace detail // If there is no number, disregard the exponent altogether. // by resetting 'first' prior to the exponent prefix (e|E) first = e_pos; - n = static_cast<T>(acc_n); + // Scale the number by -frac_digits. + traits::scale(-frac_digits, n, acc_n); } } else if (frac_digits) diff --git a/boost/spirit/home/qi/operator/expect.hpp b/boost/spirit/home/qi/operator/expect.hpp index ff279fd5d1..540372c33f 100644 --- a/boost/spirit/home/qi/operator/expect.hpp +++ b/boost/spirit/home/qi/operator/expect.hpp @@ -14,11 +14,11 @@ #include <boost/spirit/home/qi/operator/sequence_base.hpp> #include <boost/spirit/home/qi/detail/expect_function.hpp> +#include <boost/spirit/home/qi/detail/expectation_failure.hpp> #include <boost/spirit/home/qi/meta_compiler.hpp> #include <boost/spirit/home/support/has_semantic_action.hpp> #include <boost/spirit/home/support/handles_container.hpp> #include <boost/spirit/home/support/info.hpp> -#include <stdexcept> namespace boost { namespace spirit { @@ -36,27 +36,13 @@ namespace boost { namespace spirit namespace boost { namespace spirit { namespace qi { - template <typename Iterator> - struct expectation_failure : std::runtime_error - { - expectation_failure(Iterator first_, Iterator last_, info const& what) - : std::runtime_error("boost::spirit::qi::expectation_failure") - , first(first_), last(last_), what_(what) - {} - ~expectation_failure() throw() {} - - Iterator first; - Iterator last; - info what_; - }; - template <typename Elements> - struct expect : sequence_base<expect<Elements>, Elements> + struct expect_operator : sequence_base<expect_operator<Elements>, Elements> { - friend struct sequence_base<expect<Elements>, Elements>; + friend struct sequence_base<expect_operator<Elements>, Elements>; - expect(Elements const& elements) - : sequence_base<expect<Elements>, Elements>(elements) {} + expect_operator(Elements const& elements) + : sequence_base<expect_operator<Elements>, Elements>(elements) {} private: @@ -73,7 +59,7 @@ namespace boost { namespace spirit { namespace qi (first, last, context, skipper); } - std::string id() const { return "expect"; } + std::string id() const { return "expect_operator"; } }; /////////////////////////////////////////////////////////////////////////// @@ -81,7 +67,7 @@ namespace boost { namespace spirit { namespace qi /////////////////////////////////////////////////////////////////////////// template <typename Elements, typename Modifiers> struct make_composite<proto::tag::greater, Elements, Modifiers> - : make_nary_composite<Elements, expect> + : make_nary_composite<Elements, expect_operator> {}; }}} @@ -89,13 +75,13 @@ namespace boost { namespace spirit { namespace traits { /////////////////////////////////////////////////////////////////////////// template <typename Elements> - struct has_semantic_action<qi::expect<Elements> > + struct has_semantic_action<qi::expect_operator<Elements> > : nary_has_semantic_action<Elements> {}; /////////////////////////////////////////////////////////////////////////// template <typename Elements, typename Attribute, typename Context , typename Iterator> - struct handles_container<qi::expect<Elements>, Attribute, Context + struct handles_container<qi::expect_operator<Elements>, Attribute, Context , Iterator> : mpl::true_ {}; }}} diff --git a/boost/spirit/home/support/attributes.hpp b/boost/spirit/home/support/attributes.hpp index 889e3a370b..dd89521404 100644 --- a/boost/spirit/home/support/attributes.hpp +++ b/boost/spirit/home/support/attributes.hpp @@ -1032,8 +1032,7 @@ namespace boost { namespace spirit { namespace traits template <typename T> void swap_impl(T& a, T& b) { - using namespace std; - swap(a, b); + boost::swap(a, b); } template <typename A> diff --git a/boost/spirit/home/support/common_terminals.hpp b/boost/spirit/home/support/common_terminals.hpp index 2c7772df66..cab01c1c27 100644 --- a/boost/spirit/home/support/common_terminals.hpp +++ b/boost/spirit/home/support/common_terminals.hpp @@ -83,6 +83,7 @@ namespace boost { namespace spirit ( strict, strict_type ) ( relaxed, relaxed_type ) ( duplicate, duplicate_type ) + ( expect, expect_type ) ) // Our extended terminals diff --git a/boost/spirit/home/support/detail/lexer/generator.hpp b/boost/spirit/home/support/detail/lexer/generator.hpp index daa06e7944..103c834978 100644 --- a/boost/spirit/home/support/detail/lexer/generator.hpp +++ b/boost/spirit/home/support/detail/lexer/generator.hpp @@ -16,6 +16,7 @@ #include "parser/tree/node.hpp" #include "parser/parser.hpp" #include "containers/ptr_list.hpp" +#include <boost/move/unique_ptr.hpp> #include "rules.hpp" #include "state_machine.hpp" @@ -116,10 +117,10 @@ public: protected: typedef detail::basic_charset<CharT> charset; typedef detail::ptr_list<charset> charset_list; - typedef std::auto_ptr<charset> charset_ptr; + typedef boost::movelib::unique_ptr<charset> charset_ptr; typedef detail::equivset equivset; typedef detail::ptr_list<equivset> equivset_list; - typedef std::auto_ptr<equivset> equivset_ptr; + typedef boost::movelib::unique_ptr<equivset> equivset_ptr; typedef typename charset::index_set index_set; typedef std::vector<index_set> index_set_vector; typedef detail::basic_parser<CharT> parser; @@ -377,8 +378,8 @@ protected: if (followpos_->empty ()) return npos; std::size_t index_ = 0; - std::auto_ptr<node_set> set_ptr_ (new node_set); - std::auto_ptr<node_vector> vector_ptr_ (new node_vector); + boost::movelib::unique_ptr<node_set> set_ptr_ (new node_set); + boost::movelib::unique_ptr<node_vector> vector_ptr_ (new node_vector); for (typename detail::node::node_vector::const_iterator iter_ = followpos_->begin (), end_ = followpos_->end (); @@ -494,21 +495,13 @@ protected: delete *l_iter_; *l_iter_ = overlap_.release (); - // VC++ 6 Hack: - charset_ptr temp_overlap_ (new charset); - - overlap_ = temp_overlap_; + overlap_.reset (new charset); ++iter_; } else if (r_->empty ()) { - delete r_.release (); - r_ = overlap_; - - // VC++ 6 Hack: - charset_ptr temp_overlap_ (new charset); - - overlap_ = temp_overlap_; + overlap_.swap (r_); + overlap_.reset (new charset); break; } else @@ -517,10 +510,7 @@ protected: static_cast<charset *>(0)); *iter_ = overlap_.release (); - // VC++ 6 Hack: - charset_ptr temp_overlap_ (new charset); - - overlap_ = temp_overlap_; + overlap_.reset(new charset); ++iter_; end_ = lhs_->end (); } @@ -642,21 +632,13 @@ protected: delete *l_iter_; *l_iter_ = overlap_.release (); - // VC++ 6 Hack: - equivset_ptr temp_overlap_ (new equivset); - - overlap_ = temp_overlap_; + overlap_.reset (new equivset); ++iter_; } else if (r_->empty ()) { - delete r_.release (); - r_ = overlap_; - - // VC++ 6 Hack: - equivset_ptr temp_overlap_ (new equivset); - - overlap_ = temp_overlap_; + overlap_.swap (r_); + overlap_.reset (new equivset); break; } else @@ -665,10 +647,7 @@ protected: static_cast<equivset *>(0)); *iter_ = overlap_.release (); - // VC++ 6 Hack: - equivset_ptr temp_overlap_ (new equivset); - - overlap_ = temp_overlap_; + overlap_.reset (new equivset); ++iter_; end_ = lhs_->end (); } diff --git a/boost/spirit/home/support/detail/pow10.hpp b/boost/spirit/home/support/detail/pow10.hpp index b49bb581fd..e21a4dc571 100644 --- a/boost/spirit/home/support/detail/pow10.hpp +++ b/boost/spirit/home/support/detail/pow10.hpp @@ -13,6 +13,7 @@ #pragma once #endif +#include <cfloat> #include <boost/config/no_tr1/cmath.hpp> #include <boost/limits.hpp> #include <boost/spirit/home/support/unused.hpp> diff --git a/boost/spirit/home/support/iterators/multi_pass.hpp b/boost/spirit/home/support/iterators/multi_pass.hpp index 3fc244034f..1c31d7e256 100644 --- a/boost/spirit/home/support/iterators/multi_pass.hpp +++ b/boost/spirit/home/support/iterators/multi_pass.hpp @@ -148,19 +148,19 @@ namespace boost { namespace spirit return policies_base_type::less_than(*this, y); } - bool operator!=(multi_pass const& y) + bool operator!=(multi_pass const& y) const { return !(*this == y); } - bool operator>(multi_pass const& y) + bool operator>(multi_pass const& y) const { return y < *this; } - bool operator>=(multi_pass const& y) + bool operator>=(multi_pass const& y) const { return !(*this < y); } - bool operator<=(multi_pass const& y) + bool operator<=(multi_pass const& y) const { return !(y < *this); } diff --git a/boost/spirit/home/x3/auxiliary/attr.hpp b/boost/spirit/home/x3/auxiliary/attr.hpp index 5b3c7a5d85..6471bd90df 100644 --- a/boost/spirit/home/x3/auxiliary/attr.hpp +++ b/boost/spirit/home/x3/auxiliary/attr.hpp @@ -40,8 +40,8 @@ namespace boost { namespace spirit { namespace x3 template <typename Iterator, typename Context , typename RuleContext, typename Attribute> - bool parse(Iterator& first, Iterator const& last - , Context const& context, RuleContext&, Attribute& attr_) const + bool parse(Iterator& /* first */, Iterator const& /* last */ + , Context const& /* context */, RuleContext&, Attribute& attr_) const { // $$$ Change to copy_to once we have it $$$ traits::move_to(value_, attr_); @@ -76,8 +76,8 @@ namespace boost { namespace spirit { namespace x3 template <typename Iterator, typename Context , typename RuleContext, typename Attribute> - bool parse(Iterator& first, Iterator const& last - , Context const& context, RuleContext&, Attribute& attr_) const + bool parse(Iterator& /* first */, Iterator const& /* last */ + , Context const& /* context */, RuleContext&, Attribute& attr_) const { // $$$ Change to copy_to once we have it $$$ traits::move_to(value_ + 0, value_ + N, attr_); diff --git a/boost/spirit/home/x3/auxiliary/eps.hpp b/boost/spirit/home/x3/auxiliary/eps.hpp index 816eea7b0f..3d4ae9a57d 100644 --- a/boost/spirit/home/x3/auxiliary/eps.hpp +++ b/boost/spirit/home/x3/auxiliary/eps.hpp @@ -45,7 +45,7 @@ namespace boost { namespace spirit { namespace x3 template <typename Iterator, typename Context, typename Attribute> bool parse(Iterator& first, Iterator const& last - , Context const& context, unused_type, Attribute& attr) const + , Context const& context, unused_type, Attribute& /* attr */) const { x3::skip_over(first, last, context); return f(x3::get<rule_context_tag>(context)); diff --git a/boost/spirit/home/x3/char/char.hpp b/boost/spirit/home/x3/char/char.hpp index 5cfd720152..8cd213a2bc 100644 --- a/boost/spirit/home/x3/char/char.hpp +++ b/boost/spirit/home/x3/char/char.hpp @@ -38,6 +38,7 @@ namespace boost { namespace spirit { namespace x3 using standard::char_; using standard::lit; +#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE namespace standard_wide { typedef any_char<char_encoding::standard_wide> char_type; @@ -49,6 +50,7 @@ namespace boost { namespace spirit { namespace x3 return { ch }; } } +#endif namespace ascii { @@ -103,6 +105,7 @@ namespace boost { namespace spirit { namespace x3 } }; +#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE template <> struct as_parser<wchar_t> { @@ -117,6 +120,7 @@ namespace boost { namespace spirit { namespace x3 return { ch }; } }; +#endif template <> struct as_parser<char [2]> @@ -133,6 +137,7 @@ namespace boost { namespace spirit { namespace x3 } }; +#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE template <> struct as_parser<wchar_t [2]> { @@ -147,6 +152,7 @@ namespace boost { namespace spirit { namespace x3 return { ch[0] }; } }; +#endif } diff --git a/boost/spirit/home/x3/char/char_class.hpp b/boost/spirit/home/x3/char/char_class.hpp index 7fae90fdcd..0af6f01d9f 100644 --- a/boost/spirit/home/x3/char/char_class.hpp +++ b/boost/spirit/home/x3/char/char_class.hpp @@ -93,7 +93,9 @@ namespace boost { namespace spirit { namespace x3 /***/ BOOST_SPIRIT_X3_CHAR_CLASSES(standard) +#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE BOOST_SPIRIT_X3_CHAR_CLASSES(standard_wide) +#endif BOOST_SPIRIT_X3_CHAR_CLASSES(ascii) BOOST_SPIRIT_X3_CHAR_CLASSES(iso8859_1) diff --git a/boost/spirit/home/x3/char/char_set.hpp b/boost/spirit/home/x3/char/char_set.hpp index 3a8f986456..1bff83ec6b 100644 --- a/boost/spirit/home/x3/char/char_set.hpp +++ b/boost/spirit/home/x3/char/char_set.hpp @@ -115,7 +115,7 @@ namespace boost { namespace spirit { namespace x3 struct get_info<char_set<Encoding, Attribute>> { typedef std::string result_type; - std::string operator()(char_set<Encoding, Attribute> const& p) const + std::string operator()(char_set<Encoding, Attribute> const& /* p */) const { return "char-set"; } diff --git a/boost/spirit/home/x3/core/call.hpp b/boost/spirit/home/x3/core/call.hpp index 9674c93efe..8a5deedb73 100644 --- a/boost/spirit/home/x3/core/call.hpp +++ b/boost/spirit/home/x3/core/call.hpp @@ -52,7 +52,7 @@ namespace boost { namespace spirit { namespace x3 } template <typename F, typename Context> - auto call(F f, Context const& context, mpl::false_) + auto call(F f, Context const& /* context */, mpl::false_) { return f(); } 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 96424a4278..45ecc41ae0 100644 --- a/boost/spirit/home/x3/core/detail/parse_into_container.hpp +++ b/boost/spirit/home/x3/core/detail/parse_into_container.hpp @@ -202,7 +202,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail static bool call( Parser const& parser , Iterator& first, Iterator const& last, Context const& context - , RContext& rcontext, Attribute& attr, mpl::false_) + , RContext& rcontext, Attribute& /* attr */, mpl::false_) { return parser.parse(first, last, context, rcontext, unused); } @@ -251,7 +251,13 @@ namespace boost { namespace spirit { namespace x3 { namespace detail , Iterator& first, Iterator const& last , Context const& context, RContext& rcontext, Attribute& attr, mpl::true_) { - return parser.parse(first, last, context, rcontext, attr); + if (attr.empty()) + 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()); + return r; } template <typename Iterator, typename Attribute> diff --git a/boost/spirit/home/x3/core/parser.hpp b/boost/spirit/home/x3/core/parser.hpp index 0df69304e0..27115b8de4 100644 --- a/boost/spirit/home/x3/core/parser.hpp +++ b/boost/spirit/home/x3/core/parser.hpp @@ -18,6 +18,8 @@ #include <boost/spirit/home/x3/support/context.hpp> #include <boost/spirit/home/x3/support/traits/has_attribute.hpp> #include <boost/spirit/home/x3/support/utility/sfinae.hpp> +#include <boost/core/ignore_unused.hpp> +#include <boost/assert.hpp> #include <string> #if !defined(BOOST_SPIRIT_X3_NO_RTTI) @@ -63,6 +65,23 @@ namespace boost { namespace spirit { namespace x3 } }; + namespace detail { + template <typename Parser> + static void assert_initialized_rule(Parser const& p) { + boost::ignore_unused(p); + + // Assert that we are not copying an unitialized static rule. If + // the static is in another TU, it may be initialized after we copy + // it. If so, its name member will be nullptr. + // + // Rather than hardcoding behaviour for rule-type subject parsers, + // we simply allow get_info<> to do the check in debug builds. +#ifndef NDEBUG + what(p); // note: allows get_info<> to diagnose the issue +#endif + } + } + struct unary_category; struct binary_category; @@ -74,7 +93,7 @@ namespace boost { namespace spirit { namespace x3 static bool const has_action = Subject::has_action; unary_parser(Subject const& subject) - : subject(subject) {} + : subject(subject) { detail::assert_initialized_rule(subject); } unary_parser const& get_unary() const { return *this; } @@ -91,7 +110,11 @@ namespace boost { namespace spirit { namespace x3 left_type::has_action || right_type::has_action; binary_parser(Left const& left, Right const& right) - : left(left), right(right) {} + : left(left), right(right) + { + detail::assert_initialized_rule(left); + detail::assert_initialized_rule(right); + } binary_parser const& get_binary() const { return *this; } diff --git a/boost/spirit/home/x3/nonterminal/detail/rule.hpp b/boost/spirit/home/x3/nonterminal/detail/rule.hpp index e07b067718..dda44e1f50 100644 --- a/boost/spirit/home/x3/nonterminal/detail/rule.hpp +++ b/boost/spirit/home/x3/nonterminal/detail/rule.hpp @@ -7,6 +7,7 @@ #if !defined(BOOST_SPIRIT_X3_DETAIL_RULE_JAN_08_2012_0326PM) #define BOOST_SPIRIT_X3_DETAIL_RULE_JAN_08_2012_0326PM +#include <boost/core/ignore_unused.hpp> #include <boost/spirit/home/x3/auxiliary/guard.hpp> #include <boost/spirit/home/x3/core/parser.hpp> #include <boost/spirit/home/x3/core/skip_over.hpp> @@ -138,7 +139,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail template <typename ID, typename RHS, typename Context> Context const& - make_rule_context(RHS const& rhs, Context const& context + make_rule_context(RHS const& /* rhs */, Context const& context , mpl::false_ /* is_default_parse_rule */) { return context; @@ -156,8 +157,8 @@ namespace boost { namespace spirit { namespace x3 { namespace detail { template <typename Iterator, typename Context, typename ActualAttribute> static bool call_on_success( - Iterator& first, Iterator const& last - , Context const& context, ActualAttribute& attr + Iterator& /* first */, Iterator const& /* last */ + , Context const& /* context */, ActualAttribute& /* attr */ , mpl::false_ /* No on_success handler */ ) { return true; @@ -285,7 +286,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail static bool parse_rhs( RHS const& rhs , Iterator& first, Iterator const& last - , Context const& context, RContext& rcontext, ActualAttribute& attr + , Context const& context, RContext& rcontext, ActualAttribute& /* attr */ , mpl::true_) { return parse_rhs_main(rhs, first, last, context, rcontext, unused); @@ -300,6 +301,8 @@ namespace boost { namespace spirit { namespace x3 { namespace detail , Context const& context, ActualAttribute& attr , ExplicitAttrPropagation) { + boost::ignore_unused(rule_name); + typedef traits::make_attribute<Attribute, ActualAttribute> make_attribute; // do down-stream transformation, provides attribute for @@ -325,9 +328,8 @@ namespace boost { namespace spirit { namespace x3 { namespace detail // traits::post_transform when, for example, // ActualAttribute is a recursive variant). #if defined(BOOST_SPIRIT_X3_DEBUG) - typedef typename make_attribute::type dbg_attribute_type; - context_debug<Iterator, dbg_attribute_type> - dbg(rule_name, first, last, dbg_attribute_type(attr_), ok_parse); + context_debug<Iterator, transform_attr> + dbg(rule_name, first, last, attr_, ok_parse); #endif ok_parse = parse_rhs(rhs, first, last, context, attr_, attr_ , mpl::bool_ diff --git a/boost/spirit/home/x3/nonterminal/rule.hpp b/boost/spirit/home/x3/nonterminal/rule.hpp index 56075f34d7..ffed1fe965 100644 --- a/boost/spirit/home/x3/nonterminal/rule.hpp +++ b/boost/spirit/home/x3/nonterminal/rule.hpp @@ -20,15 +20,12 @@ namespace boost { namespace spirit { namespace x3 { - template <typename ID> - struct identity {}; - // default parse_rule implementation template <typename ID, typename Attribute, typename Iterator , typename Context, typename ActualAttribute> inline detail::default_parse_rule_result parse_rule( - rule<ID, Attribute> rule_ + rule<ID, Attribute> /* rule_ */ , Iterator& first, Iterator const& last , Context const& context, ActualAttribute& attr) { @@ -137,7 +134,8 @@ namespace boost { namespace spirit { namespace x3 typedef std::string result_type; std::string operator()(T const& r) const { - return r.name; + BOOST_ASSERT_MSG(r.name, "uninitialized rule"); // static initialization order fiasco + return r.name? r.name : "uninitialized"; } }; @@ -156,7 +154,7 @@ namespace boost { namespace spirit { namespace x3 #define BOOST_SPIRIT_DEFINE_(r, data, rule_name) \ template <typename Iterator, typename Context, typename Attribute> \ inline bool parse_rule( \ - decltype(rule_name) rule_ \ + decltype(rule_name) /* rule_ */ \ , Iterator& first, Iterator const& last \ , Context const& context, Attribute& attr) \ { \ diff --git a/boost/spirit/home/x3/numeric.hpp b/boost/spirit/home/x3/numeric.hpp index ae4d9caa26..3acff052d1 100644 --- a/boost/spirit/home/x3/numeric.hpp +++ b/boost/spirit/home/x3/numeric.hpp @@ -10,6 +10,8 @@ #include <boost/spirit/home/x3/numeric/bool.hpp> #include <boost/spirit/home/x3/numeric/int.hpp> #include <boost/spirit/home/x3/numeric/uint.hpp> +#ifndef BOOST_SPIRIT_NO_REAL_NUMBERS #include <boost/spirit/home/x3/numeric/real.hpp> +#endif #endif diff --git a/boost/spirit/home/x3/numeric/bool.hpp b/boost/spirit/home/x3/numeric/bool.hpp index 1fd7018b0f..d5c53c0474 100644 --- a/boost/spirit/home/x3/numeric/bool.hpp +++ b/boost/spirit/home/x3/numeric/bool.hpp @@ -114,6 +114,7 @@ namespace boost { namespace spirit { namespace x3 false_type const false_ = { false }; } +#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE namespace standard_wide { typedef bool_parser<bool, char_encoding::standard_wide> bool_type; @@ -125,6 +126,7 @@ namespace boost { namespace spirit { namespace x3 typedef literal_bool_parser<bool, char_encoding::standard_wide> false_type; false_type const false_ = { false }; } +#endif namespace ascii { diff --git a/boost/spirit/home/x3/operator/detail/alternative.hpp b/boost/spirit/home/x3/operator/detail/alternative.hpp index 9fbc4f4dc4..0043710320 100644 --- a/boost/spirit/home/x3/operator/detail/alternative.hpp +++ b/boost/spirit/home/x3/operator/detail/alternative.hpp @@ -226,7 +226,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail struct move_if_not_alternative { template<typename T1, typename T2> - static void call(T1& attr_, T2& attr) {} + static void call(T1& /* attr_ */, T2& /* attr */) {} }; template <> diff --git a/boost/spirit/home/x3/string/literal_string.hpp b/boost/spirit/home/x3/string/literal_string.hpp index 5066fe18a9..486dc807b3 100644 --- a/boost/spirit/home/x3/string/literal_string.hpp +++ b/boost/spirit/home/x3/string/literal_string.hpp @@ -77,6 +77,7 @@ namespace boost { namespace spirit { namespace x3 } } +#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE namespace standard_wide { inline literal_string<wchar_t const*, char_encoding::standard_wide> @@ -103,6 +104,7 @@ namespace boost { namespace spirit { namespace x3 return { s }; } } +#endif namespace ascii { @@ -162,8 +164,10 @@ namespace boost { namespace spirit { namespace x3 using standard::string; using standard::lit; +#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE using standard_wide::string; using standard_wide::lit; +#endif namespace extension { @@ -185,6 +189,7 @@ namespace boost { namespace spirit { namespace x3 template <int N> struct as_parser<char const[N]> : as_parser<char[N]> {}; +#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE template <int N> struct as_parser<wchar_t[N]> { @@ -202,6 +207,7 @@ namespace boost { namespace spirit { namespace x3 template <int N> struct as_parser<wchar_t const[N]> : as_parser<wchar_t[N]> {}; +#endif template <> struct as_parser<char const*> diff --git a/boost/spirit/home/x3/string/symbols.hpp b/boost/spirit/home/x3/string/symbols.hpp index 1846c57bad..f9ba4cd392 100644 --- a/boost/spirit/home/x3/string/symbols.hpp +++ b/boost/spirit/home/x3/string/symbols.hpp @@ -343,11 +343,13 @@ namespace boost { namespace spirit { namespace x3 using standard::symbols; +#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE namespace standard_wide { template <typename T = unused_type> using symbols = symbols_parser<char_encoding::standard_wide, T>; } +#endif namespace ascii { diff --git a/boost/spirit/home/x3/support/context.hpp b/boost/spirit/home/x3/support/context.hpp index 592ce3ff76..9b24a3397c 100644 --- a/boost/spirit/home/x3/support/context.hpp +++ b/boost/spirit/home/x3/support/context.hpp @@ -74,12 +74,12 @@ namespace boost { namespace spirit { namespace x3 { return { val }; } - + namespace detail { template <typename ID, typename T, typename Next, typename FoundVal> inline Next const& - make_unique_context(T& val, Next const& next, FoundVal&) + make_unique_context(T& /* val */, Next const& next, FoundVal&) { return next; } @@ -91,7 +91,7 @@ namespace boost { namespace spirit { namespace x3 return { val, next }; } } - + template <typename ID, typename T, typename Next> inline auto make_unique_context(T& val, Next const& next) diff --git a/boost/spirit/home/x3/support/traits/container_traits.hpp b/boost/spirit/home/x3/support/traits/container_traits.hpp index b05764969c..7dcf798958 100644 --- a/boost/spirit/home/x3/support/traits/container_traits.hpp +++ b/boost/spirit/home/x3/support/traits/container_traits.hpp @@ -159,7 +159,7 @@ namespace boost { namespace spirit { namespace x3 { namespace traits { private: template <typename Iterator> - static void reserve(Container& c, Iterator first, Iterator last, mpl::false_) + static void reserve(Container& /* c */, Iterator /* first */, Iterator /* last */, mpl::false_) { // Not all containers have "reserve" } @@ -199,7 +199,7 @@ namespace boost { namespace spirit { namespace x3 { namespace traits } template <typename Iterator> - inline bool append(unused_type, Iterator first, Iterator last) + inline bool append(unused_type, Iterator /* first */, Iterator /* last */) { return true; } diff --git a/boost/spirit/include/qi_expect.hpp b/boost/spirit/include/qi_expect.hpp index bfcd7396f7..4dcbe632b1 100644 --- a/boost/spirit/include/qi_expect.hpp +++ b/boost/spirit/include/qi_expect.hpp @@ -14,5 +14,6 @@ #endif #include <boost/spirit/home/qi/operator/expect.hpp> +#include <boost/spirit/home/qi/directive/expect.hpp> #endif diff --git a/boost/spirit/include/version.hpp b/boost/spirit/include/version.hpp index 90f8b53313..a6afc61755 100644 --- a/boost/spirit/include/version.hpp +++ b/boost/spirit/include/version.hpp @@ -14,7 +14,7 @@ // This is the version of the current Spirit distribution // /////////////////////////////////////////////////////////////////////////////// -#define SPIRIT_VERSION 0x2053 +#define SPIRIT_VERSION 0x2054 #define SPIRIT_PIZZA_VERSION SUPER_HOT_SPANISH_SARDINES // :-O #endif |