comparison DEPENDENCIES/generic/include/boost/spirit/home/x3/auxiliary/eol.hpp @ 102:f46d142149f5

Whoops, finish that update
author Chris Cannam
date Mon, 07 Sep 2015 11:13:41 +0100
parents
children
comparison
equal deleted inserted replaced
101:c530137014c0 102:f46d142149f5
1 /*=============================================================================
2 Copyright (c) 2001-2014 Joel de Guzman
3 Copyright (c) 2001-2011 Hartmut Kaiser
4
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #if !defined(BOOST_SPIRIT_X3_EOL_MARCH_23_2007_0454PM)
9 #define BOOST_SPIRIT_X3_EOL_MARCH_23_2007_0454PM
10
11 #if defined(_MSC_VER)
12 #pragma once
13 #endif
14
15 #include <boost/spirit/home/x3/core/skip_over.hpp>
16 #include <boost/spirit/home/x3/core/parser.hpp>
17 #include <boost/spirit/home/x3/support/unused.hpp>
18
19 namespace boost { namespace spirit { namespace x3
20 {
21 struct eol_parser : parser<eol_parser>
22 {
23 typedef unused_type attribute_type;
24 static bool const has_attribute = false;
25
26 template <typename Iterator, typename Context, typename Attribute>
27 bool parse(Iterator& first, Iterator const& last
28 , Context const& context, unused_type, Attribute& /*attr*/) const
29 {
30 x3::skip_over(first, last, context);
31 Iterator iter = first;
32 bool matched = false;
33 if (iter != last && *iter == '\r') // CR
34 {
35 matched = true;
36 ++iter;
37 }
38 if (iter != last && *iter == '\n') // LF
39 {
40 matched = true;
41 ++iter;
42 }
43
44 if (matched) first = iter;
45 return matched;
46 }
47 };
48
49 template<>
50 struct get_info<eol_parser>
51 {
52 typedef std::string result_type;
53 result_type operator()(eol_parser const &) const { return "eol"; }
54 };
55
56 eol_parser const eol = eol_parser();
57 }}}
58
59 #endif