diff options
author | Chanho Park <chanho61.park@samsung.com> | 2014-12-11 18:55:56 +0900 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-12-11 18:55:56 +0900 |
commit | 08c1e93fa36a49f49325a07fe91ff92c964c2b6c (patch) | |
tree | 7a7053ceb8874b28ec4b868d4c49b500008a102e /boost/spirit/home/qi | |
parent | bb4dd8289b351fae6b55e303f189127a394a1edd (diff) | |
download | boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.tar.gz boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.tar.bz2 boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.zip |
Imported Upstream version 1.57.0upstream/1.57.0
Diffstat (limited to 'boost/spirit/home/qi')
60 files changed, 458 insertions, 340 deletions
diff --git a/boost/spirit/home/qi/action/action.hpp b/boost/spirit/home/qi/action/action.hpp index 746dd84c1d..2bdf7d8f87 100644 --- a/boost/spirit/home/qi/action/action.hpp +++ b/boost/spirit/home/qi/action/action.hpp @@ -41,8 +41,8 @@ namespace boost { namespace spirit { namespace qi : traits::attribute_of<Subject, Context, Iterator> {}; - action(Subject const& subject, Action f) - : subject(subject), f(f) {} + action(Subject const& subject_, Action f_) + : subject(subject_), f(f_) {} #ifndef BOOST_SPIRIT_ACTIONS_ALLOW_ATTR_COMPAT template <typename Iterator, typename Context diff --git a/boost/spirit/home/qi/auxiliary/attr.hpp b/boost/spirit/home/qi/auxiliary/attr.hpp index 2778a685f1..fb018e7d73 100644 --- a/boost/spirit/home/qi/auxiliary/attr.hpp +++ b/boost/spirit/home/qi/auxiliary/attr.hpp @@ -59,9 +59,9 @@ namespace boost { namespace spirit { namespace qi , typename Skipper, typename Attribute> bool parse(Iterator& /*first*/, Iterator const& /*last*/ , Context& /*context*/, Skipper const& /*skipper*/ - , Attribute& attr) const + , Attribute& attr_) const { - spirit::traits::assign_to(value_, attr); + spirit::traits::assign_to(value_, attr_); return true; // never consume any input, succeed always } diff --git a/boost/spirit/home/qi/auxiliary/attr_cast.hpp b/boost/spirit/home/qi/auxiliary/attr_cast.hpp index a8fc6880e0..93d646c58d 100644 --- a/boost/spirit/home/qi/auxiliary/attr_cast.hpp +++ b/boost/spirit/home/qi/auxiliary/attr_cast.hpp @@ -50,11 +50,11 @@ namespace boost { namespace spirit { namespace qi typedef typename mpl::eval_if< traits::not_is_unused<Transformed> , mpl::identity<Transformed> - , traits::attribute_of<subject_type> >::type + , traits::attribute_of<subject_type> >::type transformed_attribute_type; - attr_cast_parser(Subject const& subject) - : subject(subject) + attr_cast_parser(Subject const& subject_) + : subject(subject_) { // If you got an error_invalid_expression error message here, // then the expression (Subject) is not a valid spirit qi @@ -75,7 +75,7 @@ namespace boost { namespace spirit { namespace qi , typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& context, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_param) const { // Find the real exposed attribute. If exposed is given, we use it // otherwise we assume the exposed attribute type to be the actual @@ -87,21 +87,21 @@ namespace boost { namespace spirit { namespace qi // do down-stream transformation, provides attribute for embedded // parser typedef traits::transform_attribute< - exposed_attribute_type, transformed_attribute_type, domain> + exposed_attribute_type, transformed_attribute_type, domain> transform; - typename transform::type attr_ = transform::pre(attr); + typename transform::type attr_ = transform::pre(attr_param); if (!compile<qi::domain>(subject). parse(first, last, context, skipper, attr_)) { - transform::fail(attr); + transform::fail(attr_param); return false; } // do up-stream transformation, this mainly integrates the results // back into the original attribute value, if appropriate - traits::post_transform(attr, attr_); + traits::post_transform(attr_param, attr_); return true; } diff --git a/boost/spirit/home/qi/auxiliary/eps.hpp b/boost/spirit/home/qi/auxiliary/eps.hpp index fe23935555..4ba6aa4cc4 100644 --- a/boost/spirit/home/qi/auxiliary/eps.hpp +++ b/boost/spirit/home/qi/auxiliary/eps.hpp @@ -80,8 +80,8 @@ namespace boost { namespace spirit { namespace qi typedef unused_type type; }; - semantic_predicate(bool predicate) - : predicate(predicate) {} + semantic_predicate(bool predicate_) + : predicate(predicate_) {} template <typename Iterator, typename Context , typename Skipper, typename Attribute> diff --git a/boost/spirit/home/qi/auxiliary/lazy.hpp b/boost/spirit/home/qi/auxiliary/lazy.hpp index b935261325..60b61d4ce4 100644 --- a/boost/spirit/home/qi/auxiliary/lazy.hpp +++ b/boost/spirit/home/qi/auxiliary/lazy.hpp @@ -60,7 +60,7 @@ namespace boost { namespace spirit { namespace qi bool lazy_parse_impl(Parser const& p , Iterator& first, Iterator const& last , Context& context, Skipper const& skipper - , Attribute& attr, mpl::true_) + , Attribute& /*attr*/, mpl::true_) { // If DeducedAuto is false (semantic actions is present), the // component's attribute is unused. @@ -111,8 +111,8 @@ namespace boost { namespace spirit { namespace qi type; }; - lazy_parser(Function const& function, Modifiers const& modifiers) - : function(function), modifiers(modifiers) {} + lazy_parser(Function const& function_, Modifiers const& modifiers_) + : function(function_), modifiers(modifiers_) {} template <typename Iterator, typename Context , typename Skipper, typename Attribute> @@ -183,10 +183,10 @@ namespace boost { namespace spirit { namespace qi }; lazy_directive( - Function const& function - , Subject const& subject - , Modifiers const& modifiers) - : function(function), subject(subject), modifiers(modifiers) {} + Function const& function_ + , Subject const& subject_ + , Modifiers const& modifiers_) + : function(function_), subject(subject_), modifiers(modifiers_) {} template <typename Iterator, typename Context , typename Skipper, typename Attribute> diff --git a/boost/spirit/home/qi/binary/binary.hpp b/boost/spirit/home/qi/binary/binary.hpp index 7d47a6e2ee..a4e83f0ba5 100644 --- a/boost/spirit/home/qi/binary/binary.hpp +++ b/boost/spirit/home/qi/binary/binary.hpp @@ -241,7 +241,7 @@ namespace boost { namespace spirit { namespace qi , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& /*context*/, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_param) const { qi::skip_over(first, last, skipper); @@ -257,7 +257,7 @@ namespace boost { namespace spirit { namespace qi } first = it; - spirit::traits::assign_to(attr_, attr); + spirit::traits::assign_to(attr_, attr_param); return true; } @@ -280,14 +280,14 @@ namespace boost { namespace spirit { namespace qi typedef unused_type type; }; - binary_lit_parser(V n) - : n(n) {} + binary_lit_parser(V n_) + : n(n_) {} template <typename Iterator, typename Context , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& /*context*/, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_param) const { qi::skip_over(first, last, skipper); @@ -317,7 +317,7 @@ namespace boost { namespace spirit { namespace qi } first = it; - spirit::traits::assign_to(attr_, attr); + spirit::traits::assign_to(attr_, attr_param); return true; } diff --git a/boost/spirit/home/qi/char/char.hpp b/boost/spirit/home/qi/char/char.hpp index 7269da4197..8c22aaa77d 100644 --- a/boost/spirit/home/qi/char/char.hpp +++ b/boost/spirit/home/qi/char/char.hpp @@ -123,8 +123,8 @@ namespace boost { namespace spirit { namespace qi typedef CharEncoding char_encoding; template <typename Char> - literal_char(Char ch) - : ch(static_cast<char_type>(ch)) {} + literal_char(Char ch_) + : ch(static_cast<char_type>(ch_)) {} template <typename Context, typename Iterator> struct attribute @@ -201,8 +201,8 @@ namespace boost { namespace spirit { namespace qi typedef typename CharEncoding::char_type char_type; typedef CharEncoding char_encoding; - char_range(char_type from, char_type to) - : from(from), to(to) {} + char_range(char_type from_, char_type to_) + : from(from_), to(to_) {} template <typename CharParam, typename Context> bool test(CharParam ch_, Context&) const diff --git a/boost/spirit/home/qi/char/char_parser.hpp b/boost/spirit/home/qi/char/char_parser.hpp index b896f73774..1d06d7cf8a 100644 --- a/boost/spirit/home/qi/char/char_parser.hpp +++ b/boost/spirit/home/qi/char/char_parser.hpp @@ -61,13 +61,13 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Context, typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last - , Context& context, Skipper const& skipper, Attribute& attr) const + , Context& context, Skipper const& skipper, Attribute& attr_) const { qi::skip_over(first, last, skipper); if (first != last && this->derived().test(*first, context)) { - spirit::traits::assign_to(*first, attr); + spirit::traits::assign_to(*first, attr_); ++first; return true; } @@ -87,8 +87,8 @@ namespace boost { namespace spirit { namespace qi struct negated_char_parser : char_parser<negated_char_parser<Positive>, typename Positive::char_type> { - negated_char_parser(Positive const& positive) - : positive(positive) {} + negated_char_parser(Positive const& positive_) + : positive(positive_) {} template <typename CharParam, typename Context> bool test(CharParam ch, Context& context) const diff --git a/boost/spirit/home/qi/copy.hpp b/boost/spirit/home/qi/copy.hpp new file mode 100644 index 0000000000..d9b843193d --- /dev/null +++ b/boost/spirit/home/qi/copy.hpp @@ -0,0 +1,31 @@ +/*============================================================================= + Copyright (c) 2001-2012 Joel de Guzman + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_SPIRIT_COPY_FEBRUARY_7_2012_0159PM) +#define BOOST_SPIRIT_COPY_FEBRUARY_7_2012_0159PM + +#include <boost/config.hpp> +#include <boost/proto/proto.hpp> + +#if defined(_MSC_VER) +#pragma once +#endif + +#if !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) + +namespace boost { namespace spirit { namespace qi +{ + template <typename Expr> + typename boost::proto::result_of::deep_copy<Expr>::type + copy(Expr const& expr) + { + BOOST_SPIRIT_ASSERT_MATCH(boost::spirit::qi::domain, Expr); + return boost::proto::deep_copy(expr); + } +}}} + +#endif +#endif diff --git a/boost/spirit/home/qi/detail/alternative_function.hpp b/boost/spirit/home/qi/detail/alternative_function.hpp index aad0c54866..0c400a90d4 100644 --- a/boost/spirit/home/qi/detail/alternative_function.hpp +++ b/boost/spirit/home/qi/detail/alternative_function.hpp @@ -56,10 +56,10 @@ namespace boost { namespace spirit { namespace qi { namespace detail struct alternative_function { alternative_function( - Iterator& first, Iterator const& last, Context& context, - Skipper const& skipper, Attribute& attr) - : first(first), last(last), context(context), skipper(skipper), - attr(attr) + Iterator& first_, Iterator const& last_, Context& context_, + Skipper const& skipper_, Attribute& attr_) + : first(first_), last(last_), context(context_), skipper(skipper_), + attr(attr_) { } @@ -185,14 +185,14 @@ namespace boost { namespace spirit { namespace qi { namespace detail struct alternative_function<Iterator, Context, Skipper, unused_type const> { alternative_function( - Iterator& first, Iterator const& last, Context& context, - Skipper const& skipper, unused_type) - : first(first), last(last), context(context), skipper(skipper) + Iterator& first_, Iterator const& last_, Context& context_, + Skipper const& skipper_, unused_type) + : first(first_), last(last_), context(context_), skipper(skipper_) { } template <typename Component> - bool operator()(Component const& component) + bool operator()(Component const& component) const { // return true if the parser succeeds return component.parse(first, last, context, skipper, diff --git a/boost/spirit/home/qi/detail/expect_function.hpp b/boost/spirit/home/qi/detail/expect_function.hpp index 34dd910744..920e30997b 100644 --- a/boost/spirit/home/qi/detail/expect_function.hpp +++ b/boost/spirit/home/qi/detail/expect_function.hpp @@ -26,12 +26,12 @@ namespace boost { namespace spirit { namespace qi { namespace detail typedef Context context_type; expect_function( - Iterator& first, Iterator const& last - , Context& context, Skipper const& skipper) - : first(first) - , last(last) - , context(context) - , skipper(skipper) + Iterator& first_, Iterator const& last_ + , Context& context_, Skipper const& skipper_) + : first(first_) + , last(last_) + , context(context_) + , skipper(skipper_) , is_first(true) { } diff --git a/boost/spirit/home/qi/detail/fail_function.hpp b/boost/spirit/home/qi/detail/fail_function.hpp index fca03b33f9..7ab8d82a2b 100644 --- a/boost/spirit/home/qi/detail/fail_function.hpp +++ b/boost/spirit/home/qi/detail/fail_function.hpp @@ -22,12 +22,12 @@ namespace boost { namespace spirit { namespace qi { namespace detail typedef Context context_type; fail_function( - Iterator& first, Iterator const& last - , Context& context, Skipper const& skipper) - : first(first) - , last(last) - , context(context) - , skipper(skipper) + Iterator& first_, Iterator const& last_ + , Context& context_, Skipper const& skipper_) + : first(first_) + , last(last_) + , context(context_) + , skipper(skipper_) { } diff --git a/boost/spirit/home/qi/detail/pass_container.hpp b/boost/spirit/home/qi/detail/pass_container.hpp index 82e153aa3a..f41f1e9bcc 100644 --- a/boost/spirit/home/qi/detail/pass_container.hpp +++ b/boost/spirit/home/qi/detail/pass_container.hpp @@ -33,17 +33,17 @@ namespace boost { namespace spirit { namespace qi { namespace detail Sequence , typename traits::is_weak_substitute<Attribute, ValueType>::type , typename mpl::not_< - traits::is_weak_substitute<Attribute, ValueType> + traits::is_weak_substitute<Attribute, ValueType> >::type> {}; - // pass_through_container: utility to check decide whether a provided - // container attribute needs to be passed through to the current component + // pass_through_container: utility to check decide whether a provided + // container attribute needs to be passed through to the current component // or of we need to split the container by passing along instances of its // value type - // if the expected attribute of the current component is neither a Fusion - // sequence nor a container, we will pass through the provided container + // if the expected attribute of the current component is neither a Fusion + // sequence nor a container, we will pass through the provided container // only if its value type is not compatible with the component template <typename Container, typename ValueType, typename Attribute , typename Sequence, typename Enable = void> @@ -53,9 +53,9 @@ namespace boost { namespace spirit { namespace qi { namespace detail // Specialization for fusion sequences, in this case we check whether all // the types in the sequence are convertible to the lhs attribute. - // + // // We return false if the rhs attribute itself is a fusion sequence, which - // is compatible with the LHS sequence (we want to pass through this + // is compatible with the LHS sequence (we want to pass through this // attribute without it being split apart). template <typename Container, typename ValueType, typename Attribute , typename Sequence = mpl::true_> @@ -66,7 +66,7 @@ namespace boost { namespace spirit { namespace qi { namespace detail {}; // If the value type of the container is not a Fusion sequence, we pass - // through the container if each of the elements of the Attribute + // through the container if each of the elements of the Attribute // sequence is compatible with either the container or its value type. template <typename Container, typename ValueType, typename Attribute , typename Sequence @@ -82,7 +82,7 @@ namespace boost { namespace spirit { namespace qi { namespace detail }; // If both, the Attribute and the value type of the provided container - // are Fusion sequences, we pass the container only if the two + // are Fusion sequences, we pass the container only if the two // sequences are not compatible. template <typename Container, typename ValueType, typename Attribute , typename Sequence> @@ -110,14 +110,14 @@ namespace boost { namespace spirit { namespace qi { namespace detail // Specialization for containers // // If the value type of the attribute of the current component is not - // a Fusion sequence, we have to pass through the provided container if + // a Fusion sequence, we have to pass through the provided container if // both are compatible. template <typename Container, typename ValueType, typename Attribute , typename Sequence, typename AttributeValueType , bool IsSequence = fusion::traits::is_sequence<AttributeValueType>::value> struct pass_through_container_container : mpl::or_< - traits::is_weak_substitute<Attribute, Container> + traits::is_weak_substitute<Attribute, Container> , traits::is_weak_substitute<AttributeValueType, Container> > {}; @@ -143,16 +143,16 @@ namespace boost { namespace spirit { namespace qi { namespace detail // Specialization for exposed optional attributes // - // If the type embedded in the exposed optional is not a Fusion + // If the type embedded in the exposed optional is not a Fusion // sequence we pass through the container attribute if it is compatible - // either to the optionals embedded type or to the containers value + // either to the optionals embedded type or to the containers value // type. template <typename Container, typename ValueType, typename Attribute , typename Sequence , bool IsSequence = fusion::traits::is_sequence<Attribute>::value> struct pass_through_container_optional : mpl::or_< - traits::is_weak_substitute<Attribute, Container> + traits::is_weak_substitute<Attribute, Container> , traits::is_weak_substitute<Attribute, ValueType> > {}; @@ -170,7 +170,7 @@ namespace boost { namespace spirit { namespace qi { namespace detail template <typename Container, typename ValueType, typename Attribute , typename Sequence> struct pass_through_container - : pass_through_container_base<Container, ValueType, Attribute, Sequence> + : pass_through_container_base<Container, ValueType, Attribute, Sequence> {}; // Handle optional attributes @@ -179,25 +179,44 @@ namespace boost { namespace spirit { namespace qi { namespace detail struct pass_through_container< Container, ValueType, boost::optional<Attribute>, Sequence> : pass_through_container_optional< - Container, ValueType, Attribute, Sequence> + Container, ValueType, Attribute, Sequence> {}; // If both, the containers value type and the exposed attribute type are - // optionals we are allowed to pass through the the container only if the + // optionals we are allowed to pass through the container only if the // embedded types of those optionals are not compatible. template <typename Container, typename ValueType, typename Attribute , typename Sequence> struct pass_through_container< Container, boost::optional<ValueType>, boost::optional<Attribute> , Sequence> - : mpl::not_<traits::is_weak_substitute<Attribute, ValueType> > + : mpl::not_<traits::is_weak_substitute<Attribute, ValueType> > {}; // Specialization for exposed variant attributes - // - // We pass through the container attribute if at least one of the embedded + // + // We pass through the container attribute if at least one of the embedded // types in the variant requires to pass through the attribute +#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) + template <typename Container, typename ValueType, typename Sequence + , typename T> + struct pass_through_container<Container, ValueType, boost::variant<T> + , Sequence> + : pass_through_container<Container, ValueType, T, Sequence> + {}; + + template <typename Container, typename ValueType, typename Sequence + , typename T0, typename ...TN> + struct pass_through_container<Container, ValueType + , boost::variant<T0, TN...>, Sequence> + : mpl::bool_<pass_through_container< + Container, ValueType, T0, Sequence + >::type::value || pass_through_container< + Container, ValueType, boost::variant<TN...>, Sequence + >::type::value> + {}; +#else #define BOOST_SPIRIT_PASS_THROUGH_CONTAINER(z, N, _) \ pass_through_container<Container, ValueType, \ BOOST_PP_CAT(T, N), Sequence>::type::value || \ @@ -219,6 +238,7 @@ namespace boost { namespace spirit { namespace qi { namespace detail {}; #undef BOOST_SPIRIT_PASS_THROUGH_CONTAINER +#endif }}}} /////////////////////////////////////////////////////////////////////////////// @@ -247,8 +267,8 @@ namespace boost { namespace spirit { namespace qi { namespace detail typedef typename F::context_type context_type; typedef typename F::iterator_type iterator_type; - pass_container(F const& f, Attr& attr) - : f(f), attr(attr) {} + pass_container(F const& f_, Attr& attr_) + : f(f_), attr(attr_) {} // this is for the case when the current element exposes an attribute // which is pushed back onto the container @@ -271,8 +291,8 @@ namespace boost { namespace spirit { namespace qi { namespace detail return r; } - // this is for the case when the current element is able to handle an - // attribute which is a container itself, this element will push its + // this is for the case when the current element is able to handle an + // attribute which is a container itself, this element will push its // data directly into the attribute container template <typename Component> bool dispatch_container(Component const& component, mpl::true_) const @@ -281,7 +301,7 @@ namespace boost { namespace spirit { namespace qi { namespace detail } /////////////////////////////////////////////////////////////////////// - // this is for the case when the current element doesn't expect an + // this is for the case when the current element doesn't expect an // attribute template <typename Component> bool dispatch_attribute(Component const& component, mpl::false_) const @@ -298,12 +318,12 @@ namespace boost { namespace spirit { namespace qi { namespace detail Component, context_type, iterator_type>::type rhs_attribute; - // this predicate detects, whether the attribute of the current + // this predicate detects, whether the attribute of the current // element is a substitute for the value type of the container - // attribute + // attribute typedef mpl::and_< traits::handles_container< - Component, Attr, context_type, iterator_type> + Component, Attr, context_type, iterator_type> , traits::pass_through_container< Attr, value_type, rhs_attribute, Sequence, qi::domain> > predicate; @@ -340,7 +360,7 @@ namespace boost { namespace spirit { namespace qi { namespace detail }; /////////////////////////////////////////////////////////////////////////// - // Utility function to make a pass_container for container components + // Utility function to make a pass_container for container components // (kleene, list, plus, repeat) template <typename F, typename Attr> inline pass_container<F, Attr, mpl::false_> diff --git a/boost/spirit/home/qi/detail/pass_function.hpp b/boost/spirit/home/qi/detail/pass_function.hpp index 2d9e6bab26..555adb8a49 100644 --- a/boost/spirit/home/qi/detail/pass_function.hpp +++ b/boost/spirit/home/qi/detail/pass_function.hpp @@ -20,12 +20,12 @@ namespace boost { namespace spirit { namespace qi { namespace detail struct pass_function { pass_function( - Iterator& first, Iterator const& last - , Context& context, Skipper const& skipper) - : first(first) - , last(last) - , context(context) - , skipper(skipper) + Iterator& first_, Iterator const& last_ + , Context& context_, Skipper const& skipper_) + : first(first_) + , last(last_) + , context(context_) + , skipper(skipper_) { } diff --git a/boost/spirit/home/qi/detail/permute_function.hpp b/boost/spirit/home/qi/detail/permute_function.hpp index 13c1b8c123..8b1ed8a596 100644 --- a/boost/spirit/home/qi/detail/permute_function.hpp +++ b/boost/spirit/home/qi/detail/permute_function.hpp @@ -20,12 +20,12 @@ namespace boost { namespace spirit { namespace qi { namespace detail struct permute_function { permute_function( - Iterator& first, Iterator const& last - , Context& context, Skipper const& skipper) - : first(first) - , last(last) - , context(context) - , skipper(skipper) + Iterator& first_, Iterator const& last_ + , Context& context_, Skipper const& skipper_) + : first(first_) + , last(last_) + , context(context_) + , skipper(skipper_) { } diff --git a/boost/spirit/home/qi/detail/unused_skipper.hpp b/boost/spirit/home/qi/detail/unused_skipper.hpp index c1405d67c7..b8a51f3224 100644 --- a/boost/spirit/home/qi/detail/unused_skipper.hpp +++ b/boost/spirit/home/qi/detail/unused_skipper.hpp @@ -11,14 +11,15 @@ #endif #include <boost/spirit/home/support/unused.hpp> +#include <boost/mpl/bool.hpp> namespace boost { namespace spirit { namespace qi { namespace detail { template <typename Skipper> struct unused_skipper : unused_type { - unused_skipper(Skipper const& skipper) - : skipper(skipper) {} + unused_skipper(Skipper const& skipper_) + : skipper(skipper_) {} Skipper const& skipper; private: @@ -26,12 +27,24 @@ namespace boost { namespace spirit { namespace qi { namespace detail unused_skipper& operator= (unused_skipper const&); }; + template <typename Skipper> + struct is_unused_skipper + : mpl::false_ {}; + + template <typename Skipper> + struct is_unused_skipper<unused_skipper<Skipper> > + : mpl::true_ {}; + + template <> + struct is_unused_skipper<unused_type> + : mpl::true_ {}; + // If a surrounding lexeme[] directive was specified, the current - // skipper is of the type unused_skipper. In this case we + // skipper is of the type unused_skipper. In this case we // re-activate the skipper which was active before the skip[] // directive. template <typename Skipper> - inline Skipper const& + inline Skipper const& get_skipper(unused_skipper<Skipper> const& u) { return u.skipper; @@ -39,7 +52,7 @@ namespace boost { namespace spirit { namespace qi { namespace detail // If no surrounding lexeme[] directive was specified we keep what we got. template <typename Skipper> - inline Skipper const& + inline Skipper const& get_skipper(Skipper const& u) { return u; diff --git a/boost/spirit/home/qi/directive/as.hpp b/boost/spirit/home/qi/directive/as.hpp index 9ace587caf..e0376eb2ec 100644 --- a/boost/spirit/home/qi/directive/as.hpp +++ b/boost/spirit/home/qi/directive/as.hpp @@ -76,8 +76,8 @@ namespace boost { namespace spirit { namespace qi struct as_directive : unary_parser<as_directive<Subject, T> > { typedef Subject subject_type; - as_directive(Subject const& subject) - : subject(subject) {} + as_directive(Subject const& subject_) + : subject(subject_) {} template <typename Context, typename Iterator> struct attribute @@ -88,13 +88,13 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Context , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last - , Context& context, Skipper const& skipper, Attribute& attr) const + , Context& context, Skipper const& skipper, Attribute& attr_) const { Iterator i = first; T as_attr; if (subject.parse(i, last, context, skipper, as_attr)) { - spirit::traits::assign_to(as_attr, attr); + spirit::traits::assign_to(as_attr, attr_); first = i; return true; } @@ -103,10 +103,10 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Context, typename Skipper> bool parse(Iterator& first, Iterator const& last - , Context& context, Skipper const& skipper, T& attr) const + , Context& context, Skipper const& skipper, T& attr_) const { Iterator i = first; - if (subject.parse(i, last, context, skipper, attr)) + if (subject.parse(i, last, context, skipper, attr_)) { first = i; return true; diff --git a/boost/spirit/home/qi/directive/hold.hpp b/boost/spirit/home/qi/directive/hold.hpp index d5b2ed5601..9cd905cf79 100644 --- a/boost/spirit/home/qi/directive/hold.hpp +++ b/boost/spirit/home/qi/directive/hold.hpp @@ -42,8 +42,8 @@ namespace boost { namespace spirit { namespace qi struct hold_directive : unary_parser<hold_directive<Subject> > { typedef Subject subject_type; - hold_directive(Subject const& subject) - : subject(subject) {} + hold_directive(Subject const& subject_) + : subject(subject_) {} template <typename Context, typename Iterator> struct attribute @@ -56,12 +56,12 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Context , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last - , Context& context, Skipper const& skipper, Attribute& attr) const + , Context& context, Skipper const& skipper, Attribute& attr_) const { - Attribute copy(attr); + Attribute copy(attr_); if (subject.parse(first, last, context, skipper, copy)) { - traits::swap_impl(copy, attr); + traits::swap_impl(copy, attr_); return true; } return false; diff --git a/boost/spirit/home/qi/directive/lexeme.hpp b/boost/spirit/home/qi/directive/lexeme.hpp index f0b83993ef..691d4fa52c 100644 --- a/boost/spirit/home/qi/directive/lexeme.hpp +++ b/boost/spirit/home/qi/directive/lexeme.hpp @@ -20,6 +20,7 @@ #include <boost/spirit/home/qi/detail/attributes.hpp> #include <boost/spirit/home/support/info.hpp> #include <boost/spirit/home/support/handles_container.hpp> +#include <boost/utility/enable_if.hpp> namespace boost { namespace spirit { @@ -42,8 +43,8 @@ namespace boost { namespace spirit { namespace qi struct lexeme_directive : unary_parser<lexeme_directive<Subject> > { typedef Subject subject_type; - lexeme_directive(Subject const& subject) - : subject(subject) {} + lexeme_directive(Subject const& subject_) + : subject(subject_) {} template <typename Context, typename Iterator> struct attribute @@ -55,13 +56,26 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Context , typename Skipper, typename Attribute> - bool parse(Iterator& first, Iterator const& last + typename disable_if<detail::is_unused_skipper<Skipper>, bool>::type + parse(Iterator& first, Iterator const& last , Context& context, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_) const { qi::skip_over(first, last, skipper); return subject.parse(first, last, context - , detail::unused_skipper<Skipper>(skipper), attr); + , detail::unused_skipper<Skipper>(skipper), attr_); + } + template <typename Iterator, typename Context + , typename Skipper, typename Attribute> + typename enable_if<detail::is_unused_skipper<Skipper>, bool>::type + parse(Iterator& first, Iterator const& last + , Context& context, Skipper const& skipper + , Attribute& attr_) const + { + // no need to pre-skip if skipper is unused + //- qi::skip_over(first, last, skipper); + return subject.parse(first, last, context + , skipper, attr_); } template <typename Context> diff --git a/boost/spirit/home/qi/directive/matches.hpp b/boost/spirit/home/qi/directive/matches.hpp index b5349272d4..b6fecb994d 100644 --- a/boost/spirit/home/qi/directive/matches.hpp +++ b/boost/spirit/home/qi/directive/matches.hpp @@ -44,8 +44,8 @@ namespace boost { namespace spirit { namespace qi struct matches_directive : unary_parser<matches_directive<Subject> > { typedef Subject subject_type; - matches_directive(Subject const& subject) - : subject(subject) {} + matches_directive(Subject const& subject_) + : subject(subject_) {} template <typename Context, typename Iterator> struct attribute @@ -56,10 +56,10 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Context , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last - , Context& context, Skipper const& skipper, Attribute& attr) const + , Context& context, Skipper const& skipper, Attribute& attr_) const { bool result = subject.parse(first, last, context, skipper, unused); - spirit::traits::assign_to(result, attr); + spirit::traits::assign_to(result, attr_); return true; } diff --git a/boost/spirit/home/qi/directive/no_skip.hpp b/boost/spirit/home/qi/directive/no_skip.hpp index 9764d4a661..119b0c80c3 100644 --- a/boost/spirit/home/qi/directive/no_skip.hpp +++ b/boost/spirit/home/qi/directive/no_skip.hpp @@ -22,6 +22,7 @@ #include <boost/spirit/home/support/info.hpp> #include <boost/spirit/home/support/has_semantic_action.hpp> #include <boost/spirit/home/support/handles_container.hpp> +#include <boost/utility/enable_if.hpp> namespace boost { namespace spirit { @@ -45,8 +46,8 @@ namespace boost { namespace spirit { namespace qi struct no_skip_directive : unary_parser<no_skip_directive<Subject> > { typedef Subject subject_type; - no_skip_directive(Subject const& subject) - : subject(subject) {} + no_skip_directive(Subject const& subject_) + : subject(subject_) {} template <typename Context, typename Iterator> struct attribute @@ -58,12 +59,23 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Context , typename Skipper, typename Attribute> - bool parse(Iterator& first, Iterator const& last + typename disable_if<detail::is_unused_skipper<Skipper>, bool>::type + parse(Iterator& first, Iterator const& last , Context& context, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_) const { return subject.parse(first, last, context - , detail::unused_skipper<Skipper>(skipper), attr); + , detail::unused_skipper<Skipper>(skipper), attr_); + } + template <typename Iterator, typename Context + , typename Skipper, typename Attribute> + typename enable_if<detail::is_unused_skipper<Skipper>, bool>::type + parse(Iterator& first, Iterator const& last + , Context& context, Skipper const& skipper + , Attribute& attr_) const + { + return subject.parse(first, last, context + , skipper, attr_); } template <typename Context> diff --git a/boost/spirit/home/qi/directive/omit.hpp b/boost/spirit/home/qi/directive/omit.hpp index b0ed86b0a7..05a6a76d75 100644 --- a/boost/spirit/home/qi/directive/omit.hpp +++ b/boost/spirit/home/qi/directive/omit.hpp @@ -45,8 +45,8 @@ namespace boost { namespace spirit { namespace qi struct omit_directive : unary_parser<omit_directive<Subject> > { typedef Subject subject_type; - omit_directive(Subject const& subject) - : subject(subject) {} + omit_directive(Subject const& subject_) + : subject(subject_) {} template <typename Context, typename Iterator> struct attribute @@ -57,9 +57,9 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Context , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last - , Context& context, Skipper const& skipper, Attribute& attr) const + , Context& context, Skipper const& skipper, Attribute& attr_) const { - return subject.parse(first, last, context, skipper, attr); + return subject.parse(first, last, context, skipper, attr_); } template <typename Context> diff --git a/boost/spirit/home/qi/directive/raw.hpp b/boost/spirit/home/qi/directive/raw.hpp index b88458ea28..e1d208e759 100644 --- a/boost/spirit/home/qi/directive/raw.hpp +++ b/boost/spirit/home/qi/directive/raw.hpp @@ -44,8 +44,8 @@ namespace boost { namespace spirit { namespace qi struct raw_directive : unary_parser<raw_directive<Subject> > { typedef Subject subject_type; - raw_directive(Subject const& subject) - : subject(subject) {} + raw_directive(Subject const& subject_) + : subject(subject_) {} template <typename Context, typename Iterator> struct attribute @@ -56,13 +56,13 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Context , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last - , Context& context, Skipper const& skipper, Attribute& attr) const + , Context& context, Skipper const& skipper, Attribute& attr_) const { qi::skip_over(first, last, skipper); Iterator i = first; if (subject.parse(i, last, context, skipper, unused)) { - spirit::traits::assign_to(first, i, attr); + spirit::traits::assign_to(first, i, attr_); first = i; return true; } diff --git a/boost/spirit/home/qi/directive/repeat.hpp b/boost/spirit/home/qi/directive/repeat.hpp index 252e18f743..72c3a998be 100644 --- a/boost/spirit/home/qi/directive/repeat.hpp +++ b/boost/spirit/home/qi/directive/repeat.hpp @@ -81,8 +81,8 @@ namespace boost { namespace spirit { namespace qi template <typename T> struct exact_iterator // handles repeat(exact)[p] { - exact_iterator(T const exact) - : exact(exact) {} + exact_iterator(T const exact_) + : exact(exact_) {} typedef T type; T start() const { return 0; } @@ -99,9 +99,9 @@ namespace boost { namespace spirit { namespace qi template <typename T> struct finite_iterator // handles repeat(min, max)[p] { - finite_iterator(T const min, T const max) - : min BOOST_PREVENT_MACRO_SUBSTITUTION (min) - , max BOOST_PREVENT_MACRO_SUBSTITUTION (max) {} + finite_iterator(T const min_, T const max_) + : min BOOST_PREVENT_MACRO_SUBSTITUTION (min_) + , max BOOST_PREVENT_MACRO_SUBSTITUTION (max_) {} typedef T type; T start() const { return 0; } @@ -119,8 +119,8 @@ namespace boost { namespace spirit { namespace qi template <typename T> struct infinite_iterator // handles repeat(min, inf)[p] { - infinite_iterator(T const min) - : min BOOST_PREVENT_MACRO_SUBSTITUTION (min) {} + infinite_iterator(T const min_) + : min BOOST_PREVENT_MACRO_SUBSTITUTION (min_) {} typedef T type; T start() const { return 0; } @@ -153,8 +153,8 @@ namespace boost { namespace spirit { namespace qi type; }; - repeat_parser(Subject const& subject, LoopIter const& iter) - : subject(subject), iter(iter) {} + repeat_parser(Subject const& subject_, LoopIter const& iter_) + : subject(subject_), iter(iter_) {} template <typename F> bool parse_container(F f) const @@ -183,17 +183,17 @@ namespace boost { namespace spirit { namespace qi , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& context, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_) const { typedef detail::fail_function<Iterator, Context, Skipper> fail_function; // ensure the attribute is actually a container type - traits::make_container(attr); + traits::make_container(attr_); - Iterator iter = first; - fail_function f(iter, last, context, skipper); - if (!parse_container(detail::make_pass_container(f, attr))) + Iterator iter_local = first; + fail_function f(iter_local, last, context, skipper); + if (!parse_container(detail::make_pass_container(f, attr_))) return false; first = f.first; diff --git a/boost/spirit/home/qi/directive/skip.hpp b/boost/spirit/home/qi/directive/skip.hpp index 28539da3a0..6cc6f77454 100644 --- a/boost/spirit/home/qi/directive/skip.hpp +++ b/boost/spirit/home/qi/directive/skip.hpp @@ -26,6 +26,7 @@ #include <boost/spirit/home/support/handles_container.hpp> #include <boost/fusion/include/at.hpp> #include <boost/fusion/include/vector.hpp> +#include <boost/utility/enable_if.hpp> namespace boost { namespace spirit { @@ -70,17 +71,28 @@ namespace boost { namespace spirit { namespace qi type; }; - reskip_parser(Subject const& subject) - : subject(subject) {} + reskip_parser(Subject const& subject_) + : subject(subject_) {} template <typename Iterator, typename Context , typename Skipper, typename Attribute> - bool parse(Iterator& first, Iterator const& last + typename enable_if<detail::is_unused_skipper<Skipper>, bool>::type + parse(Iterator& first, Iterator const& last , Context& context, Skipper const& u // --> The skipper is reintroduced - , Attribute& attr) const + , Attribute& attr_) const + { + return subject.parse(first, last, context + , detail::get_skipper(u), attr_); + } + template <typename Iterator, typename Context + , typename Skipper, typename Attribute> + typename disable_if<detail::is_unused_skipper<Skipper>, bool>::type + parse(Iterator& first, Iterator const& last + , Context& context, Skipper const& skipper + , Attribute& attr_) const { return subject.parse(first, last, context - , detail::get_skipper(u), attr); + , skipper, attr_); } template <typename Context> @@ -106,16 +118,16 @@ namespace boost { namespace spirit { namespace qi type; }; - skip_parser(Subject const& subject, Skipper const& skipper) - : subject(subject), skipper(skipper) {} + skip_parser(Subject const& subject_, Skipper const& skipper_) + : subject(subject_), skipper(skipper_) {} template <typename Iterator, typename Context , typename Skipper_, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& context, Skipper_ const& //skipper --> bypass the supplied skipper - , Attribute& attr) const + , Attribute& attr_) const { - return subject.parse(first, last, context, skipper, attr); + return subject.parse(first, last, context, skipper, attr_); } template <typename Context> diff --git a/boost/spirit/home/qi/nonterminal/debug_handler.hpp b/boost/spirit/home/qi/nonterminal/debug_handler.hpp index 33287327cc..6a9f536699 100644 --- a/boost/spirit/home/qi/nonterminal/debug_handler.hpp +++ b/boost/spirit/home/qi/nonterminal/debug_handler.hpp @@ -36,12 +36,12 @@ namespace boost { namespace spirit { namespace qi function_type; debug_handler( - function_type subject - , F f - , std::string const& rule_name) - : subject(subject) - , f(f) - , rule_name(rule_name) + function_type subject_ + , F f_ + , std::string const& rule_name_) + : subject(subject_) + , f(f_) + , rule_name(rule_name_) { } diff --git a/boost/spirit/home/qi/nonterminal/detail/parameterized.hpp b/boost/spirit/home/qi/nonterminal/detail/parameterized.hpp index 0300a06b7e..825fa40732 100644 --- a/boost/spirit/home/qi/nonterminal/detail/parameterized.hpp +++ b/boost/spirit/home/qi/nonterminal/detail/parameterized.hpp @@ -27,8 +27,8 @@ namespace boost { namespace spirit { namespace qi struct parameterized_nonterminal : parser<parameterized_nonterminal<Subject, Params> > { - parameterized_nonterminal(Subject const& subject, Params const& params) - : ref(subject), params(params) + parameterized_nonterminal(Subject const& subject, Params const& params_) + : ref(subject), params(params_) { } @@ -41,11 +41,11 @@ namespace boost { namespace spirit { namespace qi , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& context, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_) const { // Forward to subject, passing the additional // params argument to parse. - return ref.get().parse(first, last, context, skipper, attr, params); + return ref.get().parse(first, last, context, skipper, attr_, params); } template <typename Context> diff --git a/boost/spirit/home/qi/nonterminal/detail/parser_binder.hpp b/boost/spirit/home/qi/nonterminal/detail/parser_binder.hpp index 91bceba88e..87d8e84ec4 100644 --- a/boost/spirit/home/qi/nonterminal/detail/parser_binder.hpp +++ b/boost/spirit/home/qi/nonterminal/detail/parser_binder.hpp @@ -21,8 +21,8 @@ namespace boost { namespace spirit { namespace qi { namespace detail template <typename Parser, typename Auto> struct parser_binder { - parser_binder(Parser const& p) - : p(p) {} + parser_binder(Parser const& p_) + : p(p_) {} template <typename Iterator, typename Skipper, typename Context> bool call(Iterator& first, Iterator const& last @@ -60,8 +60,8 @@ namespace boost { namespace spirit { namespace qi { namespace detail template <typename Parser> struct parser_binder<Parser, mpl::true_> { - parser_binder(Parser const& p) - : p(p) {} + parser_binder(Parser const& p_) + : p(p_) {} template <typename Iterator, typename Skipper, typename Context> bool operator()( diff --git a/boost/spirit/home/qi/nonterminal/error_handler.hpp b/boost/spirit/home/qi/nonterminal/error_handler.hpp index 6dd4f08123..e8c4f8771a 100644 --- a/boost/spirit/home/qi/nonterminal/error_handler.hpp +++ b/boost/spirit/home/qi/nonterminal/error_handler.hpp @@ -76,9 +76,9 @@ namespace boost { namespace spirit { namespace qi )> function_type; - error_handler(function_type subject, F f) - : subject(subject) - , f(f) + error_handler(function_type subject_, F f_) + : subject(subject_) + , f(f_) { } diff --git a/boost/spirit/home/qi/nonterminal/grammar.hpp b/boost/spirit/home/qi/nonterminal/grammar.hpp index 982e49b91e..d41590cab9 100644 --- a/boost/spirit/home/qi/nonterminal/grammar.hpp +++ b/boost/spirit/home/qi/nonterminal/grammar.hpp @@ -56,9 +56,9 @@ namespace boost { namespace spirit { namespace qi grammar( start_type const& start - , std::string const& name_ = "unnamed-grammar") + , std::string const& name = "unnamed-grammar") : proto::extends<terminal, base_type>(terminal::make(reference_(start))) - , name_(name_) + , name_(name) {} // This constructor is used to catch if the start rule is not @@ -90,10 +90,10 @@ namespace boost { namespace spirit { namespace qi template <typename Context, typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& context, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_) const { return this->proto_base().child0.parse( - first, last, context, skipper, attr); + first, last, context, skipper, attr_); } template <typename Context> diff --git a/boost/spirit/home/qi/nonterminal/rule.hpp b/boost/spirit/home/qi/nonterminal/rule.hpp index 23d25595a0..8dd42373b0 100644 --- a/boost/spirit/home/qi/nonterminal/rule.hpp +++ b/boost/spirit/home/qi/nonterminal/rule.hpp @@ -41,6 +41,7 @@ #if defined(BOOST_MSVC) # pragma warning(push) # pragma warning(disable: 4355) // 'this' : used in base member initializer list warning +# pragma warning(disable: 4127) // conditional expression is constant #endif namespace boost { namespace spirit { namespace qi @@ -154,9 +155,9 @@ namespace boost { namespace spirit { namespace qi >::type encoding_modifier_type; - explicit rule(std::string const& name_ = "unnamed-rule") + explicit rule(std::string const& name = "unnamed-rule") : base_type(terminal::make(reference_(*this))) - , name_(name_) + , name_(name) { } @@ -168,7 +169,7 @@ namespace boost { namespace spirit { namespace qi } 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, @@ -184,9 +185,9 @@ namespace boost { namespace spirit { namespace qi } template <typename Expr> - rule(Expr const& expr, std::string const& name_ = "unnamed-rule") + rule(Expr const& expr, std::string const& name = "unnamed-rule") : base_type(terminal::make(reference_(*this))) - , name_(name_) + , name_(name) { define<mpl::false_>(*this, expr, traits::matches<qi::domain, Expr>()); } @@ -231,7 +232,7 @@ namespace boost { namespace spirit { namespace qi return r; } -#if defined(BOOST_NO_RVALUE_REFERENCES) +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) // non-const version needed to suppress proto's %= kicking in template <typename Expr> friend rule& operator%=(rule& r, Expr& expr) @@ -272,7 +273,7 @@ namespace boost { namespace spirit { namespace qi template <typename Context, typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& /*context*/, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_param) const { if (f) { @@ -288,7 +289,7 @@ namespace boost { namespace spirit { namespace qi typename make_attribute::type, attr_type, domain> transform; - typename make_attribute::type made_attr = make_attribute::call(attr); + typename make_attribute::type made_attr = make_attribute::call(attr_param); typename transform::type attr_ = transform::pre(made_attr); // If you are seeing a compilation error here, you are probably @@ -304,12 +305,12 @@ namespace boost { namespace spirit { namespace qi { // do up-stream transformation, this integrates the results // back into the original attribute value, if appropriate - traits::post_transform(attr, attr_); + traits::post_transform(attr_param, attr_); return true; } // inform attribute transformation of failed rhs - traits::fail_transform(attr, attr_); + traits::fail_transform(attr_param, attr_); } return false; } @@ -318,7 +319,7 @@ namespace boost { namespace spirit { namespace qi , typename Attribute, typename Params> bool parse(Iterator& first, Iterator const& last , Context& caller_context, Skipper const& skipper - , Attribute& attr, Params const& params) const + , Attribute& attr_param, Params const& params) const { if (f) { @@ -334,7 +335,7 @@ namespace boost { namespace spirit { namespace qi typename make_attribute::type, attr_type, domain> transform; - typename make_attribute::type made_attr = make_attribute::call(attr); + typename make_attribute::type made_attr = make_attribute::call(attr_param); typename transform::type attr_ = transform::pre(made_attr); // If you are seeing a compilation error here, you are probably @@ -350,12 +351,12 @@ namespace boost { namespace spirit { namespace qi { // do up-stream transformation, this integrates the results // back into the original attribute value, if appropriate - traits::post_transform(attr, attr_); + traits::post_transform(attr_param, attr_); return true; } // inform attribute transformation of failed rhs - traits::fail_transform(attr, attr_); + traits::fail_transform(attr_param, attr_); } return false; } diff --git a/boost/spirit/home/qi/nonterminal/success_handler.hpp b/boost/spirit/home/qi/nonterminal/success_handler.hpp index 3b3133c7fb..5db83a2aa3 100644 --- a/boost/spirit/home/qi/nonterminal/success_handler.hpp +++ b/boost/spirit/home/qi/nonterminal/success_handler.hpp @@ -29,9 +29,9 @@ namespace boost { namespace spirit { namespace qi )> function_type; - success_handler(function_type subject, F f) - : subject(subject) - , f(f) + success_handler(function_type subject_, F f_) + : subject(subject_) + , f(f_) { } diff --git a/boost/spirit/home/qi/numeric/bool.hpp b/boost/spirit/home/qi/numeric/bool.hpp index 4041fc388d..74e1343918 100644 --- a/boost/spirit/home/qi/numeric/bool.hpp +++ b/boost/spirit/home/qi/numeric/bool.hpp @@ -153,11 +153,11 @@ namespace boost { namespace spirit { namespace qi , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& /*context*/, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_) const { typedef detail::bool_impl<T, BoolPolicies> extract; qi::skip_over(first, last, skipper); - return extract::parse(first, last, attr, BoolPolicies()); + return extract::parse(first, last, attr_, BoolPolicies()); } template <typename Context> @@ -184,11 +184,11 @@ namespace boost { namespace spirit { namespace qi , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& /*context*/, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_) const { typedef detail::bool_impl<T, BoolPolicies> extract; qi::skip_over(first, last, skipper); - return extract::parse(first, last, attr, BoolPolicies(), n_, n_); + return extract::parse(first, last, attr_, BoolPolicies(), n_, n_); } template <typename Context> diff --git a/boost/spirit/home/qi/numeric/bool_policies.hpp b/boost/spirit/home/qi/numeric/bool_policies.hpp index 1e7c6e5164..62641a6036 100644 --- a/boost/spirit/home/qi/numeric/bool_policies.hpp +++ b/boost/spirit/home/qi/numeric/bool_policies.hpp @@ -24,11 +24,11 @@ namespace boost { namespace spirit { namespace qi { template <typename Iterator, typename Attribute> static bool - parse_true(Iterator& first, Iterator const& last, Attribute& attr) + parse_true(Iterator& first, Iterator const& last, Attribute& attr_) { if (detail::string_parse("true", first, last, unused)) { - spirit::traits::assign_to(T(true), attr); // result is true + spirit::traits::assign_to(T(true), attr_); // result is true return true; } return false; @@ -36,11 +36,11 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Attribute> static bool - parse_false(Iterator& first, Iterator const& last, Attribute& attr) + parse_false(Iterator& first, Iterator const& last, Attribute& attr_) { if (detail::string_parse("false", first, last, unused)) { - spirit::traits::assign_to(T(false), attr); // result is false + spirit::traits::assign_to(T(false), attr_); // result is false return true; } return false; @@ -53,11 +53,11 @@ namespace boost { namespace spirit { namespace qi { template <typename Iterator, typename Attribute> static bool - parse_true(Iterator& first, Iterator const& last, Attribute& attr) + parse_true(Iterator& first, Iterator const& last, Attribute& attr_) { if (detail::string_parse("true", "TRUE", first, last, unused)) { - spirit::traits::assign_to(T(true), attr); // result is true + spirit::traits::assign_to(T(true), attr_); // result is true return true; } return false; @@ -65,11 +65,11 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Attribute> static bool - parse_false(Iterator& first, Iterator const& last, Attribute& attr) + parse_false(Iterator& first, Iterator const& last, Attribute& attr_) { if (detail::string_parse("false", "FALSE", first, last, unused)) { - spirit::traits::assign_to(T(false), attr); // result is false + spirit::traits::assign_to(T(false), attr_); // result is false return true; } return false; diff --git a/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp b/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp index f57c4d7214..5137f87f10 100644 --- a/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp +++ b/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp @@ -19,6 +19,7 @@ #include <boost/spirit/home/support/unused.hpp> #include <boost/spirit/home/qi/detail/attributes.hpp> #include <boost/spirit/home/support/char_encoding/ascii.hpp> +#include <boost/spirit/home/support/numeric_traits.hpp> #include <boost/preprocessor/repetition/repeat.hpp> #include <boost/preprocessor/iteration/local.hpp> #include <boost/preprocessor/comparison/less.hpp> @@ -227,7 +228,7 @@ namespace boost { namespace spirit { namespace qi { namespace detail ( (MaxDigits < 0) || (MaxDigits > digits_traits<T, Radix>::value) ) - && std::numeric_limits<T>::is_modulo + && traits::check_overflow<T>::value >() ); } diff --git a/boost/spirit/home/qi/numeric/int.hpp b/boost/spirit/home/qi/numeric/int.hpp index a30bb3f15d..68e214cef7 100644 --- a/boost/spirit/home/qi/numeric/int.hpp +++ b/boost/spirit/home/qi/numeric/int.hpp @@ -19,6 +19,7 @@ #include <boost/spirit/home/qi/parser.hpp> #include <boost/spirit/home/support/common_terminals.hpp> #include <boost/spirit/home/support/info.hpp> +#include <boost/spirit/home/support/detail/is_spirit_tag.hpp> #include <boost/mpl/assert.hpp> #include <boost/type_traits/is_same.hpp> @@ -28,7 +29,10 @@ namespace boost { namespace spirit { template <typename T, unsigned Radix, unsigned MinDigits , int MaxDigits> - struct int_parser {}; + struct int_parser + { + BOOST_SPIRIT_IS_TAG() + }; } namespace qi @@ -198,11 +202,11 @@ namespace boost { namespace spirit { namespace qi , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& /*context*/, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_) const { typedef extract_int<T, Radix, MinDigits, MaxDigits> extract; qi::skip_over(first, last, skipper); - return extract::call(first, last, attr); + return extract::call(first, last, attr_); } template <typename Context> @@ -236,7 +240,7 @@ namespace boost { namespace spirit { namespace qi , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& /*context*/, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_param) const { typedef extract_int<T, Radix, MinDigits, MaxDigits> extract; qi::skip_over(first, last, skipper); @@ -246,7 +250,7 @@ namespace boost { namespace spirit { namespace qi if (extract::call(first, last, attr_) && (attr_ == n_)) { - traits::assign_to(attr_, attr); + traits::assign_to(attr_, attr_param); return true; } diff --git a/boost/spirit/home/qi/numeric/numeric_utils.hpp b/boost/spirit/home/qi/numeric/numeric_utils.hpp index 72a54d8fd4..eebf40a0fa 100644 --- a/boost/spirit/home/qi/numeric/numeric_utils.hpp +++ b/boost/spirit/home/qi/numeric/numeric_utils.hpp @@ -53,7 +53,7 @@ namespace boost { namespace spirit { namespace qi not_supported_radix, ()); template <typename Iterator> - inline static bool call(Iterator& first, Iterator const& last, T& attr) + inline static bool call(Iterator& first, Iterator const& last, T& attr_) { if (first == last) return false; @@ -69,7 +69,7 @@ namespace boost { namespace spirit { namespace qi Iterator save = first; if (!extract_type::parse(first, last, - detail::cast_unsigned<T>::call(attr))) + detail::cast_unsigned<T>::call(attr_))) { first = save; return false; @@ -81,10 +81,10 @@ namespace boost { namespace spirit { namespace qi inline static bool call(Iterator& first, Iterator const& last, Attribute& attr_) { // this case is called when Attribute is not T - T attr; - if (call(first, last, attr)) + T attr_local; + if (call(first, last, attr_local)) { - traits::assign_to(attr, attr_); + traits::assign_to(attr_local, attr_); return true; } return false; @@ -103,7 +103,7 @@ namespace boost { namespace spirit { namespace qi not_supported_radix, ()); template <typename Iterator> - inline static bool call(Iterator& first, Iterator const& last, T& attr) + inline static bool call(Iterator& first, Iterator const& last, T& attr_) { if (first == last) return false; @@ -119,9 +119,9 @@ namespace boost { namespace spirit { namespace qi Iterator save = first; bool hit = extract_sign(first, last); if (hit) - hit = extract_neg_type::parse(first, last, attr); + hit = extract_neg_type::parse(first, last, attr_); else - hit = extract_pos_type::parse(first, last, attr); + hit = extract_pos_type::parse(first, last, attr_); if (!hit) { @@ -135,10 +135,10 @@ namespace boost { namespace spirit { namespace qi inline static bool call(Iterator& first, Iterator const& last, Attribute& attr_) { // this case is called when Attribute is not T - T attr; - if (call(first, last, attr)) + T attr_local; + if (call(first, last, attr_local)) { - traits::assign_to(attr, attr_); + traits::assign_to(attr_local, attr_); return true; } return false; diff --git a/boost/spirit/home/qi/numeric/real.hpp b/boost/spirit/home/qi/numeric/real.hpp index 325acd5ad7..27d48e50aa 100644 --- a/boost/spirit/home/qi/numeric/real.hpp +++ b/boost/spirit/home/qi/numeric/real.hpp @@ -161,24 +161,24 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Context, typename Skipper> bool parse(Iterator& first, Iterator const& last , Context& /*context*/, Skipper const& skipper - , T& attr) const + , T& attr_) const { typedef detail::real_impl<T, RealPolicies> extract; qi::skip_over(first, last, skipper); - return extract::parse(first, last, attr, RealPolicies()); + return extract::parse(first, last, attr_, RealPolicies()); } template <typename Iterator, typename Context , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& context, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_param) const { // this case is called when Attribute is not T T attr_; if (parse(first, last, context, skipper, attr_)) { - traits::assign_to(attr_, attr); + traits::assign_to(attr_, attr_param); return true; } return false; @@ -207,8 +207,8 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Context , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last - , Context& context, Skipper const& skipper - , Attribute& attr) const + , Context&, Skipper const& skipper + , Attribute& attr_param) const { typedef detail::real_impl<T, RealPolicies> extract; qi::skip_over(first, last, skipper); @@ -219,7 +219,7 @@ namespace boost { namespace spirit { namespace qi if (extract::parse(first, last, attr_, RealPolicies()) && (attr_ == n_)) { - traits::assign_to(attr_, attr); + traits::assign_to(attr_, attr_param); return true; } diff --git a/boost/spirit/home/qi/numeric/real_policies.hpp b/boost/spirit/home/qi/numeric/real_policies.hpp index 6512d6f3f7..d4f5654b5b 100644 --- a/boost/spirit/home/qi/numeric/real_policies.hpp +++ b/boost/spirit/home/qi/numeric/real_policies.hpp @@ -37,9 +37,9 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Attribute> static bool - parse_n(Iterator& first, Iterator const& last, Attribute& attr) + parse_n(Iterator& first, Iterator const& last, Attribute& attr_) { - return extract_uint<T, 10, 1, -1>::call(first, last, attr); + return extract_uint<T, 10, 1, -1>::call(first, last, attr_); } template <typename Iterator> @@ -54,9 +54,9 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Attribute> static bool - parse_frac_n(Iterator& first, Iterator const& last, Attribute& attr) + parse_frac_n(Iterator& first, Iterator const& last, Attribute& attr_) { - return extract_uint<T, 10, 1, -1, true>::call(first, last, attr); + return extract_uint<T, 10, 1, -1, true>::call(first, last, attr_); } template <typename Iterator> @@ -71,9 +71,9 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator> static bool - parse_exp_n(Iterator& first, Iterator const& last, int& attr) + parse_exp_n(Iterator& first, Iterator const& last, int& attr_) { - return extract_int<int, 10, 1, -1>::call(first, last, attr); + return extract_int<int, 10, 1, -1>::call(first, last, attr_); } /////////////////////////////////////////////////////////////////////// @@ -105,7 +105,7 @@ namespace boost { namespace spirit { namespace qi /////////////////////////////////////////////////////////////////////// template <typename Iterator, typename Attribute> static bool - parse_nan(Iterator& first, Iterator const& last, Attribute& attr) + parse_nan(Iterator& first, Iterator const& last, Attribute& attr_) { if (first == last) return false; // end of input reached @@ -116,7 +116,7 @@ namespace boost { namespace spirit { namespace qi // nan[(...)] ? if (detail::string_parse("nan", "NAN", first, last, unused)) { - if (*first == '(') + if (first != last && *first == '(') { // skip trailing (...) part Iterator i = first; @@ -128,7 +128,7 @@ namespace boost { namespace spirit { namespace qi first = ++i; } - attr = std::numeric_limits<T>::quiet_NaN(); + attr_ = std::numeric_limits<T>::quiet_NaN(); return true; } return false; @@ -136,7 +136,7 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Attribute> static bool - parse_inf(Iterator& first, Iterator const& last, Attribute& attr) + parse_inf(Iterator& first, Iterator const& last, Attribute& attr_) { if (first == last) return false; // end of input reached @@ -149,7 +149,7 @@ namespace boost { namespace spirit { namespace qi { // skip allowed 'inity' part of infinity detail::string_parse("inity", "INITY", first, last, unused); - attr = std::numeric_limits<T>::infinity(); + attr_ = std::numeric_limits<T>::infinity(); return true; } return false; diff --git a/boost/spirit/home/qi/numeric/uint.hpp b/boost/spirit/home/qi/numeric/uint.hpp index ea763d356c..f6d1efde37 100644 --- a/boost/spirit/home/qi/numeric/uint.hpp +++ b/boost/spirit/home/qi/numeric/uint.hpp @@ -235,11 +235,11 @@ namespace boost { namespace spirit { namespace qi , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& /*context*/, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_) const { typedef extract_uint<T, Radix, MinDigits, MaxDigits> extract; qi::skip_over(first, last, skipper); - return extract::call(first, last, attr); + return extract::call(first, last, attr_); } template <typename Context> @@ -273,7 +273,7 @@ namespace boost { namespace spirit { namespace qi , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& /*context*/, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_param) const { typedef extract_uint<T, Radix, MinDigits, MaxDigits> extract; qi::skip_over(first, last, skipper); @@ -283,7 +283,7 @@ namespace boost { namespace spirit { namespace qi if (extract::call(first, last, attr_) && (attr_ == n_)) { - traits::assign_to(attr_, attr); + traits::assign_to(attr_, attr_param); return true; } diff --git a/boost/spirit/home/qi/operator/alternative.hpp b/boost/spirit/home/qi/operator/alternative.hpp index 9785d45101..22cfdeff56 100644 --- a/boost/spirit/home/qi/operator/alternative.hpp +++ b/boost/spirit/home/qi/operator/alternative.hpp @@ -63,17 +63,17 @@ namespace boost { namespace spirit { namespace qi type; }; - alternative(Elements const& elements) - : elements(elements) {} + alternative(Elements const& elements_) + : elements(elements_) {} template <typename Iterator, typename Context , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& context, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_) const { detail::alternative_function<Iterator, Context, Skipper, Attribute> - f(first, last, context, skipper, attr); + f(first, last, context, skipper, attr_); // return true if *any* of the parsers succeed return fusion::any(elements, f); diff --git a/boost/spirit/home/qi/operator/and_predicate.hpp b/boost/spirit/home/qi/operator/and_predicate.hpp index 031ce1df01..0554c10d6d 100644 --- a/boost/spirit/home/qi/operator/and_predicate.hpp +++ b/boost/spirit/home/qi/operator/and_predicate.hpp @@ -43,8 +43,8 @@ namespace boost { namespace spirit { namespace qi typedef unused_type type; }; - and_predicate(Subject const& subject) - : subject(subject) {} + and_predicate(Subject const& subject_) + : subject(subject_) {} template <typename Iterator, typename Context , typename Skipper, typename Attribute> diff --git a/boost/spirit/home/qi/operator/difference.hpp b/boost/spirit/home/qi/operator/difference.hpp index 5f8c4c90cc..f703d7f9e5 100644 --- a/boost/spirit/home/qi/operator/difference.hpp +++ b/boost/spirit/home/qi/operator/difference.hpp @@ -46,14 +46,14 @@ namespace boost { namespace spirit { namespace qi type; }; - difference(Left const& left, Right const& right) - : left(left), right(right) {} + difference(Left const& left_, Right const& right_) + : left(left_), right(right_) {} template <typename Iterator, typename Context , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& context, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_) const { // Unlike classic Spirit, with this version of difference, the rule // lit("policeman") - "police" will always fail to match. @@ -71,7 +71,7 @@ namespace boost { namespace spirit { namespace qi return false; } // RHS fails, now try LHS - return left.parse(first, last, context, skipper, attr); + return left.parse(first, last, context, skipper, attr_); } template <typename Context> diff --git a/boost/spirit/home/qi/operator/expect.hpp b/boost/spirit/home/qi/operator/expect.hpp index c42b2defc9..ff279fd5d1 100644 --- a/boost/spirit/home/qi/operator/expect.hpp +++ b/boost/spirit/home/qi/operator/expect.hpp @@ -39,9 +39,9 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator> struct expectation_failure : std::runtime_error { - expectation_failure(Iterator first, Iterator last, info const& what) + expectation_failure(Iterator first_, Iterator last_, info const& what) : std::runtime_error("boost::spirit::qi::expectation_failure") - , first(first), last(last), what_(what) + , first(first_), last(last_), what_(what) {} ~expectation_failure() throw() {} diff --git a/boost/spirit/home/qi/operator/kleene.hpp b/boost/spirit/home/qi/operator/kleene.hpp index ae778f0bf7..798e63d675 100644 --- a/boost/spirit/home/qi/operator/kleene.hpp +++ b/boost/spirit/home/qi/operator/kleene.hpp @@ -56,8 +56,8 @@ namespace boost { namespace spirit { namespace qi type; }; - kleene(Subject const& subject) - : subject(subject) {} + kleene(Subject const& subject_) + : subject(subject_) {} template <typename F> bool parse_container(F f) const @@ -71,17 +71,17 @@ namespace boost { namespace spirit { namespace qi , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& context, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_) const { // ensure the attribute is actually a container type - traits::make_container(attr); + traits::make_container(attr_); typedef detail::fail_function<Iterator, Context, Skipper> fail_function; Iterator iter = first; fail_function f(iter, last, context, skipper); - parse_container(detail::make_pass_container(f, attr)); + parse_container(detail::make_pass_container(f, attr_)); first = f.first; return true; diff --git a/boost/spirit/home/qi/operator/list.hpp b/boost/spirit/home/qi/operator/list.hpp index cc067cd342..c5b3ef6cd3 100644 --- a/boost/spirit/home/qi/operator/list.hpp +++ b/boost/spirit/home/qi/operator/list.hpp @@ -55,8 +55,8 @@ namespace boost { namespace spirit { namespace qi type; }; - list(Left const& left, Right const& right) - : left(left), right(right) {} + list(Left const& left_, Right const& right_) + : left(left_), right(right_) {} template <typename F> bool parse_container(F f) const @@ -80,17 +80,17 @@ namespace boost { namespace spirit { namespace qi , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& context, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_) const { typedef detail::fail_function<Iterator, Context, Skipper> fail_function; // ensure the attribute is actually a container type - traits::make_container(attr); + traits::make_container(attr_); Iterator iter = first; fail_function f(iter, last, context, skipper); - if (!parse_container(detail::make_pass_container(f, attr))) + if (!parse_container(detail::make_pass_container(f, attr_))) return false; first = f.first; diff --git a/boost/spirit/home/qi/operator/not_predicate.hpp b/boost/spirit/home/qi/operator/not_predicate.hpp index 57cbb0db4a..1fb81cd6e0 100644 --- a/boost/spirit/home/qi/operator/not_predicate.hpp +++ b/boost/spirit/home/qi/operator/not_predicate.hpp @@ -42,8 +42,8 @@ namespace boost { namespace spirit { namespace qi typedef unused_type type; }; - not_predicate(Subject const& subject) - : subject(subject) {} + not_predicate(Subject const& subject_) + : subject(subject_) {} template <typename Iterator, typename Context , typename Skipper, typename Attribute> diff --git a/boost/spirit/home/qi/operator/optional.hpp b/boost/spirit/home/qi/operator/optional.hpp index b183ad6f60..0f7698de72 100644 --- a/boost/spirit/home/qi/operator/optional.hpp +++ b/boost/spirit/home/qi/operator/optional.hpp @@ -55,23 +55,23 @@ namespace boost { namespace spirit { namespace qi type; }; - optional(Subject const& subject) - : subject(subject) {} + optional(Subject const& subject_) + : subject(subject_) {} template <typename Iterator, typename Context , typename Skipper, typename Attribute> bool parse_impl(Iterator& first, Iterator const& last , Context& context, Skipper const& skipper - , Attribute& attr, mpl::false_) const + , Attribute& attr_, mpl::false_) const { // create a local value if Attribute is not unused_type - typename spirit::result_of::optional_value<Attribute>::type val = + typename spirit::result_of::optional_value<Attribute>::type val = typename spirit::result_of::optional_value<Attribute>::type(); if (subject.parse(first, last, context, skipper, val)) { // assign the parsed value into our attribute - spirit::traits::assign_to(val, attr); + spirit::traits::assign_to(val, attr_); } return true; } @@ -80,9 +80,9 @@ namespace boost { namespace spirit { namespace qi , typename Skipper, typename Attribute> bool parse_impl(Iterator& first, Iterator const& last , Context& context, Skipper const& skipper - , Attribute& attr, mpl::true_) const + , Attribute& attr_, mpl::true_) const { - subject.parse(first, last, context, skipper, attr); + subject.parse(first, last, context, skipper, attr_); return true; } @@ -90,12 +90,12 @@ namespace boost { namespace spirit { namespace qi , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& context, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_) const { - typedef typename spirit::result_of::optional_value<Attribute>::type + typedef typename spirit::result_of::optional_value<Attribute>::type attribute_type; - return parse_impl(first, last, context, skipper, attr + return parse_impl(first, last, context, skipper, attr_ , traits::is_container<attribute_type>()); } diff --git a/boost/spirit/home/qi/operator/permutation.hpp b/boost/spirit/home/qi/operator/permutation.hpp index 1dcad89e10..cadfa24e77 100644 --- a/boost/spirit/home/qi/operator/permutation.hpp +++ b/boost/spirit/home/qi/operator/permutation.hpp @@ -62,8 +62,8 @@ namespace boost { namespace spirit { namespace qi type; }; - permutation(Elements const& elements) - : elements(elements) {} + permutation(Elements const& elements_) + : elements(elements_) {} template <typename Iterator, typename Context , typename Skipper, typename Attribute> @@ -82,7 +82,7 @@ namespace boost { namespace spirit { namespace qi } // wrap the attribute in a tuple if it is not a tuple - typename traits::wrap_if_not_tuple<Attribute>::type attr(attr_); + typename traits::wrap_if_not_tuple<Attribute>::type attr_local(attr_); // We have a bool array 'flags' with one flag for each parser. // permute_function sets the slot to true when the corresponding @@ -91,7 +91,7 @@ namespace boost { namespace spirit { namespace qi bool result = false; f.taken = flags.begin(); - while (spirit::any_if_ns(elements, attr, f, predicate())) + while (spirit::any_if_ns(elements, attr_local, f, predicate())) { f.taken = flags.begin(); result = true; diff --git a/boost/spirit/home/qi/operator/plus.hpp b/boost/spirit/home/qi/operator/plus.hpp index 780403a2ca..3c08d1fabe 100644 --- a/boost/spirit/home/qi/operator/plus.hpp +++ b/boost/spirit/home/qi/operator/plus.hpp @@ -53,8 +53,8 @@ namespace boost { namespace spirit { namespace qi type; }; - plus(Subject const& subject) - : subject(subject) {} + plus(Subject const& subject_) + : subject(subject_) {} template <typename F> bool parse_container(F f) const @@ -72,17 +72,17 @@ namespace boost { namespace spirit { namespace qi , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& context, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_) const { typedef detail::fail_function<Iterator, Context, Skipper> fail_function; // ensure the attribute is actually a container type - traits::make_container(attr); + traits::make_container(attr_); Iterator iter = first; fail_function f(iter, last, context, skipper); - if (!parse_container(detail::make_pass_container(f, attr))) + if (!parse_container(detail::make_pass_container(f, attr_))) return false; first = f.first; diff --git a/boost/spirit/home/qi/operator/sequence_base.hpp b/boost/spirit/home/qi/operator/sequence_base.hpp index 35f45dfaa3..366468602e 100644 --- a/boost/spirit/home/qi/operator/sequence_base.hpp +++ b/boost/spirit/home/qi/operator/sequence_base.hpp @@ -60,8 +60,8 @@ namespace boost { namespace spirit { namespace qi type; }; - sequence_base(Elements const& elements) - : elements(elements) {} + sequence_base(Elements const& elements_) + : elements(elements_) {} // standard case. Attribute is a fusion tuple template <typename Iterator, typename Context @@ -80,11 +80,11 @@ namespace boost { namespace spirit { namespace qi , typename mpl::and_< traits::one_element_sequence<attr_type_> , mpl::not_<traits::one_element_sequence<Attribute> > - >::type - >::type attr(attr_); + >::type + >::type attr_local(attr_); // return false if *any* of the parsers fail - if (spirit::any_if(elements, attr + if (spirit::any_if(elements, attr_local , Derived::fail_function(iter, last, context, skipper), predicate())) return false; first = iter; @@ -118,9 +118,9 @@ namespace boost { namespace spirit { namespace qi , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& context, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_) const { - return parse_impl(first, last, context, skipper, attr + return parse_impl(first, last, context, skipper, attr_ , traits::is_container<Attribute>()); } diff --git a/boost/spirit/home/qi/operator/sequential_or.hpp b/boost/spirit/home/qi/operator/sequential_or.hpp index 80b86f38e4..a4c9c0ceca 100644 --- a/boost/spirit/home/qi/operator/sequential_or.hpp +++ b/boost/spirit/home/qi/operator/sequential_or.hpp @@ -16,6 +16,7 @@ #include <boost/spirit/home/qi/detail/attributes.hpp> #include <boost/spirit/home/support/detail/what_function.hpp> #include <boost/spirit/home/support/algorithm/any_if_ns.hpp> +#include <boost/spirit/home/support/handles_container.hpp> #include <boost/fusion/include/as_vector.hpp> #include <boost/fusion/include/for_each.hpp> @@ -57,8 +58,8 @@ namespace boost { namespace spirit { namespace qi type; }; - sequential_or(Elements const& elements) - : elements(elements) {} + sequential_or(Elements const& elements_) + : elements(elements_) {} template <typename Iterator, typename Context , typename Skipper, typename Attribute> @@ -71,12 +72,12 @@ namespace boost { namespace spirit { namespace qi f(first, last, context, skipper); // wrap the attribute in a tuple if it is not a tuple - typename traits::wrap_if_not_tuple<Attribute>::type attr(attr_); + typename traits::wrap_if_not_tuple<Attribute>::type attr_local(attr_); // return true if *any* of the parsers succeed // (we use the non-short-circuiting version: any_if_ns // to force all elements to be tested) - return spirit::any_if_ns(elements, attr, f, predicate()); + return spirit::any_if_ns(elements, attr_local, f, predicate()); } template <typename Context> diff --git a/boost/spirit/home/qi/parse_attr.hpp b/boost/spirit/home/qi/parse_attr.hpp index 1933ffb09c..6db33008f1 100644 --- a/boost/spirit/home/qi/parse_attr.hpp +++ b/boost/spirit/home/qi/parse_attr.hpp @@ -62,8 +62,8 @@ namespace boost { namespace spirit { namespace qi BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A) > vector_type; - vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr)); - return compile<qi::domain>(expr).parse(first, last, unused, unused, attr); + vector_type lattr (BOOST_PP_ENUM_PARAMS(N, attr)); + return compile<qi::domain>(expr).parse(first, last, unused, unused, lattr); } template <typename Iterator, typename Expr @@ -113,9 +113,9 @@ namespace boost { namespace spirit { namespace qi BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A) > vector_type; - vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr)); + vector_type lattr (BOOST_PP_ENUM_PARAMS(N, attr)); if (!compile<qi::domain>(expr).parse( - first, last, unused, skipper_, attr)) + first, last, unused, skipper_, lattr)) return false; if (post_skip == skip_flag::postskip) diff --git a/boost/spirit/home/qi/reference.hpp b/boost/spirit/home/qi/reference.hpp index f6fcabcee1..f1f5c67570 100644 --- a/boost/spirit/home/qi/reference.hpp +++ b/boost/spirit/home/qi/reference.hpp @@ -38,9 +38,9 @@ namespace boost { namespace spirit { namespace qi , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& context, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_) const { - return ref.get().parse(first, last, context, skipper, attr); + return ref.get().parse(first, last, context, skipper, attr_); } template <typename Context> diff --git a/boost/spirit/home/qi/stream/detail/iterator_source.hpp b/boost/spirit/home/qi/stream/detail/iterator_source.hpp index 8a48eda76d..af53366c0b 100644 --- a/boost/spirit/home/qi/stream/detail/iterator_source.hpp +++ b/boost/spirit/home/qi/stream/detail/iterator_source.hpp @@ -50,17 +50,17 @@ namespace boost { namespace spirit { namespace qi { namespace detail return bytes_read; } - // Write is implemented only to satisfy the requirements of a + // Write is implemented only to satisfy the requirements of a // boost::iostreams::seekable_device. We need to have see support to - // be able to figure out how many characters have been actually + // be able to figure out how many characters have been actually // consumed by the stream. - std::streamsize write(const char*, std::streamsize) + std::streamsize write(const char_type*, std::streamsize) { BOOST_ASSERT(false); // not supported return -1; } - std::streampos seek(boost::iostreams::stream_offset, std::ios_base::seekdir way) + std::streampos seek(boost::iostreams::stream_offset, std::ios_base::seekdir way) { BOOST_ASSERT(way == std::ios_base::cur); // only support queries return pos; // return current position diff --git a/boost/spirit/home/qi/stream/stream.hpp b/boost/spirit/home/qi/stream/stream.hpp index 952f2f976d..83b417df64 100644 --- a/boost/spirit/home/qi/stream/stream.hpp +++ b/boost/spirit/home/qi/stream/stream.hpp @@ -58,23 +58,28 @@ namespace boost { namespace spirit { namespace qi , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& /*context*/, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_) const { typedef qi::detail::iterator_source<Iterator> source_device; typedef boost::iostreams::stream<source_device> instream; qi::skip_over(first, last, skipper); - instream in(first, last); // copies 'first' - in >> attr; // use existing operator>>() + instream in(first, last); // copies 'first' + in >> attr_; // use existing operator>>() // advance the iterator if everything is ok - if (in.good()) { - std::streamsize pos = in.tellg(); - std::advance(first, pos); + if (in) { + if (!in.eof()) { + std::streamsize pos = in.tellg(); + std::advance(first, pos); + } else { + first = last; + } + return true; } - return in.good() || in.eof(); + return false; } template <typename Context> diff --git a/boost/spirit/home/qi/string/detail/tst.hpp b/boost/spirit/home/qi/string/detail/tst.hpp index 989477d27b..168e4cf03e 100644 --- a/boost/spirit/home/qi/string/detail/tst.hpp +++ b/boost/spirit/home/qi/string/detail/tst.hpp @@ -24,8 +24,8 @@ namespace boost { namespace spirit { namespace qi { namespace detail template <typename Char, typename T> struct tst_node { - tst_node(Char id) - : id(id), data(0), lt(0), eq(0), gt(0) + tst_node(Char id_) + : id(id_), data(0), lt(0), eq(0), gt(0) { } diff --git a/boost/spirit/home/qi/string/lit.hpp b/boost/spirit/home/qi/string/lit.hpp index 1b966c32b5..1e163619c9 100644 --- a/boost/spirit/home/qi/string/lit.hpp +++ b/boost/spirit/home/qi/string/lit.hpp @@ -89,8 +89,8 @@ namespace boost { namespace spirit { namespace qi char_type; typedef std::basic_string<char_type> string_type; - literal_string(typename add_reference<String>::type str) - : str(str) + literal_string(typename add_reference<String>::type str_) + : str(str_) {} template <typename Context, typename Iterator> @@ -104,10 +104,10 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Context , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last - , Context& /*context*/, Skipper const& skipper, Attribute& attr) const + , Context& /*context*/, Skipper const& skipper, Attribute& attr_) const { qi::skip_over(first, last, skipper); - return detail::string_parse(str, first, last, attr); + return detail::string_parse(str, first, last, attr_); } template <typename Context> @@ -163,10 +163,10 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Context , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last - , Context& /*context*/, Skipper const& skipper, Attribute& attr) const + , Context& /*context*/, Skipper const& skipper, Attribute& attr_) const { qi::skip_over(first, last, skipper); - return detail::string_parse(str_lo, str_hi, first, last, attr); + return detail::string_parse(str_lo, str_hi, first, last, attr_); } template <typename Context> diff --git a/boost/spirit/home/qi/string/symbols.hpp b/boost/spirit/home/qi/string/symbols.hpp index a9656f1827..081632438c 100644 --- a/boost/spirit/home/qi/string/symbols.hpp +++ b/boost/spirit/home/qi/string/symbols.hpp @@ -166,7 +166,7 @@ namespace boost { namespace spirit { namespace qi return sym.remove(str); } -#if defined(BOOST_NO_RVALUE_REFERENCES) +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) // non-const version needed to suppress proto's += kicking in template <typename Str> friend adder const& @@ -257,14 +257,14 @@ public: template <typename Iterator, typename Context , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last - , Context& /*context*/, Skipper const& skipper, Attribute& attr) const + , Context& /*context*/, Skipper const& skipper, Attribute& attr_) const { qi::skip_over(first, last, skipper); if (value_type* val_ptr = lookup->find(first, last, Filter())) { - spirit::traits::assign_to(*val_ptr, attr); + spirit::traits::assign_to(*val_ptr, attr_); return true; } return false; @@ -290,8 +290,8 @@ public: template <typename, typename = unused_type, typename = unused_type> struct result { typedef adder const& type; }; - adder(symbols& sym) - : sym(sym) + adder(symbols& sym_) + : sym(sym_) { } @@ -333,8 +333,8 @@ public: template <typename, typename = unused_type, typename = unused_type> struct result { typedef remover const& type; }; - remover(symbols& sym) - : sym(sym) + remover(symbols& sym_) + : sym(sym_) { } diff --git a/boost/spirit/home/qi/string/tst_map.hpp b/boost/spirit/home/qi/string/tst_map.hpp index 0ea838c42e..a3208f2743 100644 --- a/boost/spirit/home/qi/string/tst_map.hpp +++ b/boost/spirit/home/qi/string/tst_map.hpp @@ -54,16 +54,20 @@ namespace boost { namespace spirit { namespace qi Iterator save = first; typename map_type::const_iterator i = map.find(filter(*first++)); - if (i == map.end()) - { - first = save; - return 0; - } - if (T* p = node::find(i->second.root, first, last, filter)) + + if (i != map.end()) { - return p; + if (T* p = node::find(i->second.root, first, last, filter)) + { + return p; + } + + if (i->second.data) + { + return i->second.data; + } } - return i->second.data; + first = save; } return 0; } |