File indexing completed on 2025-01-31 10:02:34
0001
0002
0003
0004
0005
0006
0007
0008 #if !defined(BOOST_SPIRIT_X3_EOL_MARCH_23_2007_0454PM)
0009 #define BOOST_SPIRIT_X3_EOL_MARCH_23_2007_0454PM
0010
0011 #include <boost/spirit/home/x3/core/skip_over.hpp>
0012 #include <boost/spirit/home/x3/core/parser.hpp>
0013 #include <boost/spirit/home/x3/support/unused.hpp>
0014
0015 namespace boost { namespace spirit { namespace x3
0016 {
0017 struct eol_parser : parser<eol_parser>
0018 {
0019 typedef unused_type attribute_type;
0020 static bool const has_attribute = false;
0021
0022 template <typename Iterator, typename Context, typename Attribute>
0023 bool parse(Iterator& first, Iterator const& last
0024 , Context const& context, unused_type, Attribute& ) const
0025 {
0026 x3::skip_over(first, last, context);
0027 Iterator iter = first;
0028 bool matched = false;
0029 if (iter != last && *iter == '\r')
0030 {
0031 matched = true;
0032 ++iter;
0033 }
0034 if (iter != last && *iter == '\n')
0035 {
0036 matched = true;
0037 ++iter;
0038 }
0039
0040 if (matched) first = iter;
0041 return matched;
0042 }
0043 };
0044
0045 template<>
0046 struct get_info<eol_parser>
0047 {
0048 typedef std::string result_type;
0049 result_type operator()(eol_parser const &) const { return "eol"; }
0050 };
0051
0052 constexpr auto eol = eol_parser{};
0053 }}}
0054
0055 #endif