Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/spirit/home/qi/directive/lexeme.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 /*============================================================================= | |
2 Copyright (c) 2001-2011 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(SPIRIT_LEXEME_MARCH_24_2007_0802AM) | |
8 #define SPIRIT_LEXEME_MARCH_24_2007_0802AM | |
9 | |
10 #if defined(_MSC_VER) | |
11 #pragma once | |
12 #endif | |
13 | |
14 #include <boost/spirit/home/qi/meta_compiler.hpp> | |
15 #include <boost/spirit/home/qi/skip_over.hpp> | |
16 #include <boost/spirit/home/qi/parser.hpp> | |
17 #include <boost/spirit/home/qi/detail/unused_skipper.hpp> | |
18 #include <boost/spirit/home/support/unused.hpp> | |
19 #include <boost/spirit/home/support/common_terminals.hpp> | |
20 #include <boost/spirit/home/qi/detail/attributes.hpp> | |
21 #include <boost/spirit/home/support/info.hpp> | |
22 #include <boost/spirit/home/support/handles_container.hpp> | |
23 | |
24 namespace boost { namespace spirit | |
25 { | |
26 /////////////////////////////////////////////////////////////////////////// | |
27 // Enablers | |
28 /////////////////////////////////////////////////////////////////////////// | |
29 template <> | |
30 struct use_directive<qi::domain, tag::lexeme> // enables lexeme | |
31 : mpl::true_ {}; | |
32 }} | |
33 | |
34 namespace boost { namespace spirit { namespace qi | |
35 { | |
36 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS | |
37 using spirit::lexeme; | |
38 #endif | |
39 using spirit::lexeme_type; | |
40 | |
41 template <typename Subject> | |
42 struct lexeme_directive : unary_parser<lexeme_directive<Subject> > | |
43 { | |
44 typedef Subject subject_type; | |
45 lexeme_directive(Subject const& subject_) | |
46 : subject(subject_) {} | |
47 | |
48 template <typename Context, typename Iterator> | |
49 struct attribute | |
50 { | |
51 typedef typename | |
52 traits::attribute_of<subject_type, Context, Iterator>::type | |
53 type; | |
54 }; | |
55 | |
56 template <typename Iterator, typename Context | |
57 , typename Skipper, typename Attribute> | |
58 bool parse(Iterator& first, Iterator const& last | |
59 , Context& context, Skipper const& skipper | |
60 , Attribute& attr_) const | |
61 { | |
62 qi::skip_over(first, last, skipper); | |
63 return subject.parse(first, last, context | |
64 , detail::unused_skipper<Skipper>(skipper), attr_); | |
65 } | |
66 | |
67 template <typename Context> | |
68 info what(Context& context) const | |
69 { | |
70 return info("lexeme", subject.what(context)); | |
71 | |
72 } | |
73 | |
74 Subject subject; | |
75 }; | |
76 | |
77 /////////////////////////////////////////////////////////////////////////// | |
78 // Parser generators: make_xxx function (objects) | |
79 /////////////////////////////////////////////////////////////////////////// | |
80 template <typename Subject, typename Modifiers> | |
81 struct make_directive<tag::lexeme, Subject, Modifiers> | |
82 { | |
83 typedef lexeme_directive<Subject> result_type; | |
84 result_type operator()(unused_type, Subject const& subject, unused_type) const | |
85 { | |
86 return result_type(subject); | |
87 } | |
88 }; | |
89 }}} | |
90 | |
91 namespace boost { namespace spirit { namespace traits | |
92 { | |
93 /////////////////////////////////////////////////////////////////////////// | |
94 template <typename Subject> | |
95 struct has_semantic_action<qi::lexeme_directive<Subject> > | |
96 : unary_has_semantic_action<Subject> {}; | |
97 | |
98 /////////////////////////////////////////////////////////////////////////// | |
99 template <typename Subject, typename Attribute, typename Context | |
100 , typename Iterator> | |
101 struct handles_container<qi::lexeme_directive<Subject>, Attribute | |
102 , Context, Iterator> | |
103 : unary_handles_container<Subject, Attribute, Context, Iterator> {}; | |
104 }}} | |
105 | |
106 #endif |