File indexing completed on 2025-01-19 09:47:43
0001
0002
0003
0004
0005
0006
0007
0008 #if !defined(BOOST_SPIRIT_EOL_APRIL_18_2008_0751PM)
0009 #define BOOST_SPIRIT_EOL_APRIL_18_2008_0751PM
0010
0011 #if defined(_MSC_VER)
0012 #pragma once
0013 #endif
0014
0015 #include <boost/mpl/bool.hpp>
0016 #include <boost/spirit/home/qi/domain.hpp>
0017 #include <boost/spirit/home/qi/parser.hpp>
0018 #include <boost/spirit/home/qi/meta_compiler.hpp>
0019 #include <boost/spirit/home/qi/skip_over.hpp>
0020 #include <boost/spirit/home/support/common_terminals.hpp>
0021
0022 namespace boost { namespace spirit
0023 {
0024
0025
0026
0027 template <>
0028 struct use_terminal<qi::domain, tag::eol>
0029 : mpl::true_ {};
0030 }}
0031
0032 namespace boost { namespace spirit { namespace qi
0033 {
0034 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
0035 using spirit::eol;
0036 #endif
0037 using spirit::eol_type;
0038
0039 struct eol_parser : primitive_parser<eol_parser>
0040 {
0041 template <typename Context, typename Iterator>
0042 struct attribute
0043 {
0044 typedef unused_type type;
0045 };
0046
0047 template <typename Iterator, typename Context
0048 , typename Skipper, typename Attribute>
0049 bool parse(Iterator& first, Iterator const& last
0050 , Context& , Skipper const& skipper
0051 , Attribute& ) const
0052 {
0053 qi::skip_over(first, last, skipper);
0054
0055 Iterator it = first;
0056 bool matched = false;
0057 if (it != last && *it == '\r')
0058 {
0059 matched = true;
0060 ++it;
0061 }
0062 if (it != last && *it == '\n')
0063 {
0064 matched = true;
0065 ++it;
0066 }
0067
0068 if (!matched)
0069 return false;
0070
0071 first = it;
0072 return true;
0073 }
0074
0075 template <typename Context>
0076 info what(Context& ) const
0077 {
0078 return info("eol");
0079 }
0080 };
0081
0082
0083
0084
0085 template <typename Modifiers>
0086 struct make_primitive<tag::eol, Modifiers>
0087 {
0088 typedef eol_parser result_type;
0089 result_type operator()(unused_type, unused_type) const
0090 {
0091 return result_type();
0092 }
0093 };
0094 }}}
0095
0096 #endif
0097
0098