Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 10:02:35

0001 /*=============================================================================
0002     Copyright (c) 2001-2014 Joel de Guzman
0003     Copyright (c) 2001-2011 Hartmut Kaiser
0004     Copyright (c) 2013 Agustin Berge
0005 
0006     Distributed under the Boost Software License, Version 1.0. (See accompanying
0007     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0008 =============================================================================*/
0009 #if !defined(BOOST_SPIRIT_X3_NO_SKIP_JAN_16_2010_0802PM)
0010 #define BOOST_SPIRIT_X3_NO_SKIP_JAN_16_2010_0802PM
0011 
0012 #include <boost/spirit/home/x3/support/context.hpp>
0013 #include <boost/spirit/home/x3/support/unused.hpp>
0014 #include <boost/spirit/home/x3/core/skip_over.hpp>
0015 #include <boost/spirit/home/x3/core/parser.hpp>
0016 #include <boost/type_traits/remove_reference.hpp>
0017 #include <boost/utility/enable_if.hpp>
0018 
0019 namespace boost { namespace spirit { namespace x3
0020 {
0021     // same as lexeme[], but does not pre-skip
0022     template <typename Subject>
0023     struct no_skip_directive : unary_parser<Subject, no_skip_directive<Subject>>
0024     {
0025         typedef unary_parser<Subject, no_skip_directive<Subject> > base_type;
0026         static bool const is_pass_through_unary = true;
0027         static bool const handles_container = Subject::handles_container;
0028 
0029         constexpr no_skip_directive(Subject const& subject)
0030           : base_type(subject) {}
0031 
0032         template <typename Iterator, typename Context
0033           , typename RContext, typename Attribute>
0034         typename enable_if<has_skipper<Context>, bool>::type
0035         parse(Iterator& first, Iterator const& last
0036           , Context const& context, RContext& rcontext, Attribute& attr) const
0037         {
0038             auto const& skipper = x3::get<skipper_tag>(context);
0039 
0040             typedef unused_skipper<
0041                 typename remove_reference<decltype(skipper)>::type>
0042             unused_skipper_type;
0043             unused_skipper_type unused_skipper(skipper);
0044 
0045             return this->subject.parse(
0046                 first, last
0047               , make_context<skipper_tag>(unused_skipper, context)
0048               , rcontext
0049               , attr);
0050         }
0051         template <typename Iterator, typename Context
0052           , typename RContext, typename Attribute>
0053         typename disable_if<has_skipper<Context>, bool>::type
0054         parse(Iterator& first, Iterator const& last
0055           , Context const& context, RContext& rcontext, Attribute& attr) const
0056         {
0057             return this->subject.parse(
0058                 first, last
0059               , context
0060               , rcontext
0061               , attr);
0062         }
0063     };
0064 
0065     struct no_skip_gen
0066     {
0067         template <typename Subject>
0068         constexpr no_skip_directive<typename extension::as_parser<Subject>::value_type>
0069         operator[](Subject const& subject) const
0070         {
0071             return { as_parser(subject) };
0072         }
0073     };
0074 
0075     constexpr auto no_skip = no_skip_gen{};
0076 }}}
0077 
0078 #endif