1 /*=============================================================================
2 Copyright (c) 2001-2014 Joel de Guzman
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_EPS_MARCH_23_2007_0454PM)
8 #define BOOST_SPIRIT_X3_EPS_MARCH_23_2007_0454PM
10 #include <boost/spirit/home/x3/core/skip_over.hpp>
11 #include <boost/spirit/home/x3/core/parser.hpp>
12 #include <boost/spirit/home/x3/support/unused.hpp>
14 namespace boost { namespace spirit { namespace x3
16 struct rule_context_tag;
18 struct semantic_predicate : parser<semantic_predicate>
20 typedef unused_type attribute_type;
21 static bool const has_attribute = false;
23 constexpr semantic_predicate(bool predicate)
24 : predicate(predicate) {}
26 template <typename Iterator, typename Context, typename Attribute>
27 bool parse(Iterator& first, Iterator const& last
28 , Context const& context, unused_type, Attribute&) const
30 x3::skip_over(first, last, context);
38 struct lazy_semantic_predicate : parser<lazy_semantic_predicate<F>>
40 typedef unused_type attribute_type;
41 static bool const has_attribute = false;
43 constexpr lazy_semantic_predicate(F f)
46 template <typename Iterator, typename Context, typename Attribute>
47 bool parse(Iterator& first, Iterator const& last
48 , Context const& context, unused_type, Attribute& /* attr */) const
50 x3::skip_over(first, last, context);
51 return f(x3::get<rule_context_tag>(context));
57 struct eps_parser : parser<eps_parser>
59 typedef unused_type attribute_type;
60 static bool const has_attribute = false;
62 template <typename Iterator, typename Context
63 , typename RuleContext, typename Attribute>
64 bool parse(Iterator& first, Iterator const& last
65 , Context const& context, RuleContext&, Attribute&) const
67 x3::skip_over(first, last, context);
71 constexpr semantic_predicate operator()(bool predicate) const
77 constexpr lazy_semantic_predicate<F> operator()(F f) const
83 constexpr auto eps = eps_parser{};