summaryrefslogtreecommitdiff
path: root/boost/spirit/home/x3/directive
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2016-10-06 10:38:45 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2016-10-06 10:39:52 +0900
commit5cde13f21d36c7224b0e13d11c4b49379ae5210d (patch)
treee8269ac85a4b0f7d416e2565fa4f451b5cb41351 /boost/spirit/home/x3/directive
parentd9ec475d945d3035377a0d89ed42e382d8988891 (diff)
downloadboost-5cde13f21d36c7224b0e13d11c4b49379ae5210d.tar.gz
boost-5cde13f21d36c7224b0e13d11c4b49379ae5210d.tar.bz2
boost-5cde13f21d36c7224b0e13d11c4b49379ae5210d.zip
Imported Upstream version 1.61.0
Change-Id: I96a1f878d1e6164f01e9aadd5147f38fca448d90 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/spirit/home/x3/directive')
-rw-r--r--boost/spirit/home/x3/directive/expect.hpp32
-rw-r--r--boost/spirit/home/x3/directive/with.hpp2
2 files changed, 31 insertions, 3 deletions
diff --git a/boost/spirit/home/x3/directive/expect.hpp b/boost/spirit/home/x3/directive/expect.hpp
index 879d92c2df..fe4491a22e 100644
--- a/boost/spirit/home/x3/directive/expect.hpp
+++ b/boost/spirit/home/x3/directive/expect.hpp
@@ -9,6 +9,8 @@
#include <boost/spirit/home/x3/support/context.hpp>
#include <boost/spirit/home/x3/core/parser.hpp>
+#include <boost/spirit/home/x3/core/detail/parse_into_container.hpp>
+
#include <boost/throw_exception.hpp>
#include <stdexcept>
@@ -24,10 +26,10 @@ namespace boost { namespace spirit { namespace x3
, where_(where), which_(which)
{}
~expectation_failure() throw() {}
-
+
std::string which() const { return which_; }
Iterator const& where() const { return where_; }
-
+
private:
Iterator where_;
@@ -73,4 +75,30 @@ namespace boost { namespace spirit { namespace x3
auto const expect = expect_gen{};
}}}
+namespace boost { namespace spirit { namespace x3 { namespace detail
+{
+ // Special case handling for expect expressions.
+ template <typename Subject, typename Context, typename RContext>
+ struct parse_into_container_impl<expect_directive<Subject>, Context, RContext>
+ {
+ template <typename Iterator, typename Attribute>
+ static bool call(
+ expect_directive<Subject> const& parser
+ , Iterator& first, Iterator const& last
+ , Context const& context, RContext& rcontext, Attribute& attr)
+ {
+ bool r = parse_into_container(
+ parser.subject, first, last, context, rcontext, attr);
+
+ if (!r)
+ {
+ boost::throw_exception(
+ expectation_failure<Iterator>(
+ first, what(parser.subject)));
+ }
+ return r;
+ }
+ };
+}}}}
+
#endif
diff --git a/boost/spirit/home/x3/directive/with.hpp b/boost/spirit/home/x3/directive/with.hpp
index 359f5adf1c..153c236b22 100644
--- a/boost/spirit/home/x3/directive/with.hpp
+++ b/boost/spirit/home/x3/directive/with.hpp
@@ -72,7 +72,7 @@ namespace boost { namespace spirit { namespace x3
template <typename ID, typename T>
struct with_context<ID, T, unused_type>
{
- typedef context<ID, T> const type;
+ typedef context<ID, T> type;
};
template <typename ID, typename T>