Warning, file /include/boost/spirit/home/qi/operator/kleene.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
0008 #ifndef BOOST_SPIRIT_QI_OPERATOR_KLEENE_HPP
0009 #define BOOST_SPIRIT_QI_OPERATOR_KLEENE_HPP
0010
0011 #if defined(_MSC_VER)
0012 #pragma once
0013 #endif
0014
0015 #include <boost/spirit/home/qi/meta_compiler.hpp>
0016 #include <boost/spirit/home/qi/parser.hpp>
0017 #include <boost/spirit/home/support/container.hpp>
0018 #include <boost/spirit/home/qi/detail/attributes.hpp>
0019 #include <boost/spirit/home/qi/detail/fail_function.hpp>
0020 #include <boost/spirit/home/qi/detail/pass_container.hpp>
0021 #include <boost/spirit/home/support/has_semantic_action.hpp>
0022 #include <boost/spirit/home/support/handles_container.hpp>
0023 #include <boost/spirit/home/support/info.hpp>
0024 #include <boost/proto/operators.hpp>
0025 #include <boost/proto/tags.hpp>
0026
0027 namespace boost { namespace spirit
0028 {
0029
0030
0031
0032
0033 template <>
0034 struct use_operator<qi::domain, proto::tag::dereference>
0035 : mpl::true_ {};
0036
0037 }}
0038
0039 namespace boost { namespace spirit { namespace qi
0040 {
0041
0042 template <typename Subject>
0043 struct kleene : unary_parser<kleene<Subject> >
0044 {
0045 typedef Subject subject_type;
0046
0047 template <typename Context, typename Iterator>
0048 struct attribute
0049 {
0050
0051
0052
0053 typedef typename
0054 traits::build_std_vector<
0055 typename traits::
0056 attribute_of<Subject, Context, Iterator>::type
0057 >::type
0058 type;
0059 };
0060
0061 kleene(Subject const& subject_)
0062 : subject(subject_) {}
0063
0064 template <typename F>
0065 bool parse_container(F f) const
0066 {
0067 while (!f (subject))
0068 ;
0069 return true;
0070 }
0071
0072 template <typename Iterator, typename Context
0073 , typename Skipper, typename Attribute>
0074 bool parse(Iterator& first, Iterator const& last
0075 , Context& context, Skipper const& skipper
0076 , Attribute& attr_) const
0077 {
0078
0079 traits::make_container(attr_);
0080
0081 typedef detail::fail_function<Iterator, Context, Skipper>
0082 fail_function;
0083
0084 Iterator iter = first;
0085 fail_function f(iter, last, context, skipper);
0086 parse_container(detail::make_pass_container(f, attr_));
0087
0088 first = f.first;
0089 return true;
0090 }
0091
0092 template <typename Context>
0093 info what(Context& context) const
0094 {
0095 return info("kleene", subject.what(context));
0096 }
0097
0098 Subject subject;
0099 };
0100
0101
0102
0103
0104
0105
0106 template <typename Elements, typename Modifiers>
0107 struct make_composite<proto::tag::dereference, Elements, Modifiers>
0108 : make_unary_composite<Elements, kleene>
0109 {};
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119 }}}
0120
0121 namespace boost { namespace spirit { namespace traits
0122 {
0123
0124 template <typename Subject>
0125 struct has_semantic_action<qi::kleene<Subject> >
0126 : unary_has_semantic_action<Subject> {};
0127
0128
0129 template <typename Subject, typename Attribute, typename Context
0130 , typename Iterator>
0131 struct handles_container<qi::kleene<Subject>, Attribute
0132 , Context, Iterator>
0133 : mpl::true_ {};
0134 }}}
0135
0136 #endif