Warning, file /include/boost/spirit/home/qi/directive/hold.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007 #ifndef BOOST_SPIRIT_QI_DIRECTIVE_HOLD_HPP
0008 #define BOOST_SPIRIT_QI_DIRECTIVE_HOLD_HPP
0009
0010 #if defined(_MSC_VER)
0011 #pragma once
0012 #endif
0013
0014 #include <boost/spirit/home/qi/meta_compiler.hpp>
0015 #include <boost/spirit/home/qi/skip_over.hpp>
0016 #include <boost/spirit/home/qi/parser.hpp>
0017 #include <boost/spirit/home/support/attributes.hpp>
0018 #include <boost/spirit/home/support/info.hpp>
0019 #include <boost/spirit/home/support/common_terminals.hpp>
0020 #include <boost/spirit/home/support/unused.hpp>
0021 #include <boost/spirit/home/support/has_semantic_action.hpp>
0022 #include <boost/spirit/home/support/handles_container.hpp>
0023
0024 namespace boost { namespace spirit
0025 {
0026
0027
0028
0029 template <>
0030 struct use_directive<qi::domain, tag::hold>
0031 : mpl::true_ {};
0032 }}
0033
0034 namespace boost { namespace spirit { namespace qi
0035 {
0036 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
0037 using spirit::hold;
0038 #endif
0039 using spirit::hold_type;
0040
0041 template <typename Subject>
0042 struct hold_directive : unary_parser<hold_directive<Subject> >
0043 {
0044 typedef Subject subject_type;
0045 hold_directive(Subject const& subject_)
0046 : subject(subject_) {}
0047
0048 template <typename Context, typename Iterator>
0049 struct attribute
0050 {
0051 typedef typename
0052 traits::attribute_of<subject_type, Context, Iterator>::type
0053 type;
0054 };
0055
0056 template <typename Iterator, typename Context
0057 , typename Skipper, typename Attribute>
0058 bool parse(Iterator& first, Iterator const& last
0059 , Context& context, Skipper const& skipper, Attribute& attr_) const
0060 {
0061 Attribute copy(attr_);
0062 if (subject.parse(first, last, context, skipper, copy))
0063 {
0064 traits::swap_impl(copy, attr_);
0065 return true;
0066 }
0067 return false;
0068 }
0069
0070 template <typename Context>
0071 info what(Context& context) const
0072 {
0073 return info("hold", subject.what(context));
0074
0075 }
0076
0077 Subject subject;
0078 };
0079
0080
0081
0082
0083 template <typename Subject, typename Modifiers>
0084 struct make_directive<tag::hold, Subject, Modifiers>
0085 {
0086 typedef hold_directive<Subject> result_type;
0087 result_type operator()(unused_type, Subject const& subject, unused_type) const
0088 {
0089 return result_type(subject);
0090 }
0091 };
0092 }}}
0093
0094 namespace boost { namespace spirit { namespace traits
0095 {
0096
0097 template <typename Subject>
0098 struct has_semantic_action<qi::hold_directive<Subject> >
0099 : unary_has_semantic_action<Subject> {};
0100
0101
0102 template <typename Subject, typename Attribute, typename Context
0103 , typename Iterator>
0104 struct handles_container<qi::hold_directive<Subject>, Attribute
0105 , Context, Iterator>
0106 : unary_handles_container<Subject, Attribute, Context, Iterator> {};
0107 }}}
0108
0109 #endif