• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*=============================================================================
2     Copyright (c) 2001-2014 Joel de Guzman
3 
4     Distributed under the Boost Software License, Version 1.0. (See accompanying
5     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 =============================================================================*/
7 #if !defined(BOOST_SPIRIT_X3_AND_PREDICATE_MARCH_23_2007_0617PM)
8 #define BOOST_SPIRIT_X3_AND_PREDICATE_MARCH_23_2007_0617PM
9 
10 #include <boost/spirit/home/x3/core/parser.hpp>
11 
12 namespace boost { namespace spirit { namespace x3
13 {
14     template <typename Subject>
15     struct and_predicate : unary_parser<Subject, and_predicate<Subject>>
16     {
17         typedef unary_parser<Subject, and_predicate<Subject>> base_type;
18 
19         typedef unused_type attribute_type;
20         static bool const has_attribute = false;
21 
and_predicateboost::spirit::x3::and_predicate22         constexpr and_predicate(Subject const& subject)
23           : base_type(subject) {}
24 
25         template <typename Iterator, typename Context
26           , typename RContext, typename Attribute>
parseboost::spirit::x3::and_predicate27         bool parse(Iterator& first, Iterator const& last
28           , Context const& context, RContext& rcontext, Attribute& /*attr*/) const
29         {
30             Iterator i = first;
31             return this->subject.parse(i, last, context, rcontext, unused);
32         }
33     };
34 
35     template <typename Subject>
36     constexpr and_predicate<typename extension::as_parser<Subject>::value_type>
operator &(Subject const & subject)37     operator&(Subject const& subject)
38     {
39         return { as_parser(subject) };
40     }
41 }}}
42 
43 #endif
44