?????????? ????????? - ??????????????? - /home/agenciai/public_html/cd38d8/alternative.hpp.tar
???????
usr/include/boost/spirit/home/qi/operator/alternative.hpp 0000644 00000010736 15126723021 0017671 0 ustar 00 /*============================================================================= Copyright (c) 2001-2011 Joel de Guzman Copyright (c) 2001-2011 Hartmut Kaiser 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) =============================================================================*/ #ifndef BOOST_SPIRIT_QI_OPERATOR_ALTERNATIVE_HPP #define BOOST_SPIRIT_QI_OPERATOR_ALTERNATIVE_HPP #if defined(_MSC_VER) #pragma once #endif #include <boost/spirit/home/qi/detail/alternative_function.hpp> #include <boost/spirit/home/qi/meta_compiler.hpp> #include <boost/spirit/home/qi/parser.hpp> #include <boost/spirit/home/qi/detail/attributes.hpp> #include <boost/spirit/home/support/has_semantic_action.hpp> #include <boost/spirit/home/support/handles_container.hpp> #include <boost/spirit/home/support/detail/what_function.hpp> #include <boost/spirit/home/support/unused.hpp> #include <boost/spirit/home/support/info.hpp> #include <boost/fusion/include/any.hpp> #include <boost/fusion/include/mpl.hpp> #include <boost/fusion/include/for_each.hpp> #include <boost/proto/operators.hpp> #include <boost/proto/tags.hpp> namespace boost { namespace spirit { /////////////////////////////////////////////////////////////////////////// // Enablers /////////////////////////////////////////////////////////////////////////// template <> struct use_operator<qi::domain, proto::tag::bitwise_or> // enables | : mpl::true_ {}; template <> struct flatten_tree<qi::domain, proto::tag::bitwise_or> // flattens | : mpl::true_ {}; }} namespace boost { namespace spirit { namespace qi { template <typename Elements> struct alternative : nary_parser<alternative<Elements> > { template <typename Context, typename Iterator> struct attribute { // Put all the element attributes in a tuple typedef typename traits::build_attribute_sequence< Elements, Context, traits::alternative_attribute_transform , Iterator, qi::domain >::type all_attributes; // Ok, now make a variant over the attribute sequence. Note that // build_variant makes sure that 1) all attributes in the variant // are unique 2) puts the unused attribute, if there is any, to // the front and 3) collapses single element variants, variant<T> // to T. typedef typename traits::build_variant<all_attributes>::type type; }; 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 { detail::alternative_function<Iterator, Context, Skipper, Attribute> f(first, last, context, skipper, attr_); // return true if *any* of the parsers succeed return fusion::any(elements, f); } template <typename Context> info what(Context& context) const { info result("alternative"); fusion::for_each(elements, spirit::detail::what_function<Context>(result, context)); return result; } Elements elements; }; /////////////////////////////////////////////////////////////////////////// // Parser generators: make_xxx function (objects) /////////////////////////////////////////////////////////////////////////// template <typename Elements, typename Modifiers> struct make_composite<proto::tag::bitwise_or, Elements, Modifiers> : make_nary_composite<Elements, alternative> {}; }}} namespace boost { namespace spirit { namespace traits { /////////////////////////////////////////////////////////////////////////// template <typename Elements> struct has_semantic_action<qi::alternative<Elements> > : nary_has_semantic_action<Elements> {}; /////////////////////////////////////////////////////////////////////////// template <typename Elements, typename Attribute, typename Context , typename Iterator> struct handles_container<qi::alternative<Elements>, Attribute, Context , Iterator> : nary_handles_container<Elements, Attribute, Context, Iterator> {}; }}} #endif usr/include/boost/spirit/home/karma/operator/alternative.hpp 0000644 00000016303 15126723221 0020351 0 ustar 00 // Copyright (c) 2001-2011 Hartmut Kaiser // Copyright (c) 2001-2011 Joel de Guzman // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_SPIRIT_KARMA_OPERATOR_ALTERNATIVE_HPP #define BOOST_SPIRIT_KARMA_OPERATOR_ALTERNATIVE_HPP #if defined(_MSC_VER) #pragma once #endif #include <boost/spirit/home/karma/detail/alternative_function.hpp> #include <boost/spirit/home/karma/detail/get_stricttag.hpp> #include <boost/spirit/home/karma/domain.hpp> #include <boost/spirit/home/karma/generator.hpp> #include <boost/spirit/home/karma/meta_compiler.hpp> #include <boost/spirit/home/support/info.hpp> #include <boost/spirit/home/support/unused.hpp> #include <boost/spirit/home/support/has_semantic_action.hpp> #include <boost/spirit/home/support/handles_container.hpp> #include <boost/spirit/home/support/detail/what_function.hpp> #include <boost/fusion/include/any.hpp> #include <boost/fusion/include/mpl.hpp> #include <boost/fusion/include/for_each.hpp> #include <boost/mpl/accumulate.hpp> #include <boost/mpl/bitor.hpp> #include <boost/proto/tags.hpp> #include <boost/config.hpp> namespace boost { namespace spirit { /////////////////////////////////////////////////////////////////////////// // Enablers /////////////////////////////////////////////////////////////////////////// template <> struct use_operator<karma::domain, proto::tag::bitwise_or> // enables | : mpl::true_ {}; template <> struct flatten_tree<karma::domain, proto::tag::bitwise_or> // flattens | : mpl::true_ {}; }} /////////////////////////////////////////////////////////////////////////////// namespace boost { namespace spirit { namespace traits { // specialization for sequences template <typename Elements> struct alternative_properties { struct element_properties { template <typename T> struct result; template <typename F, typename Element> struct result<F(Element)> { typedef properties_of<Element> type; }; // never called, but needed for decltype-based result_of (C++0x) #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template <typename Element> typename result<element_properties(Element)>::type operator()(Element&&) const; #endif }; typedef typename mpl::accumulate< typename fusion::result_of::transform< Elements, element_properties>::type , mpl::int_<karma::generator_properties::countingbuffer> , mpl::bitor_<mpl::_2, mpl::_1> >::type type; }; }}} namespace boost { namespace spirit { namespace karma { template <typename Elements, typename Strict, typename Derived> struct base_alternative : nary_generator<Derived> { typedef typename traits::alternative_properties<Elements>::type properties; template <typename Context, typename Iterator = unused_type> struct attribute { // Put all the element attributes in a tuple typedef typename traits::build_attribute_sequence< Elements, Context, traits::alternative_attribute_transform , Iterator, karma::domain >::type all_attributes; // Ok, now make a variant over the attribute sequence. Note that // build_variant makes sure that 1) all attributes in the variant // are unique 2) puts the unused attribute, if there is any, to // the front and 3) collapses single element variants, variant<T> // to T. typedef typename traits::build_variant<all_attributes>::type type; }; base_alternative(Elements const& elements) : elements(elements) {} template < typename OutputIterator, typename Context, typename Delimiter , typename Attribute> bool generate(OutputIterator& sink, Context& ctx , Delimiter const& d, Attribute const& attr) const { typedef detail::alternative_generate_function< OutputIterator, Context, Delimiter, Attribute, Strict > functor; // f return true if *any* of the parser succeeds functor f (sink, ctx, d, attr); return fusion::any(elements, f); } template <typename Context> info what(Context& context) const { info result("alternative"); fusion::for_each(elements, spirit::detail::what_function<Context>(result, context)); return result; } Elements elements; }; template <typename Elements> struct alternative : base_alternative<Elements, mpl::false_, alternative<Elements> > { typedef base_alternative<Elements, mpl::false_, alternative> base_alternative_; alternative(Elements const& elements) : base_alternative_(elements) {} }; template <typename Elements> struct strict_alternative : base_alternative<Elements, mpl::true_, strict_alternative<Elements> > { typedef base_alternative<Elements, mpl::true_, strict_alternative> base_alternative_; strict_alternative(Elements const& elements) : base_alternative_(elements) {} }; /////////////////////////////////////////////////////////////////////////// // Generator generators: make_xxx function (objects) /////////////////////////////////////////////////////////////////////////// namespace detail { template <typename Elements, bool strict_mode = false> struct make_alternative : make_nary_composite<Elements, alternative> {}; template <typename Elements> struct make_alternative<Elements, true> : make_nary_composite<Elements, strict_alternative> {}; } template <typename Elements, typename Modifiers> struct make_composite<proto::tag::bitwise_or, Elements, Modifiers> : detail::make_alternative<Elements , detail::get_stricttag<Modifiers>::value> {}; }}} namespace boost { namespace spirit { namespace traits { /////////////////////////////////////////////////////////////////////////// template <typename Elements> struct has_semantic_action<karma::alternative<Elements> > : nary_has_semantic_action<Elements> {}; template <typename Elements> struct has_semantic_action<karma::strict_alternative<Elements> > : nary_has_semantic_action<Elements> {}; /////////////////////////////////////////////////////////////////////////// template <typename Elements, typename Attribute, typename Context , typename Iterator> struct handles_container<karma::alternative<Elements> , Attribute, Context, Iterator> : nary_handles_container<Elements, Attribute, Context, Iterator> {}; template <typename Elements, typename Attribute, typename Context , typename Iterator> struct handles_container<karma::strict_alternative<Elements> , Attribute, Context, Iterator> : nary_handles_container<Elements, Attribute, Context, Iterator> {}; }}} #endif usr/include/boost/spirit/home/x3/operator/detail/alternative.hpp 0000644 00000020326 15127733025 0021056 0 ustar 00 /*============================================================================= Copyright (c) 2001-2014 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_X3_ALTERNATIVE_DETAIL_JAN_07_2013_1245PM) #define BOOST_SPIRIT_X3_ALTERNATIVE_DETAIL_JAN_07_2013_1245PM #include <boost/spirit/home/x3/support/traits/attribute_of.hpp> #include <boost/spirit/home/x3/support/traits/pseudo_attribute.hpp> #include <boost/spirit/home/x3/support/traits/is_variant.hpp> #include <boost/spirit/home/x3/support/traits/tuple_traits.hpp> #include <boost/spirit/home/x3/support/traits/move_to.hpp> #include <boost/spirit/home/x3/support/traits/variant_has_substitute.hpp> #include <boost/spirit/home/x3/support/traits/variant_find_substitute.hpp> #include <boost/spirit/home/x3/core/detail/parse_into_container.hpp> #include <boost/mpl/if.hpp> #include <boost/fusion/include/front.hpp> #include <boost/type_traits/is_same.hpp> #include <type_traits> namespace boost { namespace spirit { namespace x3 { template <typename Left, typename Right> struct alternative; }}} namespace boost { namespace spirit { namespace x3 { namespace detail { struct pass_variant_unused { typedef unused_type type; template <typename T> static unused_type call(T&) { return unused_type(); } }; template <typename Attribute> struct pass_variant_used { typedef Attribute& type; static Attribute& call(Attribute& v) { return v; } }; template <> struct pass_variant_used<unused_type> : pass_variant_unused {}; template <typename Parser, typename Attribute, typename Context , typename Enable = void> struct pass_parser_attribute { typedef typename traits::attribute_of<Parser, Context>::type attribute_type; typedef typename traits::variant_find_substitute<Attribute, attribute_type>::type substitute_type; typedef typename mpl::if_< is_same<Attribute, substitute_type> , Attribute& , substitute_type >::type type; template <typename Attribute_> static Attribute_& call(Attribute_& attr, mpl::true_) { return attr; } template <typename Attribute_> static type call(Attribute_&, mpl::false_) { return type(); } template <typename Attribute_> static type call(Attribute_& attr) { return call(attr, is_same<Attribute_, typename remove_reference<type>::type>()); } }; // Pass non-variant attributes as-is template <typename Parser, typename Attribute, typename Context , typename Enable = void> struct pass_non_variant_attribute { typedef Attribute& type; static Attribute& call(Attribute& attr) { return attr; } }; // Unwrap single element sequences template <typename Parser, typename Attribute, typename Context> struct pass_non_variant_attribute<Parser, Attribute, Context, typename enable_if<traits::is_size_one_sequence<Attribute>>::type> { typedef typename remove_reference< typename fusion::result_of::front<Attribute>::type>::type attr_type; typedef pass_parser_attribute<Parser, attr_type, Context> pass; typedef typename pass::type type; template <typename Attribute_> static type call(Attribute_& attr) { return pass::call(fusion::front(attr)); } }; template <typename Parser, typename Attribute, typename Context> struct pass_parser_attribute<Parser, Attribute, Context, typename enable_if_c<(!traits::is_variant<Attribute>::value)>::type> : pass_non_variant_attribute<Parser, Attribute, Context> {}; template <typename Parser, typename Context> struct pass_parser_attribute<Parser, unused_type, Context> : pass_variant_unused {}; template <typename Parser, typename Attribute, typename Context> struct pass_variant_attribute : mpl::if_c<traits::has_attribute<Parser, Context>::value , pass_parser_attribute<Parser, Attribute, Context> , pass_variant_unused>::type { }; template <typename L, typename R, typename Attribute, typename Context> struct pass_variant_attribute<alternative<L, R>, Attribute, Context> : mpl::if_c<traits::has_attribute<alternative<L, R>, Context>::value , pass_variant_used<Attribute> , pass_variant_unused>::type { }; template <bool Condition> struct move_if { template<typename T1, typename T2> static void call(T1& /* attr_ */, T2& /* attr */) {} }; template <> struct move_if<true> { template<typename T1, typename T2> static void call(T1& attr_, T2& attr) { traits::move_to(attr_, attr); } }; template <typename Parser, typename Iterator, typename Context , typename RContext, typename Attribute> bool parse_alternative(Parser const& p, Iterator& first, Iterator const& last , Context const& context, RContext& rcontext, Attribute& attr) { using pass = detail::pass_variant_attribute<Parser, Attribute, Context>; using pseudo = traits::pseudo_attribute<Context, typename pass::type, Iterator>; typename pseudo::type attr_ = pseudo::call(first, last, pass::call(attr)); if (p.parse(first, last, context, rcontext, attr_)) { move_if<!std::is_reference<decltype(attr_)>::value>::call(attr_, attr); return true; } return false; } template <typename Subject> struct alternative_helper : unary_parser<Subject, alternative_helper<Subject>> { static bool const is_pass_through_unary = true; using unary_parser<Subject, alternative_helper<Subject>>::unary_parser; template <typename Iterator, typename Context , typename RContext, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context const& context, RContext& rcontext, Attribute& attr) const { return detail::parse_alternative(this->subject, first, last, context, rcontext, attr); } }; template <typename Left, typename Right, typename Context, typename RContext> struct parse_into_container_impl<alternative<Left, Right>, Context, RContext> { typedef alternative<Left, Right> parser_type; template <typename Iterator, typename Attribute> static bool call( parser_type const& parser , Iterator& first, Iterator const& last , Context const& context, RContext& rcontext, Attribute& attr, mpl::false_) { return detail::parse_into_container(parser.left, first, last, context, rcontext, attr) || detail::parse_into_container(parser.right, first, last, context, rcontext, attr); } template <typename Iterator, typename Attribute> static bool call( parser_type const& parser , Iterator& first, Iterator const& last , Context const& context, RContext& rcontext, Attribute& attr, mpl::true_) { return detail::parse_into_container(alternative_helper<Left>{parser.left}, first, last, context, rcontext, attr) || detail::parse_into_container(alternative_helper<Right>{parser.right}, first, last, context, rcontext, attr); } template <typename Iterator, typename Attribute> static bool call( parser_type const& parser , Iterator& first, Iterator const& last , Context const& context, RContext& rcontext, Attribute& attr) { return call(parser, first, last, context, rcontext, attr, typename traits::is_variant<typename traits::container_value<Attribute>::type>::type{}); } }; }}}} #endif usr/include/boost/spirit/home/x3/operator/alternative.hpp 0000644 00000004777 15132373610 0017624 0 ustar 00 /*============================================================================= Copyright (c) 2001-2014 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_X3_ALTERNATIVE_JAN_07_2013_1131AM) #define BOOST_SPIRIT_X3_ALTERNATIVE_JAN_07_2013_1131AM #include <boost/spirit/home/x3/support/traits/attribute_of_binary.hpp> #include <boost/spirit/home/x3/core/parser.hpp> #include <boost/spirit/home/x3/operator/detail/alternative.hpp> #include <boost/variant/variant_fwd.hpp> namespace boost { namespace spirit { namespace x3 { template <typename Left, typename Right> struct alternative : binary_parser<Left, Right, alternative<Left, Right>> { typedef binary_parser<Left, Right, alternative<Left, Right>> base_type; constexpr alternative(Left const& left, Right const& right) : base_type(left, right) {} template <typename Iterator, typename Context, typename RContext> bool parse( Iterator& first, Iterator const& last , Context const& context, RContext& rcontext, unused_type) const { return this->left.parse(first, last, context, rcontext, unused) || this->right.parse(first, last, context, rcontext, unused); } template <typename Iterator, typename Context , type
| ver. 1.6 |
Github
|
.
| PHP 8.2.30 | ??????????? ?????????: 0 |
proxy
|
phpinfo
|
???????????