Warning, file /include/boost/spirit/home/qi/auxiliary/eps.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 #if !defined(BOOST_SPIRIT_EPS_MARCH_23_2007_0454PM)
0008 #define BOOST_SPIRIT_EPS_MARCH_23_2007_0454PM
0009
0010 #if defined(_MSC_VER)
0011 #pragma once
0012 #endif
0013
0014 #include <boost/spirit/home/qi/domain.hpp>
0015 #include <boost/spirit/home/qi/skip_over.hpp>
0016 #include <boost/spirit/home/qi/meta_compiler.hpp>
0017 #include <boost/spirit/home/support/unused.hpp>
0018 #include <boost/spirit/home/support/info.hpp>
0019 #include <boost/spirit/home/support/common_terminals.hpp>
0020 #include <boost/fusion/include/at.hpp>
0021 #include <boost/type_traits/is_convertible.hpp>
0022
0023 namespace boost { namespace spirit
0024 {
0025
0026
0027
0028 template <>
0029 struct use_terminal<qi::domain, tag::eps>
0030 : mpl::true_ {};
0031
0032 template <typename A0>
0033 struct use_terminal<qi::domain
0034 , terminal_ex<tag::eps, fusion::vector1<A0> >
0035 > : is_convertible<A0, bool> {};
0036
0037 template <>
0038 struct use_lazy_terminal<
0039 qi::domain, tag::eps, 1
0040 > : mpl::true_ {};
0041 }}
0042
0043 namespace boost { namespace spirit { namespace qi
0044 {
0045 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
0046 using spirit::eps;
0047 #endif
0048 using spirit::eps_type;
0049
0050 struct eps_parser : primitive_parser<eps_parser>
0051 {
0052 template <typename Context, typename Iterator>
0053 struct attribute
0054 {
0055 typedef unused_type type;
0056 };
0057
0058 template <typename Iterator, typename Context
0059 , typename Skipper, typename Attribute>
0060 bool parse(Iterator& first, Iterator const& last
0061 , Context& , Skipper const& skipper
0062 , Attribute& ) const
0063 {
0064 qi::skip_over(first, last, skipper);
0065 return true;
0066 }
0067
0068 template <typename Context>
0069 info what(Context& ) const
0070 {
0071 return info("eps");
0072 }
0073 };
0074
0075 struct semantic_predicate : primitive_parser<semantic_predicate>
0076 {
0077 template <typename Context, typename Iterator>
0078 struct attribute
0079 {
0080 typedef unused_type type;
0081 };
0082
0083 semantic_predicate(bool predicate_)
0084 : predicate(predicate_) {}
0085
0086 template <typename Iterator, typename Context
0087 , typename Skipper, typename Attribute>
0088 bool parse(Iterator& first, Iterator const& last
0089 , Context& , Skipper const& skipper
0090 , Attribute& ) const
0091 {
0092 qi::skip_over(first, last, skipper);
0093 return predicate;
0094 }
0095
0096 template <typename Context>
0097 info what(Context& ) const
0098 {
0099 return info("semantic-predicate");
0100 }
0101
0102 bool predicate;
0103 };
0104
0105
0106
0107
0108 template <typename Modifiers>
0109 struct make_primitive<tag::eps, Modifiers>
0110 {
0111 typedef eps_parser result_type;
0112 result_type operator()(unused_type, unused_type) const
0113 {
0114 return result_type();
0115 }
0116 };
0117
0118 template <typename Modifiers, typename A0>
0119 struct make_primitive<
0120 terminal_ex<tag::eps, fusion::vector1<A0> >
0121 , Modifiers>
0122 {
0123 typedef semantic_predicate result_type;
0124 template <typename Terminal>
0125 result_type operator()(Terminal const& term, unused_type) const
0126 {
0127 return result_type(fusion::at_c<0>(term.args) ? true : false);
0128 }
0129 };
0130 }}}
0131
0132 #endif