comparison DEPENDENCIES/generic/include/boost/spirit/home/x3/operator/plus.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(SPIRIT_PLUS_MARCH_13_2007_0127PM)
9 #define SPIRIT_PLUS_MARCH_13_2007_0127PM
10
11 #if defined(_MSC_VER)
12 #pragma once
13 #endif
14
15 #include <boost/spirit/home/x3/core/parser.hpp>
16 #include <boost/spirit/home/x3/support/traits/container_traits.hpp>
17 #include <boost/spirit/home/x3/support/traits/attribute_of.hpp>
18 #include <boost/spirit/home/x3/core/detail/parse_into_container.hpp>
19
20 namespace boost { namespace spirit { namespace x3
21 {
22 template <typename Subject>
23 struct plus : unary_parser<Subject, plus<Subject>>
24 {
25 typedef unary_parser<Subject, plus<Subject>> base_type;
26 static bool const handles_container = true;
27
28 plus(Subject const& subject)
29 : base_type(subject) {}
30
31 template <typename Iterator, typename Context
32 , typename RContext, typename Attribute>
33 bool parse(Iterator& first, Iterator const& last
34 , Context const& context, RContext& rcontext, Attribute& attr) const
35 {
36 if (!detail::parse_into_container(
37 this->subject, first, last, context, rcontext, attr))
38 return false;
39
40 while (detail::parse_into_container(
41 this->subject, first, last, context, rcontext, attr))
42 ;
43 return true;
44 }
45 };
46
47 template <typename Subject>
48 inline plus<typename extension::as_parser<Subject>::value_type>
49 operator+(Subject const& subject)
50 {
51 return {as_parser(subject)};
52 }
53 }}}
54
55 namespace boost { namespace spirit { namespace x3 { namespace traits
56 {
57 template <typename Subject, typename Context>
58 struct attribute_of<x3::plus<Subject>, Context>
59 : build_container<
60 typename attribute_of<Subject, Context>::type> {};
61 }}}}
62
63 #endif