Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/spirit/home/x3/auxiliary/eps.hpp @ 102:f46d142149f5
Whoops, finish that update
author | Chris Cannam |
---|---|
date | Mon, 07 Sep 2015 11:13:41 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
101:c530137014c0 | 102:f46d142149f5 |
---|---|
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_EPS_MARCH_23_2007_0454PM) | |
8 #define BOOST_SPIRIT_X3_EPS_MARCH_23_2007_0454PM | |
9 | |
10 #if defined(_MSC_VER) | |
11 #pragma once | |
12 #endif | |
13 | |
14 #include <boost/spirit/home/x3/core/skip_over.hpp> | |
15 #include <boost/spirit/home/x3/core/parser.hpp> | |
16 #include <boost/spirit/home/x3/support/unused.hpp> | |
17 | |
18 namespace boost { namespace spirit { namespace x3 | |
19 { | |
20 struct rule_context_tag; | |
21 | |
22 struct semantic_predicate : parser<semantic_predicate> | |
23 { | |
24 typedef unused_type attribute_type; | |
25 static bool const has_attribute = false; | |
26 | |
27 semantic_predicate(bool predicate) | |
28 : predicate(predicate) {} | |
29 | |
30 template <typename Iterator, typename Context, typename Attribute> | |
31 bool parse(Iterator& first, Iterator const& last | |
32 , Context const& context, unused_type, Attribute&) const | |
33 { | |
34 x3::skip_over(first, last, context); | |
35 return predicate; | |
36 } | |
37 | |
38 bool predicate; | |
39 }; | |
40 | |
41 template <typename F> | |
42 struct lazy_semantic_predicate : parser<lazy_semantic_predicate<F>> | |
43 { | |
44 typedef unused_type attribute_type; | |
45 static bool const has_attribute = false; | |
46 | |
47 lazy_semantic_predicate(F f) | |
48 : f(f) {} | |
49 | |
50 template <typename Iterator, typename Context, typename Attribute> | |
51 bool parse(Iterator& first, Iterator const& last | |
52 , Context const& context, unused_type, Attribute& attr) const | |
53 { | |
54 x3::skip_over(first, last, context); | |
55 return f(x3::get<rule_context_tag>(context)); | |
56 } | |
57 | |
58 F f; | |
59 }; | |
60 | |
61 struct eps_parser : parser<eps_parser> | |
62 { | |
63 typedef unused_type attribute_type; | |
64 static bool const has_attribute = false; | |
65 | |
66 template <typename Iterator, typename Context | |
67 , typename RuleContext, typename Attribute> | |
68 bool parse(Iterator& first, Iterator const& last | |
69 , Context const& context, RuleContext&, Attribute&) const | |
70 { | |
71 x3::skip_over(first, last, context); | |
72 return true; | |
73 } | |
74 | |
75 semantic_predicate | |
76 operator()(bool predicate) const | |
77 { | |
78 return semantic_predicate(predicate); | |
79 } | |
80 | |
81 template <typename F> | |
82 lazy_semantic_predicate<F> | |
83 operator()(F f) const | |
84 { | |
85 return lazy_semantic_predicate<F>(f); | |
86 } | |
87 }; | |
88 | |
89 eps_parser const eps = eps_parser(); | |
90 }}} | |
91 | |
92 #endif |