Chris@102
|
1 /*=============================================================================
|
Chris@102
|
2 Copyright (c) 2001-2014 Joel de Guzman
|
Chris@102
|
3
|
Chris@102
|
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@102
|
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@102
|
6 ==============================================================================*/
|
Chris@102
|
7 #if !defined(BOOST_SPIRIT_X3_CHAR_PARSER_APR_16_2006_0906AM)
|
Chris@102
|
8 #define BOOST_SPIRIT_X3_CHAR_PARSER_APR_16_2006_0906AM
|
Chris@102
|
9
|
Chris@102
|
10 #if defined(_MSC_VER)
|
Chris@102
|
11 #pragma once
|
Chris@102
|
12 #endif
|
Chris@102
|
13
|
Chris@102
|
14 #include <boost/spirit/home/x3/core/parser.hpp>
|
Chris@102
|
15 #include <boost/spirit/home/x3/core/skip_over.hpp>
|
Chris@102
|
16 #include <boost/spirit/home/x3/support/traits/move_to.hpp>
|
Chris@102
|
17
|
Chris@102
|
18 namespace boost { namespace spirit { namespace x3
|
Chris@102
|
19 {
|
Chris@102
|
20 ///////////////////////////////////////////////////////////////////////////
|
Chris@102
|
21 // The base char_parser
|
Chris@102
|
22 ///////////////////////////////////////////////////////////////////////////
|
Chris@102
|
23 template <typename Derived>
|
Chris@102
|
24 struct char_parser : parser<Derived>
|
Chris@102
|
25 {
|
Chris@102
|
26 template <typename Iterator, typename Context, typename Attribute>
|
Chris@102
|
27 bool parse(
|
Chris@102
|
28 Iterator& first, Iterator const& last
|
Chris@102
|
29 , Context const& context, unused_type, Attribute& attr) const
|
Chris@102
|
30 {
|
Chris@102
|
31 x3::skip_over(first, last, context);
|
Chris@102
|
32
|
Chris@102
|
33 if (first != last && this->derived().test(*first, context))
|
Chris@102
|
34 {
|
Chris@102
|
35 x3::traits::move_to(*first, attr);
|
Chris@102
|
36 ++first;
|
Chris@102
|
37 return true;
|
Chris@102
|
38 }
|
Chris@102
|
39 return false;
|
Chris@102
|
40 }
|
Chris@102
|
41 };
|
Chris@102
|
42 }}}
|
Chris@102
|
43
|
Chris@102
|
44 #endif
|