File indexing completed on 2025-01-31 10:02:37
0001
0002
0003
0004
0005
0006
0007
0008 #if !defined(BOOST_SPIRIT_X3_KLEENE_JANUARY_07_2007_0818AM)
0009 #define BOOST_SPIRIT_X3_KLEENE_JANUARY_07_2007_0818AM
0010
0011 #include <boost/spirit/home/x3/core/parser.hpp>
0012 #include <boost/spirit/home/x3/support/traits/container_traits.hpp>
0013 #include <boost/spirit/home/x3/support/traits/attribute_of.hpp>
0014 #include <boost/spirit/home/x3/core/detail/parse_into_container.hpp>
0015
0016 namespace boost { namespace spirit { namespace x3
0017 {
0018 template <typename Subject>
0019 struct kleene : unary_parser<Subject, kleene<Subject>>
0020 {
0021 typedef unary_parser<Subject, kleene<Subject>> base_type;
0022 static bool const handles_container = true;
0023
0024 constexpr kleene(Subject const& subject)
0025 : base_type(subject) {}
0026
0027 template <typename Iterator, typename Context
0028 , typename RContext, typename Attribute>
0029 bool parse(Iterator& first, Iterator const& last
0030 , Context const& context, RContext& rcontext, Attribute& attr) const
0031 {
0032 while (detail::parse_into_container(
0033 this->subject, first, last, context, rcontext, attr))
0034 ;
0035 return true;
0036 }
0037 };
0038
0039 template <typename Subject>
0040 constexpr kleene<typename extension::as_parser<Subject>::value_type>
0041 operator*(Subject const& subject)
0042 {
0043 return { as_parser(subject) };
0044 }
0045 }}}
0046
0047 namespace boost { namespace spirit { namespace x3 { namespace traits
0048 {
0049 template <typename Subject, typename Context>
0050 struct attribute_of<x3::kleene<Subject>, Context>
0051 : build_container<
0052 typename attribute_of<Subject, Context>::type> {};
0053 }}}}
0054
0055 #endif