Warning, file /include/boost/spirit/home/qi/directive/lexeme.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007 #ifndef BOOST_SPIRIT_QI_DIRECTIVE_LEXEME_HPP
0008 #define BOOST_SPIRIT_QI_DIRECTIVE_LEXEME_HPP
0009
0010 #if defined(_MSC_VER)
0011 #pragma once
0012 #endif
0013
0014 #include <boost/spirit/home/qi/meta_compiler.hpp>
0015 #include <boost/spirit/home/qi/skip_over.hpp>
0016 #include <boost/spirit/home/qi/parser.hpp>
0017 #include <boost/spirit/home/qi/detail/unused_skipper.hpp>
0018 #include <boost/spirit/home/support/unused.hpp>
0019 #include <boost/spirit/home/support/common_terminals.hpp>
0020 #include <boost/spirit/home/qi/detail/attributes.hpp>
0021 #include <boost/spirit/home/support/info.hpp>
0022 #include <boost/spirit/home/support/handles_container.hpp>
0023 #include <boost/utility/enable_if.hpp>
0024
0025 namespace boost { namespace spirit
0026 {
0027
0028
0029
0030 template <>
0031 struct use_directive<qi::domain, tag::lexeme>
0032 : mpl::true_ {};
0033 }}
0034
0035 namespace boost { namespace spirit { namespace qi
0036 {
0037 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
0038 using spirit::lexeme;
0039 #endif
0040 using spirit::lexeme_type;
0041
0042 template <typename Subject>
0043 struct lexeme_directive : unary_parser<lexeme_directive<Subject> >
0044 {
0045 typedef Subject subject_type;
0046 lexeme_directive(Subject const& subject_)
0047 : subject(subject_) {}
0048
0049 template <typename Context, typename Iterator>
0050 struct attribute
0051 {
0052 typedef typename
0053 traits::attribute_of<subject_type, Context, Iterator>::type
0054 type;
0055 };
0056
0057 template <typename Iterator, typename Context
0058 , typename Skipper, typename Attribute>
0059 typename disable_if<detail::is_unused_skipper<Skipper>, bool>::type
0060 parse(Iterator& first, Iterator const& last
0061 , Context& context, Skipper const& skipper
0062 , Attribute& attr_) const
0063 {
0064 qi::skip_over(first, last, skipper);
0065 return subject.parse(first, last, context
0066 , detail::unused_skipper<Skipper>(skipper), attr_);
0067 }
0068 template <typename Iterator, typename Context
0069 , typename Skipper, typename Attribute>
0070 typename enable_if<detail::is_unused_skipper<Skipper>, bool>::type
0071 parse(Iterator& first, Iterator const& last
0072 , Context& context, Skipper const& skipper
0073 , Attribute& attr_) const
0074 {
0075
0076
0077 return subject.parse(first, last, context
0078 , skipper, attr_);
0079 }
0080
0081 template <typename Context>
0082 info what(Context& context) const
0083 {
0084 return info("lexeme", subject.what(context));
0085
0086 }
0087
0088 Subject subject;
0089 };
0090
0091
0092
0093
0094 template <typename Subject, typename Modifiers>
0095 struct make_directive<tag::lexeme, Subject, Modifiers>
0096 {
0097 typedef lexeme_directive<Subject> result_type;
0098 result_type operator()(unused_type, Subject const& subject, unused_type) const
0099 {
0100 return result_type(subject);
0101 }
0102 };
0103 }}}
0104
0105 namespace boost { namespace spirit { namespace traits
0106 {
0107
0108 template <typename Subject>
0109 struct has_semantic_action<qi::lexeme_directive<Subject> >
0110 : unary_has_semantic_action<Subject> {};
0111
0112
0113 template <typename Subject, typename Attribute, typename Context
0114 , typename Iterator>
0115 struct handles_container<qi::lexeme_directive<Subject>, Attribute
0116 , Context, Iterator>
0117 : unary_handles_container<Subject, Attribute, Context, Iterator> {};
0118 }}}
0119
0120 #endif