summaryrefslogtreecommitdiff
path: root/boost/metaparse/v1
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/metaparse/v1
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/metaparse/v1')
-rw-r--r--boost/metaparse/v1/accept.hpp36
-rw-r--r--boost/metaparse/v1/accept_tag.hpp47
-rw-r--r--boost/metaparse/v1/accept_when.hpp59
-rw-r--r--boost/metaparse/v1/alphanum.hpp25
-rw-r--r--boost/metaparse/v1/always.hpp51
-rw-r--r--boost/metaparse/v1/always_c.hpp25
-rw-r--r--boost/metaparse/v1/build_parser.hpp66
-rw-r--r--boost/metaparse/v1/change_error_message.hpp39
-rw-r--r--boost/metaparse/v1/debug_parsing_error.hpp105
-rw-r--r--boost/metaparse/v1/define_error.hpp25
-rw-r--r--boost/metaparse/v1/digit.hpp34
-rw-r--r--boost/metaparse/v1/digit_val.hpp26
-rw-r--r--boost/metaparse/v1/empty.hpp42
-rw-r--r--boost/metaparse/v1/entire_input.hpp33
-rw-r--r--boost/metaparse/v1/error/digit_expected.hpp26
-rw-r--r--boost/metaparse/v1/error/end_of_input_expected.hpp29
-rw-r--r--boost/metaparse/v1/error/expected_to_fail.hpp30
-rw-r--r--boost/metaparse/v1/error/index_out_of_range.hpp41
-rw-r--r--boost/metaparse/v1/error/letter_expected.hpp26
-rw-r--r--boost/metaparse/v1/error/literal_expected.hpp36
-rw-r--r--boost/metaparse/v1/error/none_of_the_expected_cases_found.hpp29
-rw-r--r--boost/metaparse/v1/error/unexpected_character.hpp29
-rw-r--r--boost/metaparse/v1/error/unexpected_end_of_input.hpp30
-rw-r--r--boost/metaparse/v1/error/unpaired.hpp50
-rw-r--r--boost/metaparse/v1/error/whitespace_expected.hpp30
-rw-r--r--boost/metaparse/v1/except.hpp40
-rw-r--r--boost/metaparse/v1/fail.hpp30
-rw-r--r--boost/metaparse/v1/fail_at_first_char_expected.hpp58
-rw-r--r--boost/metaparse/v1/fail_tag.hpp42
-rw-r--r--boost/metaparse/v1/first_of.hpp35
-rw-r--r--boost/metaparse/v1/foldl.hpp65
-rw-r--r--boost/metaparse/v1/foldl1.hpp38
-rw-r--r--boost/metaparse/v1/foldl_reject_incomplete.hpp77
-rw-r--r--boost/metaparse/v1/foldl_reject_incomplete1.hpp38
-rw-r--r--boost/metaparse/v1/foldl_reject_incomplete_start_with_parser.hpp55
-rw-r--r--boost/metaparse/v1/foldl_start_with_parser.hpp45
-rw-r--r--boost/metaparse/v1/foldr.hpp25
-rw-r--r--boost/metaparse/v1/foldr1.hpp38
-rw-r--r--boost/metaparse/v1/foldr_reject_incomplete.hpp33
-rw-r--r--boost/metaparse/v1/foldr_reject_incomplete1.hpp38
-rw-r--r--boost/metaparse/v1/foldr_start_with_parser.hpp78
-rw-r--r--boost/metaparse/v1/fwd/accept.hpp22
-rw-r--r--boost/metaparse/v1/fwd/build_parser.hpp22
-rw-r--r--boost/metaparse/v1/fwd/get_col.hpp26
-rw-r--r--boost/metaparse/v1/fwd/get_line.hpp25
-rw-r--r--boost/metaparse/v1/fwd/get_message.hpp25
-rw-r--r--boost/metaparse/v1/fwd/get_position.hpp25
-rw-r--r--boost/metaparse/v1/fwd/get_prev_char.hpp25
-rw-r--r--boost/metaparse/v1/fwd/get_remaining.hpp25
-rw-r--r--boost/metaparse/v1/fwd/get_result.hpp25
-rw-r--r--boost/metaparse/v1/fwd/next_char.hpp25
-rw-r--r--boost/metaparse/v1/fwd/next_line.hpp25
-rw-r--r--boost/metaparse/v1/fwd/reject.hpp22
-rw-r--r--boost/metaparse/v1/fwd/source_position.hpp22
-rw-r--r--boost/metaparse/v1/fwd/string.hpp38
-rw-r--r--boost/metaparse/v1/get_col.hpp29
-rw-r--r--boost/metaparse/v1/get_line.hpp29
-rw-r--r--boost/metaparse/v1/get_message.hpp29
-rw-r--r--boost/metaparse/v1/get_position.hpp29
-rw-r--r--boost/metaparse/v1/get_prev_char.hpp29
-rw-r--r--boost/metaparse/v1/get_remaining.hpp29
-rw-r--r--boost/metaparse/v1/get_result.hpp29
-rw-r--r--boost/metaparse/v1/grammar.hpp386
-rw-r--r--boost/metaparse/v1/if_.hpp43
-rw-r--r--boost/metaparse/v1/impl/apply_parser.hpp63
-rw-r--r--boost/metaparse/v1/impl/assert_string_length.hpp31
-rw-r--r--boost/metaparse/v1/impl/at_c.hpp66
-rw-r--r--boost/metaparse/v1/impl/back_inserter.hpp32
-rw-r--r--boost/metaparse/v1/impl/concat.hpp106
-rw-r--r--boost/metaparse/v1/impl/empty_string.hpp44
-rw-r--r--boost/metaparse/v1/impl/front_inserter.hpp32
-rw-r--r--boost/metaparse/v1/impl/fwd/iterate_impl.hpp34
-rw-r--r--boost/metaparse/v1/impl/has_type.hpp26
-rw-r--r--boost/metaparse/v1/impl/is_any.hpp70
-rw-r--r--boost/metaparse/v1/impl/is_char_c.hpp33
-rw-r--r--boost/metaparse/v1/impl/iterate_impl.hpp46
-rw-r--r--boost/metaparse/v1/impl/iterate_impl_unchecked.hpp44
-rw-r--r--boost/metaparse/v1/impl/later_result.hpp39
-rw-r--r--boost/metaparse/v1/impl/next_digit.hpp36
-rw-r--r--boost/metaparse/v1/impl/no_char.hpp17
-rw-r--r--boost/metaparse/v1/impl/nth_of_c.hpp61
-rw-r--r--boost/metaparse/v1/impl/nth_of_c_impl.hpp77
-rw-r--r--boost/metaparse/v1/impl/one_char_except_not_used.hpp24
-rw-r--r--boost/metaparse/v1/impl/one_of.hpp44
-rw-r--r--boost/metaparse/v1/impl/one_of_fwd_op.hpp46
-rw-r--r--boost/metaparse/v1/impl/pop_back.hpp52
-rw-r--r--boost/metaparse/v1/impl/pop_front.hpp62
-rw-r--r--boost/metaparse/v1/impl/push_back_c.hpp40
-rw-r--r--boost/metaparse/v1/impl/push_front_c.hpp53
-rw-r--r--boost/metaparse/v1/impl/remove_trailing_no_chars.hpp57
-rw-r--r--boost/metaparse/v1/impl/returns.hpp28
-rw-r--r--boost/metaparse/v1/impl/sequence.hpp59
-rw-r--r--boost/metaparse/v1/impl/sequence_impl.hpp37
-rw-r--r--boost/metaparse/v1/impl/size.hpp69
-rw-r--r--boost/metaparse/v1/impl/skip_seq.hpp74
-rw-r--r--boost/metaparse/v1/impl/split_at_c.hpp101
-rw-r--r--boost/metaparse/v1/impl/string_iterator.hpp159
-rw-r--r--boost/metaparse/v1/impl/string_iterator_tag.hpp27
-rw-r--r--boost/metaparse/v1/impl/update_c.hpp93
-rw-r--r--boost/metaparse/v1/impl/void_.hpp25
-rw-r--r--boost/metaparse/v1/int_.hpp25
-rw-r--r--boost/metaparse/v1/is_error.hpp43
-rw-r--r--boost/metaparse/v1/iterate.hpp24
-rw-r--r--boost/metaparse/v1/iterate_c.hpp26
-rw-r--r--boost/metaparse/v1/keyword.hpp82
-rw-r--r--boost/metaparse/v1/last_of.hpp66
-rw-r--r--boost/metaparse/v1/letter.hpp29
-rw-r--r--boost/metaparse/v1/lit.hpp24
-rw-r--r--boost/metaparse/v1/lit_c.hpp34
-rw-r--r--boost/metaparse/v1/look_ahead.hpp50
-rw-r--r--boost/metaparse/v1/middle_of.hpp48
-rw-r--r--boost/metaparse/v1/next_char.hpp30
-rw-r--r--boost/metaparse/v1/next_line.hpp30
-rw-r--r--boost/metaparse/v1/nth_of.hpp39
-rw-r--r--boost/metaparse/v1/nth_of_c.hpp70
-rw-r--r--boost/metaparse/v1/one_char.hpp71
-rw-r--r--boost/metaparse/v1/one_char_except.hpp85
-rw-r--r--boost/metaparse/v1/one_char_except_c.hpp96
-rw-r--r--boost/metaparse/v1/one_of.hpp42
-rw-r--r--boost/metaparse/v1/one_of_c.hpp80
-rw-r--r--boost/metaparse/v1/optional.hpp40
-rw-r--r--boost/metaparse/v1/range.hpp33
-rw-r--r--boost/metaparse/v1/range_c.hpp33
-rw-r--r--boost/metaparse/v1/reject.hpp33
-rw-r--r--boost/metaparse/v1/repeated.hpp27
-rw-r--r--boost/metaparse/v1/repeated1.hpp29
-rw-r--r--boost/metaparse/v1/repeated_one_of.hpp45
-rw-r--r--boost/metaparse/v1/repeated_one_of1.hpp45
-rw-r--r--boost/metaparse/v1/repeated_reject_incomplete.hpp29
-rw-r--r--boost/metaparse/v1/repeated_reject_incomplete1.hpp29
-rw-r--r--boost/metaparse/v1/return_.hpp34
-rw-r--r--boost/metaparse/v1/sequence.hpp64
-rw-r--r--boost/metaparse/v1/sequence_apply.hpp80
-rw-r--r--boost/metaparse/v1/source_position.hpp156
-rw-r--r--boost/metaparse/v1/source_position_tag.hpp80
-rw-r--r--boost/metaparse/v1/space.hpp30
-rw-r--r--boost/metaparse/v1/spaces.hpp24
-rw-r--r--boost/metaparse/v1/start.hpp32
-rw-r--r--boost/metaparse/v1/string.hpp408
-rw-r--r--boost/metaparse/v1/string_tag.hpp24
-rw-r--r--boost/metaparse/v1/swap.hpp29
-rw-r--r--boost/metaparse/v1/token.hpp28
-rw-r--r--boost/metaparse/v1/transform.hpp50
-rw-r--r--boost/metaparse/v1/transform_error.hpp40
-rw-r--r--boost/metaparse/v1/transform_error_message.hpp49
-rw-r--r--boost/metaparse/v1/unless_error.hpp29
-rw-r--r--boost/metaparse/v1/util/digit_to_int.hpp38
-rw-r--r--boost/metaparse/v1/util/digit_to_int_c.hpp40
-rw-r--r--boost/metaparse/v1/util/in_range.hpp75
-rw-r--r--boost/metaparse/v1/util/in_range_c.hpp38
-rw-r--r--boost/metaparse/v1/util/int_to_digit.hpp38
-rw-r--r--boost/metaparse/v1/util/int_to_digit_c.hpp38
-rw-r--r--boost/metaparse/v1/util/is_digit.hpp38
-rw-r--r--boost/metaparse/v1/util/is_lcase_letter.hpp38
-rw-r--r--boost/metaparse/v1/util/is_letter.hpp44
-rw-r--r--boost/metaparse/v1/util/is_ucase_letter.hpp38
-rw-r--r--boost/metaparse/v1/util/is_whitespace.hpp38
-rw-r--r--boost/metaparse/v1/util/is_whitespace_c.hpp32
158 files changed, 7584 insertions, 0 deletions
diff --git a/boost/metaparse/v1/accept.hpp b/boost/metaparse/v1/accept.hpp
new file mode 100644
index 0000000000..075c997d68
--- /dev/null
+++ b/boost/metaparse/v1/accept.hpp
@@ -0,0 +1,36 @@
+#ifndef BOOST_METAPARSE_V1_ACCEPT_HPP
+#define BOOST_METAPARSE_V1_ACCEPT_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/fwd/accept.hpp>
+#include <boost/metaparse/v1/accept_tag.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class Result, class Remaining, class Pos>
+ struct accept
+ {
+ typedef accept_tag tag;
+
+ typedef
+ accept<Result, typename Remaining::type, typename Pos::type>
+ type;
+
+ typedef Result result;
+ typedef Remaining remaining;
+ typedef Pos source_position;
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/accept_tag.hpp b/boost/metaparse/v1/accept_tag.hpp
new file mode 100644
index 0000000000..82d03dd4dd
--- /dev/null
+++ b/boost/metaparse/v1/accept_tag.hpp
@@ -0,0 +1,47 @@
+#ifndef BOOST_METAPARSE_V1_ACCEPT_TAG_HPP
+#define BOOST_METAPARSE_V1_ACCEPT_TAG_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/fwd/get_remaining.hpp>
+#include <boost/metaparse/v1/fwd/get_position.hpp>
+#include <boost/metaparse/v1/fwd/get_result.hpp>
+
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ struct accept_tag { typedef accept_tag type; };
+
+ template <>
+ struct get_position_impl<accept_tag>
+ {
+ template <class A>
+ struct apply : A::source_position {};
+ };
+
+ template <>
+ struct get_remaining_impl<accept_tag>
+ {
+ template <class A>
+ struct apply : A::remaining {};
+ };
+
+ template <>
+ struct get_result_impl<accept_tag>
+ {
+ template <class A>
+ struct apply { typedef typename A::result type; };
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/accept_when.hpp b/boost/metaparse/v1/accept_when.hpp
new file mode 100644
index 0000000000..425064dcd5
--- /dev/null
+++ b/boost/metaparse/v1/accept_when.hpp
@@ -0,0 +1,59 @@
+#ifndef BOOST_METAPARSE_V1_ACCEPT_WHEN_HPP
+#define BOOST_METAPARSE_V1_ACCEPT_WHEN_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/get_result.hpp>
+#include <boost/metaparse/v1/reject.hpp>
+#include <boost/metaparse/v1/is_error.hpp>
+
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/eval_if.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class Pred, class Msg>
+ struct accept_when
+ {
+ private:
+ struct unchecked
+ {
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::eval_if<
+ typename Pred::template apply<
+ typename get_result<typename P::template apply<S, Pos> >::type
+ >::type,
+ typename P::template apply<S, Pos>,
+ reject<Msg, Pos>
+ >
+ {};
+ };
+ public:
+ typedef accept_when type;
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::if_<
+ is_error<typename P::template apply<S, Pos> >,
+ P,
+ unchecked
+ >::type::template apply<
+ S,
+ Pos
+ >
+ {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/alphanum.hpp b/boost/metaparse/v1/alphanum.hpp
new file mode 100644
index 0000000000..e46386344e
--- /dev/null
+++ b/boost/metaparse/v1/alphanum.hpp
@@ -0,0 +1,25 @@
+#ifndef BOOST_METAPARSE_V1_ALPHANUM_HPP
+#define BOOST_METAPARSE_V1_ALPHANUM_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/one_of.hpp>
+#include <boost/metaparse/v1/digit.hpp>
+#include <boost/metaparse/v1/letter.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ typedef one_of<letter, digit> alphanum;
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/always.hpp b/boost/metaparse/v1/always.hpp
new file mode 100644
index 0000000000..0a10ff4573
--- /dev/null
+++ b/boost/metaparse/v1/always.hpp
@@ -0,0 +1,51 @@
+#ifndef BOOST_METAPARSE_V1_ALWAYS_HPP
+#define BOOST_METAPARSE_V1_ALWAYS_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/accept.hpp>
+#include <boost/metaparse/v1/is_error.hpp>
+#include <boost/metaparse/v1/get_remaining.hpp>
+#include <boost/metaparse/v1/get_position.hpp>
+
+#include <boost/mpl/eval_if.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class Result>
+ struct always
+ {
+ private:
+ template <class Res>
+ struct apply_unchecked :
+ accept<
+ Result,
+ typename get_remaining<Res>::type,
+ typename get_position<Res>::type
+ >
+ {};
+ public:
+ typedef always type;
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::eval_if<
+ typename is_error<typename P::template apply<S, Pos> >::type,
+ typename P::template apply<S, Pos>,
+ apply_unchecked<typename P::template apply<S, Pos> >
+ >
+ {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/always_c.hpp b/boost/metaparse/v1/always_c.hpp
new file mode 100644
index 0000000000..4cc06e1169
--- /dev/null
+++ b/boost/metaparse/v1/always_c.hpp
@@ -0,0 +1,25 @@
+#ifndef BOOST_METAPARSE_V1_ALWAYS_C_HPP
+#define BOOST_METAPARSE_V1_ALWAYS_C_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/always.hpp>
+#include <boost/metaparse/v1/lit_c.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <char C, class Result>
+ struct always_c : always<lit_c<C>, Result> {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/build_parser.hpp b/boost/metaparse/v1/build_parser.hpp
new file mode 100644
index 0000000000..692fcf74ad
--- /dev/null
+++ b/boost/metaparse/v1/build_parser.hpp
@@ -0,0 +1,66 @@
+#ifndef BOOST_METAPARSE_V1_BUILD_PARSER_HPP
+#define BOOST_METAPARSE_V1_BUILD_PARSER_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/fwd/build_parser.hpp>
+#include <boost/metaparse/v1/start.hpp>
+#include <boost/metaparse/v1/get_result.hpp>
+#include <boost/metaparse/v1/get_position.hpp>
+#include <boost/metaparse/v1/get_message.hpp>
+#include <boost/metaparse/v1/get_line.hpp>
+#include <boost/metaparse/v1/get_col.hpp>
+#include <boost/metaparse/v1/is_error.hpp>
+
+#include <boost/mpl/eval_if.hpp>
+
+#include <boost/static_assert.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <int Line, int Col, class Msg>
+ struct x__________________PARSING_FAILED__________________x
+ {
+ BOOST_STATIC_ASSERT(Line == Line + 1);
+ };
+
+ template <class P, class S>
+ struct parsing_failed :
+ x__________________PARSING_FAILED__________________x<
+ get_line<
+ get_position<typename P::template apply<S, start> >
+ >::type::value,
+ get_col<
+ get_position<typename P::template apply<S, start> >
+ >::type::value,
+ typename get_message<typename P::template apply<S, start> >::type
+ >
+ {};
+
+ template <class P>
+ struct build_parser
+ {
+ typedef build_parser type;
+
+ template <class S>
+ struct apply :
+ boost::mpl::eval_if<
+ typename is_error<typename P::template apply<S, start> >::type,
+ parsing_failed<P, S>,
+ get_result<typename P::template apply<S, start> >
+ >
+ {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/change_error_message.hpp b/boost/metaparse/v1/change_error_message.hpp
new file mode 100644
index 0000000000..00077c930c
--- /dev/null
+++ b/boost/metaparse/v1/change_error_message.hpp
@@ -0,0 +1,39 @@
+#ifndef BOOST_METAPARSE_V1_CHANGE_ERROR_MESSAGE_HPP
+#define BOOST_METAPARSE_V1_CHANGE_ERROR_MESSAGE_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/is_error.hpp>
+#include <boost/metaparse/v1/reject.hpp>
+
+#include <boost/mpl/eval_if.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class Msg>
+ struct change_error_message
+ {
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::eval_if<
+ typename is_error<typename P::template apply<S, Pos> >::type,
+ reject<Msg, Pos>,
+ typename P::template apply<S, Pos>
+ >
+ {};
+
+ typedef change_error_message type;
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/debug_parsing_error.hpp b/boost/metaparse/v1/debug_parsing_error.hpp
new file mode 100644
index 0000000000..ea44188838
--- /dev/null
+++ b/boost/metaparse/v1/debug_parsing_error.hpp
@@ -0,0 +1,105 @@
+#ifndef BOOST_METAPARSE_V1_DEBUG_PARSING_ERROR_HPP
+#define BOOST_METAPARSE_V1_DEBUG_PARSING_ERROR_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/fwd/build_parser.hpp>
+#include <boost/metaparse/v1/start.hpp>
+#include <boost/metaparse/v1/is_error.hpp>
+#include <boost/metaparse/v1/get_remaining.hpp>
+
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/string.hpp>
+
+#include <iostream>
+#include <cstdlib>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class S>
+ class debug_parsing_error
+ {
+ public:
+ debug_parsing_error()
+ {
+ using std::cout;
+ using std::endl;
+ using boost::mpl::c_str;
+
+ typedef display<typename P::template apply<S, start>::type> runner;
+
+ cout << "Compile-time parsing results" << endl;
+ cout << "----------------------------" << endl;
+ cout << "Input text:" << endl;
+ cout << c_str<S>::type::value << endl;
+ cout << endl;
+ runner::run();
+
+ std::exit(0);
+ }
+
+ typedef debug_parsing_error type;
+ private:
+ template <class Result>
+ struct display_error
+ {
+ static void run()
+ {
+ typedef typename Result::type R;
+
+ std::cout
+ << "Parsing failed:" << std::endl
+ << "line " << get_line<typename R::source_position>::type::value
+ << ", col " << get_col<typename R::source_position>::type::value
+ << ": "
+ << R::message::type::get_value() << std::endl;
+ }
+ };
+
+ template <class Result>
+ struct display_no_error
+ {
+ static void run()
+ {
+ using std::cout;
+ using std::endl;
+ using boost::mpl::c_str;
+
+ typedef typename get_remaining<Result>::type remaining_string;
+
+ cout
+ << "Parsing was successful. Remaining string is:" << endl
+ << c_str<remaining_string>::type::value << endl;
+ }
+ };
+
+ template <class Result>
+ struct display :
+ boost::mpl::if_<
+ typename is_error<Result>::type,
+ display_error<Result>,
+ display_no_error<Result>
+ >::type
+ {};
+ };
+
+ // Special case to handle when DebugParsingError is used with build_parser
+ // (it shouldn't be)
+ template <class P, class S>
+ class debug_parsing_error<build_parser<P>, S> :
+ debug_parsing_error<P, S>
+ {};
+ }
+ }
+}
+
+#endif
+
+
diff --git a/boost/metaparse/v1/define_error.hpp b/boost/metaparse/v1/define_error.hpp
new file mode 100644
index 0000000000..15a7c671b7
--- /dev/null
+++ b/boost/metaparse/v1/define_error.hpp
@@ -0,0 +1,25 @@
+#ifndef BOOST_METAPARSE_V1_DEFINE_ERROR_HPP
+#define BOOST_METAPARSE_V1_DEFINE_ERROR_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <string>
+
+#ifdef BOOST_METAPARSE_V1_DEFINE_ERROR
+# error BOOST_METAPARSE_V1_DEFINE_ERROR already defined
+#endif
+#define BOOST_METAPARSE_V1_DEFINE_ERROR(name, msg) \
+ struct name \
+ { \
+ typedef name type; \
+ static std::string get_value() \
+ { \
+ return msg; \
+ } \
+ }
+
+#endif
+
diff --git a/boost/metaparse/v1/digit.hpp b/boost/metaparse/v1/digit.hpp
new file mode 100644
index 0000000000..a2e3da9df4
--- /dev/null
+++ b/boost/metaparse/v1/digit.hpp
@@ -0,0 +1,34 @@
+#ifndef BOOST_METAPARSE_V1_DIGIT_HPP
+#define BOOST_METAPARSE_V1_DIGIT_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/error/digit_expected.hpp>
+#include <boost/metaparse/v1/accept_when.hpp>
+#include <boost/metaparse/v1/one_char.hpp>
+#include <boost/metaparse/v1/change_error_message.hpp>
+
+#include <boost/metaparse/v1/util/is_digit.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ typedef
+ accept_when<
+ change_error_message<one_char, error::digit_expected>,
+ util::is_digit<>,
+ error::digit_expected
+ >
+ digit;
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/digit_val.hpp b/boost/metaparse/v1/digit_val.hpp
new file mode 100644
index 0000000000..1f2faae6a8
--- /dev/null
+++ b/boost/metaparse/v1/digit_val.hpp
@@ -0,0 +1,26 @@
+#ifndef BOOST_METAPARSE_V1_DIGIT_VAL_HPP
+#define BOOST_METAPARSE_V1_DIGIT_VAL_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/digit.hpp>
+#include <boost/metaparse/v1/transform.hpp>
+
+#include <boost/metaparse/v1/util/digit_to_int.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ typedef transform<digit, util::digit_to_int<> > digit_val;
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/empty.hpp b/boost/metaparse/v1/empty.hpp
new file mode 100644
index 0000000000..7ffe604699
--- /dev/null
+++ b/boost/metaparse/v1/empty.hpp
@@ -0,0 +1,42 @@
+#ifndef BOOST_METAPARSE_V1_EMPTY_HPP
+#define BOOST_METAPARSE_V1_EMPTY_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2010 - 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/error/end_of_input_expected.hpp>
+#include <boost/metaparse/v1/reject.hpp>
+#include <boost/metaparse/v1/accept.hpp>
+#include <boost/metaparse/v1/define_error.hpp>
+
+#include <boost/mpl/empty.hpp>
+#include <boost/mpl/if.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class Result>
+ struct empty
+ {
+ typedef empty type;
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::if_<
+ boost::mpl::empty<S>,
+ accept<Result, S, Pos>,
+ reject<error::end_of_input_expected, Pos>
+ >
+ {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/entire_input.hpp b/boost/metaparse/v1/entire_input.hpp
new file mode 100644
index 0000000000..b7ab885137
--- /dev/null
+++ b/boost/metaparse/v1/entire_input.hpp
@@ -0,0 +1,33 @@
+#ifndef BOOST_METAPARSE_V1_ENTIRE_INPUT_HPP
+#define BOOST_METAPARSE_V1_ENTIRE_INPUT_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/first_of.hpp>
+#include <boost/metaparse/v1/empty.hpp>
+#include <boost/metaparse/v1/change_error_message.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class Msg = error::end_of_input_expected>
+ struct entire_input :
+ first_of<P, change_error_message<empty<void>, Msg> >
+ {};
+
+ template <class P>
+ struct entire_input<P, error::end_of_input_expected> :
+ first_of<P, empty<void> >
+ {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/error/digit_expected.hpp b/boost/metaparse/v1/error/digit_expected.hpp
new file mode 100644
index 0000000000..77c20d3750
--- /dev/null
+++ b/boost/metaparse/v1/error/digit_expected.hpp
@@ -0,0 +1,26 @@
+#ifndef BOOST_METAPARSE_V1_ERROR_DIGIT_EXPECTED_HPP
+#define BOOST_METAPARSE_V1_ERROR_DIGIT_EXPECTED_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/define_error.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace error
+ {
+ BOOST_METAPARSE_V1_DEFINE_ERROR(digit_expected, "Digit expected");
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/error/end_of_input_expected.hpp b/boost/metaparse/v1/error/end_of_input_expected.hpp
new file mode 100644
index 0000000000..01008c7b0e
--- /dev/null
+++ b/boost/metaparse/v1/error/end_of_input_expected.hpp
@@ -0,0 +1,29 @@
+#ifndef BOOST_METAPARSE_V1_END_OF_INPUT_EXPECTED_HPP
+#define BOOST_METAPARSE_V1_END_OF_INPUT_EXPECTED_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/define_error.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace error
+ {
+ BOOST_METAPARSE_V1_DEFINE_ERROR(
+ end_of_input_expected,
+ "End of input expected"
+ );
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/error/expected_to_fail.hpp b/boost/metaparse/v1/error/expected_to_fail.hpp
new file mode 100644
index 0000000000..ecd518ec35
--- /dev/null
+++ b/boost/metaparse/v1/error/expected_to_fail.hpp
@@ -0,0 +1,30 @@
+#ifndef BOOST_METAPARSE_V1_ERROR_EXPECTED_TO_FAIL_HPP
+#define BOOST_METAPARSE_V1_ERROR_EXPECTED_TO_FAIL_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/define_error.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace error
+ {
+ BOOST_METAPARSE_V1_DEFINE_ERROR(
+ expected_to_fail,
+ "Parser expected to fail"
+ );
+ }
+ }
+ }
+}
+
+#endif
+
+
diff --git a/boost/metaparse/v1/error/index_out_of_range.hpp b/boost/metaparse/v1/error/index_out_of_range.hpp
new file mode 100644
index 0000000000..de87968128
--- /dev/null
+++ b/boost/metaparse/v1/error/index_out_of_range.hpp
@@ -0,0 +1,41 @@
+#ifndef BOOST_METAPARSE_V1_ERROR_INDEX_OUT_OF_RANGE_HPP
+#define BOOST_METAPARSE_V1_ERROR_INDEX_OUT_OF_RANGE_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <iostream>
+#include <string>
+#include <sstream>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace error
+ {
+ template <int From, int To, int N>
+ struct index_out_of_range
+ {
+ typedef index_out_of_range type;
+
+ static std::string get_value()
+ {
+ std::ostringstream s;
+ s
+ << "index (" << N << ") out of range ["
+ << From << "-" << To << "]";
+ return s.str();
+ }
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/error/letter_expected.hpp b/boost/metaparse/v1/error/letter_expected.hpp
new file mode 100644
index 0000000000..80858c00e7
--- /dev/null
+++ b/boost/metaparse/v1/error/letter_expected.hpp
@@ -0,0 +1,26 @@
+#ifndef BOOST_METAPARSE_V1_ERROR_LETTER_EXPECTED_HPP
+#define BOOST_METAPARSE_V1_ERROR_LETTER_EXPECTED_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/define_error.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace error
+ {
+ BOOST_METAPARSE_V1_DEFINE_ERROR(letter_expected, "Letter expected");
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/error/literal_expected.hpp b/boost/metaparse/v1/error/literal_expected.hpp
new file mode 100644
index 0000000000..2e1bdf8437
--- /dev/null
+++ b/boost/metaparse/v1/error/literal_expected.hpp
@@ -0,0 +1,36 @@
+#ifndef BOOST_METAPARSE_V1_ERROR_LITERAL_EXPECTED_HPP
+#define BOOST_METAPARSE_V1_ERROR_LITERAL_EXPECTED_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <string>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace error
+ {
+ template <char C>
+ struct literal_expected
+ {
+ typedef literal_expected type;
+
+ static std::string get_value()
+ {
+ return std::string("Expected: ") + C;
+ }
+ };
+ }
+ }
+ }
+}
+
+#endif
+
+
diff --git a/boost/metaparse/v1/error/none_of_the_expected_cases_found.hpp b/boost/metaparse/v1/error/none_of_the_expected_cases_found.hpp
new file mode 100644
index 0000000000..38ddea3f37
--- /dev/null
+++ b/boost/metaparse/v1/error/none_of_the_expected_cases_found.hpp
@@ -0,0 +1,29 @@
+#ifndef BOOST_METAPARSE_V1_ERROR_NONE_OF_THE_EXPECTED_CASES_FOUND_HPP
+#define BOOST_METAPARSE_V1_ERROR_NONE_OF_THE_EXPECTED_CASES_FOUND_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/define_error.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace error
+ {
+ BOOST_METAPARSE_V1_DEFINE_ERROR(
+ none_of_the_expected_cases_found,
+ "None of the expected cases found"
+ );
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/error/unexpected_character.hpp b/boost/metaparse/v1/error/unexpected_character.hpp
new file mode 100644
index 0000000000..040f120158
--- /dev/null
+++ b/boost/metaparse/v1/error/unexpected_character.hpp
@@ -0,0 +1,29 @@
+#ifndef BOOST_METAPARSE_V1_ERROR_UNEXPECTED_CHARACTER_HPP
+#define BOOST_METAPARSE_V1_ERROR_UNEXPECTED_CHARACTER_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/define_error.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace error
+ {
+ BOOST_METAPARSE_V1_DEFINE_ERROR(
+ unexpected_character,
+ "Unexpected character"
+ );
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/error/unexpected_end_of_input.hpp b/boost/metaparse/v1/error/unexpected_end_of_input.hpp
new file mode 100644
index 0000000000..c89933202a
--- /dev/null
+++ b/boost/metaparse/v1/error/unexpected_end_of_input.hpp
@@ -0,0 +1,30 @@
+#ifndef BOOST_METAPARSE_V1_ERROR_UNEXPECTED_END_OF_INPUT_HPP
+#define BOOST_METAPARSE_V1_ERROR_UNEXPECTED_END_OF_INPUT_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/define_error.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace error
+ {
+ BOOST_METAPARSE_V1_DEFINE_ERROR(
+ unexpected_end_of_input,
+ "Unexpected end of input"
+ );
+ }
+ }
+ }
+}
+
+#endif
+
+
diff --git a/boost/metaparse/v1/error/unpaired.hpp b/boost/metaparse/v1/error/unpaired.hpp
new file mode 100644
index 0000000000..71e8561b1c
--- /dev/null
+++ b/boost/metaparse/v1/error/unpaired.hpp
@@ -0,0 +1,50 @@
+#ifndef BOOST_METAPARSE_V1_ERROR_UNPAIRED_HPP
+#define BOOST_METAPARSE_V1_ERROR_UNPAIRED_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/mpl/vector.hpp>
+
+#include <iostream>
+#include <string>
+#include <sstream>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace error
+ {
+ template <int Line, int Col, class Msg = boost::mpl::na>
+ struct unpaired
+ {
+ typedef unpaired type;
+
+ static std::string get_value()
+ {
+ std::ostringstream s;
+ s << Msg::get_value() << " (see " << Line << ":" << Col << ")";
+ return s.str();
+ }
+ };
+
+ template <int Line, int Col>
+ struct unpaired<Line, Col, boost::mpl::na>
+ {
+ typedef unpaired type;
+
+ template <class Msg = boost::mpl::na>
+ struct apply : unpaired<Line, Col, Msg> {};
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/error/whitespace_expected.hpp b/boost/metaparse/v1/error/whitespace_expected.hpp
new file mode 100644
index 0000000000..a4a4feed04
--- /dev/null
+++ b/boost/metaparse/v1/error/whitespace_expected.hpp
@@ -0,0 +1,30 @@
+#ifndef BOOST_METAPARSE_V1_ERROR_WHITESPACE_EXPECTED_HPP
+#define BOOST_METAPARSE_V1_ERROR_WHITESPACE_EXPECTED_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/define_error.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace error
+ {
+ BOOST_METAPARSE_V1_DEFINE_ERROR(
+ whitespace_expected,
+ "Whitespace expected"
+ );
+ }
+ }
+ }
+}
+
+#endif
+
+
diff --git a/boost/metaparse/v1/except.hpp b/boost/metaparse/v1/except.hpp
new file mode 100644
index 0000000000..52fb151d5d
--- /dev/null
+++ b/boost/metaparse/v1/except.hpp
@@ -0,0 +1,40 @@
+#ifndef BOOST_METAPARSE_V1_EXCEPT_HPP
+#define BOOST_METAPARSE_V1_EXCEPT_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/is_error.hpp>
+#include <boost/metaparse/v1/accept.hpp>
+#include <boost/metaparse/v1/reject.hpp>
+
+#include <boost/mpl/if.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class Result, class ErrorMsg>
+ struct except
+ {
+ typedef except type;
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::if_<
+ is_error<typename P::template apply<S, Pos> >,
+ accept<Result, S, Pos>,
+ reject<ErrorMsg, Pos>
+ >
+ {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/fail.hpp b/boost/metaparse/v1/fail.hpp
new file mode 100644
index 0000000000..b8f802698c
--- /dev/null
+++ b/boost/metaparse/v1/fail.hpp
@@ -0,0 +1,30 @@
+#ifndef BOOST_METAPARSE_V1_FAIL_HPP
+#define BOOST_METAPARSE_V1_FAIL_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/reject.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class Msg>
+ struct fail
+ {
+ typedef fail type;
+
+ template <class S, class Pos>
+ struct apply : reject<Msg, Pos> {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/fail_at_first_char_expected.hpp b/boost/metaparse/v1/fail_at_first_char_expected.hpp
new file mode 100644
index 0000000000..ff7046a831
--- /dev/null
+++ b/boost/metaparse/v1/fail_at_first_char_expected.hpp
@@ -0,0 +1,58 @@
+#ifndef BOOST_METAPARSE_V1_FAIL_AT_FIRST_CHAR_EXPECTED_HPP
+#define BOOST_METAPARSE_V1_FAIL_AT_FIRST_CHAR_EXPECTED_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/impl/void_.hpp>
+#include <boost/metaparse/v1/accept.hpp>
+#include <boost/metaparse/v1/reject.hpp>
+#include <boost/metaparse/v1/is_error.hpp>
+#include <boost/metaparse/v1/get_position.hpp>
+
+#include <boost/metaparse/v1/error/expected_to_fail.hpp>
+
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/equal_to.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P>
+ struct fail_at_first_char_expected
+ {
+ private:
+ template <class S, class Pos>
+ struct apply_err :
+ boost::mpl::eval_if<
+ typename boost::mpl::equal_to<
+ Pos,
+ typename get_position<typename P::template apply<S, Pos> >::type
+ >::type,
+ accept<impl::void_, S, Pos>,
+ typename P::template apply<S, Pos>
+ >
+ {};
+ public:
+ typedef fail_at_first_char_expected type;
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::eval_if<
+ typename is_error<typename P::template apply<S, Pos> >::type,
+ apply_err<S, Pos>,
+ reject<error::expected_to_fail, Pos>
+ >
+ {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/fail_tag.hpp b/boost/metaparse/v1/fail_tag.hpp
new file mode 100644
index 0000000000..3a0c0c17d9
--- /dev/null
+++ b/boost/metaparse/v1/fail_tag.hpp
@@ -0,0 +1,42 @@
+#ifndef BOOST_METAPARSE_V1_FAIL_TAG_HPP
+#define BOOST_METAPARSE_V1_FAIL_TAG_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2012.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#include <boost/metaparse/v1/fwd/get_message.hpp>
+#include <boost/metaparse/v1/fwd/get_position.hpp>
+
+#include <iostream>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ struct fail_tag { typedef fail_tag type; };
+
+ template <>
+ struct get_message_impl<fail_tag>
+ {
+ template <class A>
+ struct apply { typedef typename A::message type; };
+ };
+
+ template <>
+ struct get_position_impl<fail_tag>
+ {
+ template <class A>
+ struct apply : A::source_position {};
+ };
+ }
+ }
+}
+
+#endif
+
+
diff --git a/boost/metaparse/v1/first_of.hpp b/boost/metaparse/v1/first_of.hpp
new file mode 100644
index 0000000000..1456dda459
--- /dev/null
+++ b/boost/metaparse/v1/first_of.hpp
@@ -0,0 +1,35 @@
+#ifndef BOOST_METAPARSE_V1_FIRST_OF_HPP
+#define BOOST_METAPARSE_V1_FIRST_OF_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/nth_of.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+ BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
+ class P,
+ boost::mpl::na
+ )
+ >
+ struct first_of :
+ nth_of_c<
+ 0,
+ BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE, P)
+ >
+ {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/foldl.hpp b/boost/metaparse/v1/foldl.hpp
new file mode 100644
index 0000000000..b3938ee6ff
--- /dev/null
+++ b/boost/metaparse/v1/foldl.hpp
@@ -0,0 +1,65 @@
+#ifndef BOOST_METAPARSE_V1_FOLDL_HPP
+#define BOOST_METAPARSE_V1_FOLDL_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/accept.hpp>
+#include <boost/metaparse/v1/is_error.hpp>
+#include <boost/metaparse/v1/get_position.hpp>
+#include <boost/metaparse/v1/get_result.hpp>
+#include <boost/metaparse/v1/get_remaining.hpp>
+
+#include <boost/mpl/eval_if.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class State, class ForwardOp>
+ struct foldl
+ {
+ private:
+ template <class Res>
+ struct apply_unchecked :
+ // foldl never returns error
+ // I need to use apply_wrap, and not apply, because apply would
+ // build a metafunction class from foldl<P, State, ForwardOp>
+ // when ForwardOp is a lambda expression.
+ foldl<
+ P,
+ typename ForwardOp::template apply<
+ typename State::type,
+ typename get_result<Res>::type
+ >,
+ ForwardOp
+ >::template apply<
+ typename get_remaining<Res>::type,
+ typename get_position<Res>::type
+ >
+ {};
+
+ template <class S, class Pos>
+ struct next_iteration : accept<typename State::type, S, Pos> {};
+ public:
+ typedef foldl type;
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::eval_if<
+ typename is_error<typename P::template apply<S, Pos> >::type,
+ next_iteration<S, Pos>,
+ apply_unchecked<typename P::template apply<S, Pos> >
+ >
+ {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/foldl1.hpp b/boost/metaparse/v1/foldl1.hpp
new file mode 100644
index 0000000000..8b48f01c9a
--- /dev/null
+++ b/boost/metaparse/v1/foldl1.hpp
@@ -0,0 +1,38 @@
+#ifndef BOOST_METAPARSE_V1_FOLDL1_HPP
+#define BOOST_METAPARSE_V1_FOLDL1_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/foldl.hpp>
+
+#include <boost/mpl/if.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class State, class ForwardOp>
+ struct foldl1
+ {
+ typedef foldl1 type;
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::if_<
+ is_error<typename P::template apply<S, Pos> >,
+ P,
+ foldl<P, State, ForwardOp>
+ >::type::template apply<S, Pos>
+ {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/foldl_reject_incomplete.hpp b/boost/metaparse/v1/foldl_reject_incomplete.hpp
new file mode 100644
index 0000000000..82e08a7ae6
--- /dev/null
+++ b/boost/metaparse/v1/foldl_reject_incomplete.hpp
@@ -0,0 +1,77 @@
+#ifndef BOOST_METAPARSE_V1_FOLDL_REJECT_INCOMPLETE_HPP
+#define BOOST_METAPARSE_V1_FOLDL_REJECT_INCOMPLETE_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/fail_at_first_char_expected.hpp>
+#include <boost/metaparse/v1/is_error.hpp>
+#include <boost/metaparse/v1/get_position.hpp>
+#include <boost/metaparse/v1/get_result.hpp>
+#include <boost/metaparse/v1/get_remaining.hpp>
+
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/equal_to.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class State, class ForwardOp>
+ struct foldl_reject_incomplete
+ {
+ private:
+ template <class Res>
+ struct apply_unchecked :
+ // I need to use apply_wrap, and not apply, because apply would
+ // build a metafunction class from foldl<P, State, ForwardOp>
+ // when ForwardOp is a lambda expression.
+ foldl_reject_incomplete<
+ P,
+ typename ForwardOp::template apply<
+ typename State::type,
+ typename get_result<Res>::type
+ >,
+ ForwardOp
+ >::template apply<
+ typename get_remaining<Res>::type,
+ typename get_position<Res>::type
+ >
+ {};
+
+ template <class S, class Pos>
+ struct accept_state : accept<typename State::type, S, Pos> {};
+
+ template <class S, class Pos>
+ struct end_of_folding :
+ boost::mpl::eval_if<
+ typename boost::mpl::equal_to<
+ typename Pos::type,
+ typename get_position<typename P::template apply<S, Pos> >::type
+ >::type,
+ accept_state<S, Pos>,
+ typename P::template apply<S, Pos>
+ >
+ {};
+ public:
+ typedef foldl_reject_incomplete type;
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::eval_if<
+ typename is_error<typename P::template apply<S, Pos> >::type,
+ end_of_folding<S, Pos>,
+ apply_unchecked<typename P::template apply<S, Pos> >
+ >
+ {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/foldl_reject_incomplete1.hpp b/boost/metaparse/v1/foldl_reject_incomplete1.hpp
new file mode 100644
index 0000000000..f1382cfdf9
--- /dev/null
+++ b/boost/metaparse/v1/foldl_reject_incomplete1.hpp
@@ -0,0 +1,38 @@
+#ifndef BOOST_METAPARSE_V1_FOLDL_REJECT_INCOMPLETE1_HPP
+#define BOOST_METAPARSE_V1_FOLDL_REJECT_INCOMPLETE1_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/foldl_reject_incomplete.hpp>
+
+#include <boost/mpl/if.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class State, class ForwardOp>
+ struct foldl_reject_incomplete1
+ {
+ typedef foldl_reject_incomplete1 type;
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::if_<
+ is_error<typename P::template apply<S, Pos> >,
+ P,
+ foldl_reject_incomplete<P, State, ForwardOp>
+ >::type::template apply<S, Pos>
+ {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/foldl_reject_incomplete_start_with_parser.hpp b/boost/metaparse/v1/foldl_reject_incomplete_start_with_parser.hpp
new file mode 100644
index 0000000000..b9345af872
--- /dev/null
+++ b/boost/metaparse/v1/foldl_reject_incomplete_start_with_parser.hpp
@@ -0,0 +1,55 @@
+#ifndef BOOST_METAPARSE_V1_FOLDL_REJECT_INCOMPLETE_START_WITH_PARSER_HPP
+#define BOOST_METAPARSE_V1_FOLDL_REJECT_INCOMPLETE_START_WITH_PARSER_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/foldl_reject_incomplete.hpp>
+#include <boost/metaparse/v1/get_remaining.hpp>
+#include <boost/metaparse/v1/get_position.hpp>
+#include <boost/metaparse/v1/get_result.hpp>
+#include <boost/metaparse/v1/is_error.hpp>
+
+#include <boost/mpl/eval_if.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class StateP, class ForwardOp>
+ class foldl_reject_incomplete_start_with_parser
+ {
+ private:
+ template <class Res>
+ struct apply_unchecked :
+ foldl_reject_incomplete<
+ P,
+ typename get_result<Res>::type,
+ ForwardOp
+ >::template apply<
+ typename get_remaining<Res>::type,
+ typename get_position<Res>::type
+ >
+ {};
+ public:
+ typedef foldl_reject_incomplete_start_with_parser type;
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::eval_if<
+ typename is_error<typename StateP::template apply<S, Pos> >::type,
+ typename StateP::template apply<S, Pos>,
+ apply_unchecked<typename StateP::template apply<S, Pos> >
+ >
+ {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/foldl_start_with_parser.hpp b/boost/metaparse/v1/foldl_start_with_parser.hpp
new file mode 100644
index 0000000000..4112f13955
--- /dev/null
+++ b/boost/metaparse/v1/foldl_start_with_parser.hpp
@@ -0,0 +1,45 @@
+#ifndef BOOST_METAPARSE_V1_FOLDL_START_WITH_PARSER_HPP
+#define BOOST_METAPARSE_V1_FOLDL_START_WITH_PARSER_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2012.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/foldl.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class StateP, class ForwardOp>
+ class foldl_start_with_parser
+ {
+ private:
+ template <class Res>
+ struct apply_unchecked :
+ foldl<P, typename get_result<Res>::type, ForwardOp>::template apply<
+ typename get_remaining<Res>::type,
+ typename get_position<Res>::type
+ >
+ {};
+ public:
+ typedef foldl_start_with_parser type;
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::eval_if<
+ typename is_error<typename StateP::template apply<S, Pos> >::type,
+ typename StateP::template apply<S, Pos>,
+ apply_unchecked<typename StateP::template apply<S, Pos> >
+ >
+ {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/foldr.hpp b/boost/metaparse/v1/foldr.hpp
new file mode 100644
index 0000000000..333f67b51d
--- /dev/null
+++ b/boost/metaparse/v1/foldr.hpp
@@ -0,0 +1,25 @@
+#ifndef BOOST_METAPARSE_V1_FOLDR_HPP
+#define BOOST_METAPARSE_V1_FOLDR_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011 - 2012.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/return_.hpp>
+#include <boost/metaparse/v1/foldr_start_with_parser.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class State, class BackwardOp>
+ struct foldr : foldr_start_with_parser<P, return_<State>, BackwardOp> {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/foldr1.hpp b/boost/metaparse/v1/foldr1.hpp
new file mode 100644
index 0000000000..1746d26630
--- /dev/null
+++ b/boost/metaparse/v1/foldr1.hpp
@@ -0,0 +1,38 @@
+#ifndef BOOST_METAPARSE_V1_FOLDR1_HPP
+#define BOOST_METAPARSE_V1_FOLDR1_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/foldr.hpp>
+
+#include <boost/mpl/if.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class State, class BackwardOp>
+ struct foldr1
+ {
+ typedef foldr1 type;
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::if_<
+ is_error<typename P::template apply<S, Pos> >,
+ P,
+ foldr<P, State, BackwardOp>
+ >::type::template apply<S, Pos>
+ {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/foldr_reject_incomplete.hpp b/boost/metaparse/v1/foldr_reject_incomplete.hpp
new file mode 100644
index 0000000000..1e1742aa64
--- /dev/null
+++ b/boost/metaparse/v1/foldr_reject_incomplete.hpp
@@ -0,0 +1,33 @@
+#ifndef BOOST_METAPARSE_V1_FOLDR_REJECT_INCOMPLETE_HPP
+#define BOOST_METAPARSE_V1_FOLDR_REJECT_INCOMPLETE_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/return_.hpp>
+#include <boost/metaparse/v1/foldr_start_with_parser.hpp>
+#include <boost/metaparse/v1/first_of.hpp>
+#include <boost/metaparse/v1/fail_at_first_char_expected.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class State, class BackwardOp>
+ struct foldr_reject_incomplete :
+ foldr_start_with_parser<
+ P,
+ first_of<return_<State>, fail_at_first_char_expected<P> >,
+ BackwardOp
+ >
+ {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/foldr_reject_incomplete1.hpp b/boost/metaparse/v1/foldr_reject_incomplete1.hpp
new file mode 100644
index 0000000000..270d4251e9
--- /dev/null
+++ b/boost/metaparse/v1/foldr_reject_incomplete1.hpp
@@ -0,0 +1,38 @@
+#ifndef BOOST_METAPARSE_V1_FOLDR_REJECT_INCOMPLETE1_HPP
+#define BOOST_METAPARSE_V1_FOLDR_REJECT_INCOMPLETE1_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/foldr_reject_incomplete.hpp>
+
+#include <boost/mpl/if.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class State, class BackwardOp>
+ struct foldr_reject_incomplete1
+ {
+ typedef foldr_reject_incomplete1 type;
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::if_<
+ is_error<typename P::template apply<S, Pos> >,
+ P,
+ foldr_reject_incomplete<P, State, BackwardOp>
+ >::type::template apply<S, Pos>
+ {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/foldr_start_with_parser.hpp b/boost/metaparse/v1/foldr_start_with_parser.hpp
new file mode 100644
index 0000000000..c5f59eacf4
--- /dev/null
+++ b/boost/metaparse/v1/foldr_start_with_parser.hpp
@@ -0,0 +1,78 @@
+#ifndef BOOST_METAPARSE_V1_FOLDR_START_WITH_PARSER_HPP
+#define BOOST_METAPARSE_V1_FOLDR_START_WITH_PARSER_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2012.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/accept.hpp>
+#include <boost/metaparse/v1/is_error.hpp>
+#include <boost/metaparse/v1/get_position.hpp>
+#include <boost/metaparse/v1/get_result.hpp>
+#include <boost/metaparse/v1/get_remaining.hpp>
+
+#include <boost/mpl/eval_if.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class StateP, class BackwardOp>
+ struct foldr_start_with_parser
+ {
+ private:
+ template <class Res, class Rem>
+ struct apply_unchecked1 :
+ accept<
+ typename BackwardOp::template apply<
+ typename get_result<Rem>::type,
+ typename get_result<Res>::type
+ >::type,
+ typename get_remaining<Rem>::type,
+ typename get_position<Rem>::type
+ >
+ {};
+
+ template <class Res>
+ struct apply_unchecked;
+ public:
+ typedef foldr_start_with_parser type;
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::eval_if<
+ typename is_error<typename P::template apply<S, Pos> >::type,
+ typename StateP::template apply<S, Pos>,
+ apply_unchecked<typename P::template apply<S, Pos> >
+ >
+ {};
+ private:
+ template <class Res>
+ struct apply_unchecked
+ {
+ private:
+ typedef
+ typename foldr_start_with_parser::template apply<
+ typename get_remaining<Res>::type,
+ typename get_position<Res>::type
+ >
+ parsed_remaining;
+ public:
+ typedef
+ typename boost::mpl::eval_if<
+ typename is_error<parsed_remaining>::type,
+ parsed_remaining,
+ apply_unchecked1<Res, parsed_remaining>
+ >::type
+ type;
+ };
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/fwd/accept.hpp b/boost/metaparse/v1/fwd/accept.hpp
new file mode 100644
index 0000000000..c59097eb01
--- /dev/null
+++ b/boost/metaparse/v1/fwd/accept.hpp
@@ -0,0 +1,22 @@
+#ifndef BOOST_METAPARSE_V1_FWD_ACCEPT_HPP
+#define BOOST_METAPARSE_V1_FWD_ACCEPT_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class Result, class Remaining, class Pos>
+ struct accept;
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/fwd/build_parser.hpp b/boost/metaparse/v1/fwd/build_parser.hpp
new file mode 100644
index 0000000000..848def8ec2
--- /dev/null
+++ b/boost/metaparse/v1/fwd/build_parser.hpp
@@ -0,0 +1,22 @@
+#ifndef BOOST_METAPARSE_V1_FWD_BUILD_PARSER_HPP
+#define BOOST_METAPARSE_V1_FWD_BUILD_PARSER_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P>
+ struct build_parser;
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/fwd/get_col.hpp b/boost/metaparse/v1/fwd/get_col.hpp
new file mode 100644
index 0000000000..fa9e2a6c35
--- /dev/null
+++ b/boost/metaparse/v1/fwd/get_col.hpp
@@ -0,0 +1,26 @@
+#ifndef BOOST_METAPARSE_V1_FWD_GET_COL_HPP
+#define BOOST_METAPARSE_V1_FWD_GET_COL_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class>
+ struct get_col;
+
+ template <class>
+ struct get_col_impl;
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/fwd/get_line.hpp b/boost/metaparse/v1/fwd/get_line.hpp
new file mode 100644
index 0000000000..0f53ae9d9d
--- /dev/null
+++ b/boost/metaparse/v1/fwd/get_line.hpp
@@ -0,0 +1,25 @@
+#ifndef BOOST_METAPARSE_V1_FWD_GET_LINE_HPP
+#define BOOST_METAPARSE_V1_FWD_GET_LINE_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class>
+ struct get_line_impl;
+
+ template <class>
+ struct get_line;
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/fwd/get_message.hpp b/boost/metaparse/v1/fwd/get_message.hpp
new file mode 100644
index 0000000000..383e17b122
--- /dev/null
+++ b/boost/metaparse/v1/fwd/get_message.hpp
@@ -0,0 +1,25 @@
+#ifndef BOOST_METAPARSE_V1_FWD_GET_MESSAGE_HPP
+#define BOOST_METAPARSE_V1_FWD_GET_MESSAGE_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class>
+ struct get_message_impl;
+
+ template <class>
+ struct get_message;
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/fwd/get_position.hpp b/boost/metaparse/v1/fwd/get_position.hpp
new file mode 100644
index 0000000000..9c0ceb00df
--- /dev/null
+++ b/boost/metaparse/v1/fwd/get_position.hpp
@@ -0,0 +1,25 @@
+#ifndef BOOST_METAPARSE_V1_FWD_GET_POSITION_HPP
+#define BOOST_METAPARSE_V1_FWD_GET_POSITION_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class>
+ struct get_position_impl;
+
+ template <class>
+ struct get_position;
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/fwd/get_prev_char.hpp b/boost/metaparse/v1/fwd/get_prev_char.hpp
new file mode 100644
index 0000000000..fd7fe2608a
--- /dev/null
+++ b/boost/metaparse/v1/fwd/get_prev_char.hpp
@@ -0,0 +1,25 @@
+#ifndef BOOST_METAPARSE_V1_FWD_GET_PREV_CHAR_HPP
+#define BOOST_METAPARSE_V1_FWD_GET_PREV_CHAR_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class>
+ struct get_prev_char_impl;
+
+ template <class>
+ struct get_prev_char;
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/fwd/get_remaining.hpp b/boost/metaparse/v1/fwd/get_remaining.hpp
new file mode 100644
index 0000000000..04d10f50c9
--- /dev/null
+++ b/boost/metaparse/v1/fwd/get_remaining.hpp
@@ -0,0 +1,25 @@
+#ifndef BOOST_METAPARSE_V1_FWD_GET_REMAINING_HPP
+#define BOOST_METAPARSE_V1_FWD_GET_REMAINING_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class>
+ struct get_remaining_impl;
+
+ template <class>
+ struct get_remaining;
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/fwd/get_result.hpp b/boost/metaparse/v1/fwd/get_result.hpp
new file mode 100644
index 0000000000..529d9cf921
--- /dev/null
+++ b/boost/metaparse/v1/fwd/get_result.hpp
@@ -0,0 +1,25 @@
+#ifndef BOOST_METAPARSE_V1_FWD_GET_RESULT_HPP
+#define BOOST_METAPARSE_V1_FWD_GET_RESULT_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class>
+ struct get_result_impl;
+
+ template <class>
+ struct get_result;
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/fwd/next_char.hpp b/boost/metaparse/v1/fwd/next_char.hpp
new file mode 100644
index 0000000000..a00cc27d54
--- /dev/null
+++ b/boost/metaparse/v1/fwd/next_char.hpp
@@ -0,0 +1,25 @@
+#ifndef BOOST_METAPARSE_V1_FWD_NEXT_CHAR_HPP
+#define BOOST_METAPARSE_V1_FWD_NEXT_CHAR_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P>
+ struct next_char_impl;
+
+ template <class P, class Ch>
+ struct next_char;
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/fwd/next_line.hpp b/boost/metaparse/v1/fwd/next_line.hpp
new file mode 100644
index 0000000000..5e79235d43
--- /dev/null
+++ b/boost/metaparse/v1/fwd/next_line.hpp
@@ -0,0 +1,25 @@
+#ifndef BOOST_METAPARSE_V1_FWD_NEXT_LINE_IMPL_HPP
+#define BOOST_METAPARSE_V1_FWD_NEXT_LINE_IMPL_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P>
+ struct next_line_impl;
+
+ template <class P, class Ch>
+ struct next_line;
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/fwd/reject.hpp b/boost/metaparse/v1/fwd/reject.hpp
new file mode 100644
index 0000000000..8e937b839b
--- /dev/null
+++ b/boost/metaparse/v1/fwd/reject.hpp
@@ -0,0 +1,22 @@
+#ifndef BOOST_METAPARSE_V1_FWD_REJECT_HPP
+#define BOOST_METAPARSE_V1_FWD_REJECT_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class Msg, class Pos>
+ struct reject;
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/fwd/source_position.hpp b/boost/metaparse/v1/fwd/source_position.hpp
new file mode 100644
index 0000000000..be79bcf2cc
--- /dev/null
+++ b/boost/metaparse/v1/fwd/source_position.hpp
@@ -0,0 +1,22 @@
+#ifndef BOOST_METAPARSE_V1_FWD_SOURCE_POSITION_HPP
+#define BOOST_METAPARSE_V1_FWD_SOURCE_POSITION_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class Line, class Col, class PrevChar>
+ struct source_position;
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/fwd/string.hpp b/boost/metaparse/v1/fwd/string.hpp
new file mode 100644
index 0000000000..b5ecbd21e4
--- /dev/null
+++ b/boost/metaparse/v1/fwd/string.hpp
@@ -0,0 +1,38 @@
+#ifndef BOOST_METAPARSE_V1_FWD_STRING_HPP
+#define BOOST_METAPARSE_V1_FWD_STRING_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/config.hpp>
+#include <boost/metaparse/limit_string_size.hpp>
+#include <boost/metaparse/v1/impl/no_char.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+#ifdef BOOST_METAPARSE_VARIADIC_STRING
+ template <char... Cs>
+ struct string;
+#else
+ template <
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+ BOOST_METAPARSE_LIMIT_STRING_SIZE,
+ int C,
+ BOOST_NO_CHAR
+ )
+ >
+ struct string;
+#endif
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/get_col.hpp b/boost/metaparse/v1/get_col.hpp
new file mode 100644
index 0000000000..cd857229c7
--- /dev/null
+++ b/boost/metaparse/v1/get_col.hpp
@@ -0,0 +1,29 @@
+#ifndef BOOST_METAPARSE_V1_GET_COL_HPP
+#define BOOST_METAPARSE_V1_GET_COL_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/fwd/get_col.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class>
+ struct get_col_impl;
+
+ template <class T>
+ struct get_col : get_col_impl<typename T::type::tag>::template apply<typename T::type>
+ {};
+
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/get_line.hpp b/boost/metaparse/v1/get_line.hpp
new file mode 100644
index 0000000000..53b351a2a9
--- /dev/null
+++ b/boost/metaparse/v1/get_line.hpp
@@ -0,0 +1,29 @@
+#ifndef BOOST_METAPARSE_V1_GET_LINE_HPP
+#define BOOST_METAPARSE_V1_GET_LINE_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/fwd/get_line.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class>
+ struct get_line_impl;
+
+ template <class T>
+ struct get_line : get_line_impl<typename T::type::tag>::template apply<typename T::type>
+ {};
+
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/get_message.hpp b/boost/metaparse/v1/get_message.hpp
new file mode 100644
index 0000000000..81eb7571eb
--- /dev/null
+++ b/boost/metaparse/v1/get_message.hpp
@@ -0,0 +1,29 @@
+#ifndef BOOST_METAPARSE_V1_GET_MESSAGE_HPP
+#define BOOST_METAPARSE_V1_GET_MESSAGE_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/fwd/get_message.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class>
+ struct get_message_impl;
+
+ template <class T>
+ struct get_message : get_message_impl<typename T::type::tag>::template apply<typename T::type>
+ {};
+
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/get_position.hpp b/boost/metaparse/v1/get_position.hpp
new file mode 100644
index 0000000000..fde338fe5b
--- /dev/null
+++ b/boost/metaparse/v1/get_position.hpp
@@ -0,0 +1,29 @@
+#ifndef BOOST_METAPARSE_V1_GET_POSITION_HPP
+#define BOOST_METAPARSE_V1_GET_POSITION_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/fwd/get_position.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class>
+ struct get_position_impl;
+
+ template <class T>
+ struct get_position : get_position_impl<typename T::type::tag>::template apply<typename T::type>
+ {};
+
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/get_prev_char.hpp b/boost/metaparse/v1/get_prev_char.hpp
new file mode 100644
index 0000000000..6c45d74ebf
--- /dev/null
+++ b/boost/metaparse/v1/get_prev_char.hpp
@@ -0,0 +1,29 @@
+#ifndef BOOST_METAPARSE_V1_GET_PREV_CHAR_HPP
+#define BOOST_METAPARSE_V1_GET_PREV_CHAR_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/fwd/get_prev_char.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class>
+ struct get_prev_char_impl;
+
+ template <class T>
+ struct get_prev_char : get_prev_char_impl<typename T::type::tag>::template apply<typename T::type>
+ {};
+
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/get_remaining.hpp b/boost/metaparse/v1/get_remaining.hpp
new file mode 100644
index 0000000000..7a7ac07e11
--- /dev/null
+++ b/boost/metaparse/v1/get_remaining.hpp
@@ -0,0 +1,29 @@
+#ifndef BOOST_METAPARSE_V1_GET_REMAINING_HPP
+#define BOOST_METAPARSE_V1_GET_REMAINING_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/fwd/get_remaining.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class>
+ struct get_remaining_impl;
+
+ template <class T>
+ struct get_remaining : get_remaining_impl<typename T::type::tag>::template apply<typename T::type>
+ {};
+
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/get_result.hpp b/boost/metaparse/v1/get_result.hpp
new file mode 100644
index 0000000000..3426ca544e
--- /dev/null
+++ b/boost/metaparse/v1/get_result.hpp
@@ -0,0 +1,29 @@
+#ifndef BOOST_METAPARSE_V1_GET_RESULT_HPP
+#define BOOST_METAPARSE_V1_GET_RESULT_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/fwd/get_result.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class>
+ struct get_result_impl;
+
+ template <class T>
+ struct get_result :
+ get_result_impl<typename T::type::tag>::template apply<typename T::type>
+ {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/grammar.hpp b/boost/metaparse/v1/grammar.hpp
new file mode 100644
index 0000000000..6f885345d5
--- /dev/null
+++ b/boost/metaparse/v1/grammar.hpp
@@ -0,0 +1,386 @@
+#ifndef BOOST_METAPARSE_V1_GRAMMAR_HPP
+#define BOOST_METAPARSE_V1_GRAMMAR_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2012.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/repeated.hpp>
+#include <boost/metaparse/v1/repeated1.hpp>
+#include <boost/metaparse/v1/sequence.hpp>
+#include <boost/metaparse/v1/one_of.hpp>
+#include <boost/metaparse/v1/transform.hpp>
+#include <boost/metaparse/v1/lit.hpp>
+#include <boost/metaparse/v1/lit_c.hpp>
+#include <boost/metaparse/v1/token.hpp>
+#include <boost/metaparse/v1/keyword.hpp>
+#include <boost/metaparse/v1/middle_of.hpp>
+#include <boost/metaparse/v1/last_of.hpp>
+#include <boost/metaparse/v1/always.hpp>
+#include <boost/metaparse/v1/one_char_except_c.hpp>
+#include <boost/metaparse/v1/foldr1.hpp>
+#include <boost/metaparse/v1/foldl_start_with_parser.hpp>
+#include <boost/metaparse/v1/alphanum.hpp>
+#include <boost/metaparse/v1/build_parser.hpp>
+#include <boost/metaparse/v1/entire_input.hpp>
+#include <boost/metaparse/v1/string.hpp>
+#include <boost/metaparse/v1/impl/front_inserter.hpp>
+
+#include <boost/mpl/at.hpp>
+#include <boost/mpl/map.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/has_key.hpp>
+#include <boost/mpl/lambda.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/back.hpp>
+#include <boost/mpl/pair.hpp>
+#include <boost/mpl/insert.hpp>
+
+/*
+ * The grammar
+ *
+ * rule_definition ::= name_token define_token expression
+ * expression ::= seq_expression (or_token seq_expression)*
+ * seq_expression ::= repeated_expression+
+ * repeated_expression ::= name_expression (repeated_token | repeated1_token)*
+ * name_expression ::= char_token | name_token | bracket_expression
+ * bracket_expression ::= open_bracket_token expression close_bracket_token
+ */
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace grammar_util
+ {
+ template <char Op, class FState>
+ struct repeated_apply_impl
+ {
+ typedef repeated_apply_impl type;
+
+ template <class G>
+ struct apply :
+ repeated<typename FState::template apply<G>::type>
+ {};
+ };
+
+ template <class FState>
+ struct repeated_apply_impl<'+', FState>
+ {
+ typedef repeated_apply_impl type;
+
+ template <class G>
+ struct apply :
+ repeated1<typename FState::template apply<G>::type>
+ {};
+ };
+
+ struct build_repeated
+ {
+ typedef build_repeated type;
+
+ template <class FState, class T>
+ struct apply : repeated_apply_impl<T::type::value, FState> {};
+ };
+
+ struct build_sequence
+ {
+ typedef build_sequence type;
+
+ template <class FState, class FP>
+ struct apply_impl
+ {
+ typedef apply_impl type;
+
+ template <class G>
+ struct apply :
+ sequence<
+ typename FState::template apply<G>::type,
+ typename FP::template apply<G>::type
+ >
+ {};
+ };
+
+ template <class FState, class FP>
+ struct apply : apply_impl<FState, FP> {};
+ };
+
+ struct build_selection
+ {
+ typedef build_selection type;
+
+ template <class FState, class FP>
+ struct apply_impl
+ {
+ typedef apply_impl type;
+
+ template <class G>
+ struct apply :
+ one_of<
+ typename FState::template apply<G>::type,
+ typename FP::template apply<G>::type
+ >
+ {};
+ };
+
+ template <class FState, class FP>
+ struct apply : apply_impl<FState, FP> {};
+ };
+
+ template <class G, class Name>
+ struct get_parser
+ {
+ typedef
+ typename boost::mpl::at<typename G::rules, Name>::type
+ ::template apply<G>
+ p;
+
+ template <class Actions>
+ struct impl : transform<typename p::type, typename Actions::type> {};
+
+ typedef
+ typename boost::mpl::eval_if<
+ typename boost::mpl::has_key<typename G::actions, Name>::type,
+ impl<boost::mpl::at<typename G::actions, Name> >,
+ p
+ >::type
+ type;
+ };
+
+ struct build_name
+ {
+ typedef build_name type;
+
+ template <class Name>
+ struct apply_impl
+ {
+ typedef apply_impl type;
+
+ template <class G>
+ struct apply : get_parser<G, Name> {};
+ };
+
+ template <class Name>
+ struct apply : apply_impl<Name> {};
+ };
+
+ struct build_char
+ {
+ typedef build_char type;
+
+ template <class C>
+ struct apply_impl
+ {
+ typedef apply_impl type;
+
+ template <class G>
+ struct apply : lit<C> {};
+ };
+
+ template <class C>
+ struct apply : apply_impl<C> {};
+ };
+
+ typedef token<lit_c<'*'> > repeated_token;
+ typedef token<lit_c<'+'> > repeated1_token;
+ typedef token<lit_c<'|'> > or_token;
+ typedef token<lit_c<'('> > open_bracket_token;
+ typedef token<lit_c<')'> > close_bracket_token;
+ typedef token<keyword<string<':',':','='> > > define_token;
+
+ typedef
+ middle_of<
+ lit_c<'\''>,
+ one_of<
+ last_of<
+ lit_c<'\\'>,
+ one_of<
+ always<lit_c<'n'>, boost::mpl::char_<'\n'> >,
+ always<lit_c<'r'>, boost::mpl::char_<'\r'> >,
+ always<lit_c<'t'>, boost::mpl::char_<'\t'> >,
+ lit_c<'\\'>,
+ lit_c<'\''>
+ >
+ >,
+ one_char_except_c<'\''>
+ >,
+ token<lit_c<'\''> >
+ >
+ char_token;
+
+ typedef
+ token<
+ foldr1<
+ one_of<alphanum, lit_c<'_'> >,
+ string<>,
+ impl::front_inserter
+ >
+ >
+ name_token;
+
+ struct expression;
+
+ typedef
+ middle_of<open_bracket_token, expression, close_bracket_token>
+ bracket_expression;
+
+ typedef
+ one_of<
+ transform<char_token, build_char>,
+ transform<name_token, build_name>,
+ bracket_expression
+ >
+ name_expression;
+
+ typedef
+ foldl_start_with_parser<
+ one_of<repeated_token, repeated1_token>,
+ name_expression,
+ build_repeated
+ >
+ repeated_expression;
+
+ typedef
+ foldl_start_with_parser<
+ repeated_expression,
+ repeated_expression,
+ build_sequence
+ >
+ seq_expression;
+
+ struct expression :
+ foldl_start_with_parser<
+ last_of<or_token, seq_expression>,
+ seq_expression,
+ build_selection
+ >
+ {};
+
+ typedef sequence<name_token, define_token, expression> rule_definition;
+
+ typedef build_parser<entire_input<rule_definition> > parser_parser;
+
+ template <class P>
+ struct build_native_parser
+ {
+ typedef build_native_parser type;
+
+ template <class G>
+ struct apply
+ {
+ typedef P type;
+ };
+ };
+
+ template <class S>
+ struct build_parsed_parser
+ {
+ typedef typename parser_parser::apply<S>::type p;
+ typedef typename boost::mpl::front<p>::type name;
+ typedef typename boost::mpl::back<p>::type exp;
+
+ struct the_parser
+ {
+ typedef the_parser type;
+
+ template <class G>
+ struct apply : exp::template apply<G> {};
+ };
+
+ typedef boost::mpl::pair<name, the_parser> type;
+ };
+
+ typedef build_parser<name_token> name_parser;
+
+ template <class S>
+ struct rebuild : name_parser::template apply<S> {};
+
+ struct no_action;
+
+ template <class G, class P, class F>
+ struct add_rule;
+
+ template <class G, class Name, class P>
+ struct add_import;
+
+ template <class Start, class Rules, class Actions>
+ struct grammar_builder
+ {
+ typedef grammar_builder type;
+ typedef Rules rules;
+ typedef Actions actions;
+
+ // Make it a parser
+ template <class S, class Pos>
+ struct apply :
+ get_parser<
+ grammar_builder,
+ typename rebuild<Start>::type
+ >::type::template apply<S, Pos>
+ {};
+
+ template <class Name, class P>
+ struct import :
+ add_import<grammar_builder, typename rebuild<Name>::type, P>
+ {};
+
+ template <class Def, class Action = no_action>
+ struct rule :
+ add_rule<grammar_builder, build_parsed_parser<Def>, Action>
+ {};
+ };
+
+ template <class Start, class Rules, class Actions, class P>
+ struct add_rule<grammar_builder<Start, Rules, Actions>, P, no_action> :
+ grammar_builder<
+ Start,
+ typename boost::mpl::insert<Rules, typename P::type>::type,
+ Actions
+ >
+ {};
+
+ template <class Start, class Rules, class Actions, class P, class F>
+ struct add_rule<grammar_builder<Start, Rules, Actions>, P, F> :
+ grammar_builder<
+ Start,
+ typename boost::mpl::insert<Rules, typename P::type>::type,
+ typename boost::mpl::insert<
+ Actions,
+ boost::mpl::pair<
+ typename P::name,
+ typename boost::mpl::lambda<F>::type
+ >
+ >
+ ::type
+ >
+ {};
+
+ template <class Start, class Rules, class Actions, class Name, class P>
+ struct add_import<grammar_builder<Start, Rules, Actions>, Name, P> :
+ grammar_builder<
+ Start,
+ typename boost::mpl::insert<
+ Rules,
+ boost::mpl::pair<Name, build_native_parser<P> >
+ >::type,
+ Actions
+ >
+ {};
+ }
+
+ template <class Start = string<'S'> >
+ struct grammar :
+ grammar_util::grammar_builder<
+ Start,
+ boost::mpl::map<>,
+ boost::mpl::map<>
+ >
+ {};
+ }
+ }
+}
+
+#endif
diff --git a/boost/metaparse/v1/if_.hpp b/boost/metaparse/v1/if_.hpp
new file mode 100644
index 0000000000..4c832d8197
--- /dev/null
+++ b/boost/metaparse/v1/if_.hpp
@@ -0,0 +1,43 @@
+#ifndef BOOST_METAPARSE_V1_IF__HPP
+#define BOOST_METAPARSE_V1_IF__HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/accept.hpp>
+#include <boost/metaparse/v1/is_error.hpp>
+
+#include <boost/mpl/if.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class T, class F>
+ struct if_
+ {
+ typedef if_ type;
+
+ template <class S, class Pos>
+ struct apply :
+ accept<
+ typename boost::mpl::if_<
+ is_error<typename P::template apply<S, Pos> >,
+ F,
+ T
+ >::type,
+ S,
+ Pos
+ >
+ {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/apply_parser.hpp b/boost/metaparse/v1/impl/apply_parser.hpp
new file mode 100644
index 0000000000..65d0f76107
--- /dev/null
+++ b/boost/metaparse/v1/impl/apply_parser.hpp
@@ -0,0 +1,63 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_APPLY_PARSER_HPP
+#define BOOST_METAPARSE_V1_IMPL_APPLY_PARSER_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/unless_error.hpp>
+#include <boost/metaparse/v1/get_result.hpp>
+#include <boost/metaparse/v1/get_remaining.hpp>
+#include <boost/metaparse/v1/get_position.hpp>
+#include <boost/metaparse/v1/transform.hpp>
+
+#include <boost/mpl/push_back.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ struct apply_parser
+ {
+ private:
+ template <class ListToAppend>
+ struct do_append
+ {
+ template <class Item>
+ struct apply : boost::mpl::push_back<ListToAppend, Item> {};
+ };
+
+ template <class Accum, class S, class Pos, class Parser>
+ struct apply_unchecked :
+ transform<Parser,do_append<typename Accum::type> >::template apply<
+ typename S::type,
+ typename Pos::type
+ >
+ {};
+
+ public:
+ template <class State, class Parser>
+ struct apply :
+ unless_error<
+ State,
+ apply_unchecked<
+ get_result<State>,
+ get_remaining<State>,
+ get_position<State>,
+ Parser
+ >
+ >
+ {};
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/assert_string_length.hpp b/boost/metaparse/v1/impl/assert_string_length.hpp
new file mode 100644
index 0000000000..5dad4d9f49
--- /dev/null
+++ b/boost/metaparse/v1/impl/assert_string_length.hpp
@@ -0,0 +1,31 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_ASSERT_STRING_LENGTH_HPP
+#define BOOST_METAPARSE_V1_IMPL_ASSERT_STRING_LENGTH_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/static_assert.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <int Len, class S>
+ struct assert_string_length : S
+ {
+ BOOST_STATIC_ASSERT((Len <= BOOST_METAPARSE_LIMIT_STRING_SIZE));
+ };
+ }
+ }
+ }
+}
+
+#endif
+
+
diff --git a/boost/metaparse/v1/impl/at_c.hpp b/boost/metaparse/v1/impl/at_c.hpp
new file mode 100644
index 0000000000..af7177410e
--- /dev/null
+++ b/boost/metaparse/v1/impl/at_c.hpp
@@ -0,0 +1,66 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_AT_C_HPP
+#define BOOST_METAPARSE_V1_IMPL_AT_C_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/config.hpp>
+#include <boost/metaparse/v1/fwd/string.hpp>
+
+#include <boost/mpl/char.hpp>
+
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <class S, int N>
+ struct at_c;
+
+#ifdef BOOST_METAPARSE_VARIADIC_STRING
+ template <char C, char... Cs, int N>
+ struct at_c<string<C, Cs...>, N> : at_c<string<Cs...>, N - 1> {};
+
+ template <char C, char... Cs>
+ struct at_c<string<C, Cs...>, 0> : boost::mpl::char_<C> {};
+#else
+ #ifdef BOOST_METAPARSE_STRING_CASE
+ # error BOOST_METAPARSE_STRING_CASE is already defined
+ #endif
+ #define BOOST_METAPARSE_STRING_CASE(z, n, unused) \
+ template < \
+ BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, int C) \
+ > \
+ struct \
+ at_c< \
+ string< \
+ BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, C) \
+ >, \
+ n \
+ > : \
+ boost::mpl::char_<BOOST_PP_CAT(C, n)> \
+ {};
+
+ BOOST_PP_REPEAT(
+ BOOST_METAPARSE_LIMIT_STRING_SIZE,
+ BOOST_METAPARSE_STRING_CASE,
+ ~
+ )
+
+ #undef BOOST_METAPARSE_STRING_CASE
+#endif
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/back_inserter.hpp b/boost/metaparse/v1/impl/back_inserter.hpp
new file mode 100644
index 0000000000..986b2d32da
--- /dev/null
+++ b/boost/metaparse/v1/impl/back_inserter.hpp
@@ -0,0 +1,32 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_BACK_INSERTER_HPP
+#define BOOST_METAPARSE_V1_IMPL_BACK_INSERTER_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/mpl/push_back.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ struct back_inserter
+ {
+ typedef back_inserter type;
+
+ template <class T0, class T1>
+ struct apply : boost::mpl::push_back<T0, T1> {};
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/concat.hpp b/boost/metaparse/v1/impl/concat.hpp
new file mode 100644
index 0000000000..d866ae42b1
--- /dev/null
+++ b/boost/metaparse/v1/impl/concat.hpp
@@ -0,0 +1,106 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_CONCAT_HPP
+#define BOOST_METAPARSE_V1_IMPL_CONCAT_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/config.hpp>
+#include <boost/metaparse/v1/fwd/string.hpp>
+
+#include <boost/preprocessor/arithmetic/dec.hpp>
+#include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/preprocessor/arithmetic/mul.hpp>
+#include <boost/preprocessor/arithmetic/sub.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/repetition/enum.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <class A, class B>
+ struct concat;
+
+#ifdef BOOST_METAPARSE_VARIADIC_STRING
+ template <char... As, char... Bs>
+ struct concat<string<As...>, string<Bs...>> : string<As..., Bs...> {};
+#else
+ template <class A, class B>
+ struct concat_impl;
+
+ #ifdef BOOST_METAPARSE_ARG
+ # error BOOST_METAPARSE_ARG already defined
+ #endif
+ #define BOOST_METAPARSE_ARG(z, n, unused) \
+ BOOST_PP_CAT(B, BOOST_PP_INC(n))
+
+ #ifdef BOOST_METAPARSE_CONCAT
+ # error BOOST_METAPARSE_CONCAT already defined
+ #endif
+ #define BOOST_METAPARSE_CONCAT(z, n, unused) \
+ template < \
+ BOOST_PP_ENUM_PARAMS(n, int A) BOOST_PP_COMMA_IF(n) \
+ BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, int B) \
+ > \
+ struct \
+ concat_impl< \
+ string< \
+ BOOST_PP_ENUM_PARAMS(n, A) \
+ BOOST_PP_COMMA_IF( \
+ BOOST_PP_MUL( \
+ BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_STRING_SIZE, n), \
+ n \
+ ) \
+ ) \
+ BOOST_PP_ENUM( \
+ BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_STRING_SIZE, n), \
+ BOOST_NO_CHAR BOOST_PP_TUPLE_EAT(3), \
+ ~ \
+ ) \
+ >, \
+ string< \
+ BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, B) \
+ > \
+ > : \
+ concat< \
+ string<BOOST_PP_ENUM_PARAMS(n, A) BOOST_PP_COMMA_IF(n) B0>, \
+ string< \
+ BOOST_PP_ENUM( \
+ BOOST_PP_DEC(BOOST_METAPARSE_LIMIT_STRING_SIZE), \
+ BOOST_METAPARSE_ARG, \
+ ~ \
+ ) \
+ > \
+ > \
+ {};
+
+ BOOST_PP_REPEAT(
+ BOOST_METAPARSE_LIMIT_STRING_SIZE,
+ BOOST_METAPARSE_CONCAT,
+ ~
+ )
+
+ #undef BOOST_METAPARSE_ARG
+ #undef BOOST_METAPARSE_CONCAT
+
+ template <class S>
+ struct concat<S, string<> > : S {};
+
+ template <class A, class B>
+ struct concat : concat_impl<A, B> {};
+#endif
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/empty_string.hpp b/boost/metaparse/v1/impl/empty_string.hpp
new file mode 100644
index 0000000000..7b62496450
--- /dev/null
+++ b/boost/metaparse/v1/impl/empty_string.hpp
@@ -0,0 +1,44 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_EMPTY_STRING_HPP
+#define BOOST_METAPARSE_V1_IMPL_EMPTY_STRING_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/config.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <class Ignore = int>
+ struct empty_string
+ {
+ typedef empty_string type;
+
+ #ifdef BOOST_NO_CONSTEXPR_C_STR
+ static const char value[1];
+ #else
+ static constexpr char value[1] = {0};
+ #endif
+ };
+
+ #ifdef BOOST_NO_CONSTEXPR_C_STR
+ template <class Ignore>
+ const char empty_string<Ignore>::value[1] = {0};
+ #else
+ template <class Ignore>
+ constexpr char empty_string<Ignore>::value[1];
+ #endif
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/front_inserter.hpp b/boost/metaparse/v1/impl/front_inserter.hpp
new file mode 100644
index 0000000000..620533bfbd
--- /dev/null
+++ b/boost/metaparse/v1/impl/front_inserter.hpp
@@ -0,0 +1,32 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_FRONT_INSERTER_HPP
+#define BOOST_METAPARSE_V1_IMPL_FRONT_INSERTER_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/mpl/push_front.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ struct front_inserter
+ {
+ typedef front_inserter type;
+
+ template <class T0, class T1>
+ struct apply : boost::mpl::push_front<T0, T1> {};
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/fwd/iterate_impl.hpp b/boost/metaparse/v1/impl/fwd/iterate_impl.hpp
new file mode 100644
index 0000000000..7773bf4ca1
--- /dev/null
+++ b/boost/metaparse/v1/impl/fwd/iterate_impl.hpp
@@ -0,0 +1,34 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_FWD_ITERATE_IMPL_HPP
+#define BOOST_METAPARSE_V1_IMPL_FWD_ITERATE_IMPL_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/is_error.hpp>
+#include <boost/metaparse/v1/get_result.hpp>
+#include <boost/metaparse/v1/get_remaining.hpp>
+#include <boost/metaparse/v1/get_position.hpp>
+
+#include <boost/mpl/deque.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/push_back.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <int N, class P, class Accum>
+ struct iterate_impl;
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/has_type.hpp b/boost/metaparse/v1/impl/has_type.hpp
new file mode 100644
index 0000000000..167ea600a3
--- /dev/null
+++ b/boost/metaparse/v1/impl/has_type.hpp
@@ -0,0 +1,26 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_HAS_TYPE_HPP
+#define BOOST_METAPARSE_V1_IMPL_HAS_TYPE_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/mpl/has_xxx.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(type)
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/is_any.hpp b/boost/metaparse/v1/impl/is_any.hpp
new file mode 100644
index 0000000000..23122b35ce
--- /dev/null
+++ b/boost/metaparse/v1/impl/is_any.hpp
@@ -0,0 +1,70 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_IS_ANY_HPP
+#define BOOST_METAPARSE_V1_IMPL_IS_ANY_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/limit_one_char_except_size.hpp>
+
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/bool.hpp>
+
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/arithmetic/dec.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <class Stub = int>
+ struct is_any0
+ {
+ template <class C>
+ struct apply : boost::mpl::true_ {};
+ };
+
+ #ifdef BOOST_METAPARSE_DEFINE_IS_ANY
+ # error BOOST_METAPARSE_DEFINE_IS_ANY already defined
+ #endif
+ #define BOOST_METAPARSE_DEFINE_IS_ANY(z, n, unused) \
+ template <BOOST_PP_ENUM_PARAMS(n, class T)> \
+ struct BOOST_PP_CAT(is_any, n) \
+ { \
+ template <class C> \
+ struct apply : \
+ boost::mpl::eval_if< \
+ boost::mpl::bool_< \
+ C::type::value \
+ == BOOST_PP_CAT(T, BOOST_PP_DEC(n))::type::value \
+ >, \
+ boost::mpl::false_, \
+ typename BOOST_PP_CAT(is_any, BOOST_PP_DEC(n))< \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(n), T) \
+ >::template apply<C> \
+ > \
+ {}; \
+ };
+
+ BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE,
+ BOOST_METAPARSE_DEFINE_IS_ANY,
+ ~
+ )
+
+ #undef BOOST_METAPARSE_DEFINE_IS_ANY
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/is_char_c.hpp b/boost/metaparse/v1/impl/is_char_c.hpp
new file mode 100644
index 0000000000..1ad298f848
--- /dev/null
+++ b/boost/metaparse/v1/impl/is_char_c.hpp
@@ -0,0 +1,33 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_IS_CHAR_C_HPP
+#define BOOST_METAPARSE_V1_IMPL_IS_CHAR_C_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/mpl/bool.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <char C>
+ struct is_char_c
+ {
+ typedef is_char_c type;
+
+ template <class Ch>
+ struct apply : boost::mpl::bool_<Ch::type::value == C> {};
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/iterate_impl.hpp b/boost/metaparse/v1/impl/iterate_impl.hpp
new file mode 100644
index 0000000000..f12be9edf6
--- /dev/null
+++ b/boost/metaparse/v1/impl/iterate_impl.hpp
@@ -0,0 +1,46 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_ITERATE_IMPL_HPP
+#define BOOST_METAPARSE_V1_IMPL_ITERATE_IMPL_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/impl/iterate_impl_unchecked.hpp>
+#include <boost/metaparse/v1/return_.hpp>
+#include <boost/metaparse/v1/is_error.hpp>
+
+#include <boost/mpl/eval_if.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <int N, class P, class Accum>
+ struct iterate_impl
+ {
+ typedef iterate_impl type;
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::eval_if<
+ typename is_error<typename P::template apply<S, Pos> >::type,
+ typename P::template apply<S, Pos>,
+ iterate_impl_unchecked<N, P, Accum, S, Pos>
+ >
+ {};
+ };
+
+ template <class P, class Accum>
+ struct iterate_impl<0, P, Accum> : return_<Accum> {};
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/iterate_impl_unchecked.hpp b/boost/metaparse/v1/impl/iterate_impl_unchecked.hpp
new file mode 100644
index 0000000000..535cd379d9
--- /dev/null
+++ b/boost/metaparse/v1/impl/iterate_impl_unchecked.hpp
@@ -0,0 +1,44 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_ITERATE_IMPL_UNCHECKED_HPP
+#define BOOST_METAPARSE_V1_IMPL_ITERATE_IMPL_UNCHECKED_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/impl/fwd/iterate_impl.hpp>
+#include <boost/metaparse/v1/get_result.hpp>
+#include <boost/metaparse/v1/get_remaining.hpp>
+#include <boost/metaparse/v1/get_position.hpp>
+
+#include <boost/mpl/push_back.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <int N, class P, class Accum, class S, class Pos>
+ struct iterate_impl_unchecked :
+ iterate_impl<
+ N - 1,
+ P,
+ typename boost::mpl::push_back<
+ Accum,
+ typename get_result<typename P::template apply<S, Pos> >::type
+ >::type
+ >::template apply<
+ typename get_remaining<typename P::template apply<S, Pos> >::type,
+ typename get_position<typename P::template apply<S, Pos> >::type
+ >
+ {};
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/later_result.hpp b/boost/metaparse/v1/impl/later_result.hpp
new file mode 100644
index 0000000000..69c2e5b89a
--- /dev/null
+++ b/boost/metaparse/v1/impl/later_result.hpp
@@ -0,0 +1,39 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_LATER_RESULT_HPP
+#define BOOST_METAPARSE_V1_IMPL_LATER_RESULT_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/get_position.hpp>
+
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/less.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <class R1, class R2>
+ struct later_result :
+ boost::mpl::if_<
+ typename boost::mpl::less<
+ typename get_position<R2>::type,
+ typename get_position<R1>::type
+ >::type,
+ R1,
+ R2
+ >
+ {};
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/next_digit.hpp b/boost/metaparse/v1/impl/next_digit.hpp
new file mode 100644
index 0000000000..959ea114c6
--- /dev/null
+++ b/boost/metaparse/v1/impl/next_digit.hpp
@@ -0,0 +1,36 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_NEXT_DIGIT_HPP
+#define BOOST_METAPARSE_V1_IMPL_NEXT_DIGIT_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/mpl/int.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ struct next_digit
+ {
+ typedef next_digit type;
+
+ template <class PartialResult, class NextDigit>
+ struct apply :
+ boost::mpl::int_<
+ PartialResult::type::value * 10 + NextDigit::type::value
+ >
+ {};
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/no_char.hpp b/boost/metaparse/v1/impl/no_char.hpp
new file mode 100644
index 0000000000..c6b91f07a6
--- /dev/null
+++ b/boost/metaparse/v1/impl/no_char.hpp
@@ -0,0 +1,17 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_NO_CHAR_HPP
+#define BOOST_METAPARSE_V1_IMPL_NO_CHAR_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <cstdio>
+
+#ifdef BOOST_NO_CHAR
+# error BOOST_NO_CHAR already defined
+#endif
+#define BOOST_NO_CHAR EOF
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/nth_of_c.hpp b/boost/metaparse/v1/impl/nth_of_c.hpp
new file mode 100644
index 0000000000..d12d164eaa
--- /dev/null
+++ b/boost/metaparse/v1/impl/nth_of_c.hpp
@@ -0,0 +1,61 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_NTH_OF_C_HPP
+#define BOOST_METAPARSE_V1_IMPL_NTH_OF_C_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/impl/nth_of_c_impl.hpp>
+#include <boost/metaparse/v1/error/index_out_of_range.hpp>
+#include <boost/metaparse/v1/fail.hpp>
+#include <boost/metaparse/limit_sequence_size.hpp>
+
+#include <boost/mpl/list.hpp>
+
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/cat.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ #ifdef BOOST_METAPARSE_NTH_OF_CASE
+ # error BOOST_METAPARSE_NTH_OF_CASE already defined
+ #endif
+ #define BOOST_METAPARSE_NTH_OF_CASE(z, n, unused) \
+ template < \
+ int K BOOST_PP_COMMA_IF(n) \
+ BOOST_PP_ENUM_PARAMS(n, class P) \
+ > \
+ struct BOOST_PP_CAT(nth_of_c, n) : \
+ boost::mpl::if_< \
+ boost::mpl::bool_<(0 <= K && K < n)>, \
+ nth_of_c_impl< \
+ K, \
+ boost::mpl::list<BOOST_PP_ENUM_PARAMS(n, P)> \
+ >, \
+ fail<error::index_out_of_range<0, n - 1, K> > \
+ >::type \
+ {};
+
+ BOOST_PP_REPEAT(
+ BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
+ BOOST_METAPARSE_NTH_OF_CASE,
+ ~
+ )
+
+ #undef BOOST_METAPARSE_NTH_OF_CASE
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/nth_of_c_impl.hpp b/boost/metaparse/v1/impl/nth_of_c_impl.hpp
new file mode 100644
index 0000000000..c74dcc0dae
--- /dev/null
+++ b/boost/metaparse/v1/impl/nth_of_c_impl.hpp
@@ -0,0 +1,77 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_NTH_OF_C_IMPL_HPP
+#define BOOST_METAPARSE_V1_IMPL_NTH_OF_C_IMPL_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/impl/skip_seq.hpp>
+
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/pop_front.hpp>
+#include <boost/mpl/fold.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <int N, class Seq>
+ struct nth_of_c_impl
+ {
+ private:
+ template <class NextResult>
+ struct apply_unchecked :
+ nth_of_c_impl<
+ N - 1,
+ typename boost::mpl::pop_front<Seq>::type
+ >::template apply<
+ typename get_remaining<NextResult>::type,
+ typename get_position<NextResult>::type
+ >
+ {};
+ public:
+ typedef nth_of_c_impl type;
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::eval_if<
+ typename is_error<
+ typename boost::mpl::front<Seq>::type::template apply<S, Pos>
+ >::type,
+ typename boost::mpl::front<Seq>::type::template apply<S, Pos>,
+ apply_unchecked<
+ typename boost::mpl::front<Seq>::type::template apply<S, Pos>
+ >
+ >
+ {};
+ };
+
+ template <class Seq>
+ struct nth_of_c_impl<0, Seq>
+ {
+ typedef nth_of_c_impl type;
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::fold<
+ typename boost::mpl::pop_front<Seq>::type,
+ typename boost::mpl::front<Seq>::type::template apply<
+ S,
+ Pos
+ >::type,
+ skip_seq
+ >
+ {};
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/one_char_except_not_used.hpp b/boost/metaparse/v1/impl/one_char_except_not_used.hpp
new file mode 100644
index 0000000000..249fcdd725
--- /dev/null
+++ b/boost/metaparse/v1/impl/one_char_except_not_used.hpp
@@ -0,0 +1,24 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_ONE_CHAR_EXCEPT_NOT_USED_HPP
+#define BOOST_METAPARSE_V1_IMPL_ONE_CHAR_EXCEPT_NOT_USED_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ struct one_char_except_not_used {};
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/one_of.hpp b/boost/metaparse/v1/impl/one_of.hpp
new file mode 100644
index 0000000000..e5b53e2e5c
--- /dev/null
+++ b/boost/metaparse/v1/impl/one_of.hpp
@@ -0,0 +1,44 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_ONE_OF_HPP
+#define BOOST_METAPARSE_V1_IMPL_ONE_OF_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/error/none_of_the_expected_cases_found.hpp>
+#include <boost/metaparse/v1/fail.hpp>
+
+#include <boost/metaparse/v1/impl/one_of_fwd_op.hpp>
+
+#include <boost/mpl/fold.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <class Parsers>
+ struct one_of
+ {
+ typedef one_of type;
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::fold<
+ Parsers,
+ fail<error::none_of_the_expected_cases_found>::apply<S, Pos>,
+ one_of_fwd_op<S, Pos>
+ >::type
+ {};
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/one_of_fwd_op.hpp b/boost/metaparse/v1/impl/one_of_fwd_op.hpp
new file mode 100644
index 0000000000..97d4658381
--- /dev/null
+++ b/boost/metaparse/v1/impl/one_of_fwd_op.hpp
@@ -0,0 +1,46 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_ONE_OF_FWD_OP_HPP
+#define BOOST_METAPARSE_V1_IMPL_ONE_OF_FWD_OP_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/is_error.hpp>
+#include <boost/metaparse/v1/impl/later_result.hpp>
+
+#include <boost/mpl/eval_if.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <class S, class Pos>
+ struct one_of_fwd_op
+ {
+ typedef one_of_fwd_op type;
+
+ template <class State, class P>
+ struct apply :
+ boost::mpl::eval_if<
+ typename is_error<State>::type,
+ boost::mpl::eval_if<
+ typename is_error<typename P::template apply<S, Pos> >::type,
+ later_result<State, typename P::template apply<S, Pos> >,
+ typename P::template apply<S, Pos>
+ >,
+ State
+ >
+ {};
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/pop_back.hpp b/boost/metaparse/v1/impl/pop_back.hpp
new file mode 100644
index 0000000000..7c3d9b30b2
--- /dev/null
+++ b/boost/metaparse/v1/impl/pop_back.hpp
@@ -0,0 +1,52 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_POP_BACK_HPP
+#define BOOST_METAPARSE_V1_IMPL_POP_BACK_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/config.hpp>
+#include <boost/metaparse/v1/fwd/string.hpp>
+#include <boost/metaparse/v1/impl/push_front_c.hpp>
+#include <boost/metaparse/v1/impl/size.hpp>
+#include <boost/metaparse/v1/impl/update_c.hpp>
+
+#include <boost/mpl/clear.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <class S>
+ struct pop_back;
+
+#ifdef BOOST_METAPARSE_VARIADIC_STRING
+ template <char C>
+ struct pop_back<string<C>> : boost::mpl::clear<string<C>> {};
+
+ template <char C, char... Cs>
+ struct pop_back<string<C, Cs...>> :
+ push_front_c<typename pop_back<string<Cs...>>::type, C>
+ {};
+#else
+ template <class S>
+ struct pop_back :
+ update_c<
+ typename S::type,
+ size<typename S::type>::type::value - 1,
+ BOOST_NO_CHAR
+ >
+ {};
+#endif
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/pop_front.hpp b/boost/metaparse/v1/impl/pop_front.hpp
new file mode 100644
index 0000000000..ac02d35aa1
--- /dev/null
+++ b/boost/metaparse/v1/impl/pop_front.hpp
@@ -0,0 +1,62 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_POP_FRONT_HPP
+#define BOOST_METAPARSE_V1_IMPL_POP_FRONT_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/config.hpp>
+#include <boost/metaparse/v1/fwd/string.hpp>
+
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <class S>
+ struct pop_front;
+
+#ifdef BOOST_METAPARSE_VARIADIC_STRING
+ template <char C, char... Cs>
+ struct pop_front<string<C, Cs...>> : string<Cs...> {};
+#else
+ #ifdef BOOST_METAPARSE_POP_FRONT
+ # error BOOST_METAPARSE_POP_FRONT already defined
+ #endif
+ #define BOOST_METAPARSE_POP_FRONT(z, n, unused) \
+ BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) BOOST_PP_CAT(C, n)
+
+ template < \
+ BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, int C) \
+ >
+ struct
+ pop_front<
+ string<BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, C)>
+ > :
+ string<
+ BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_METAPARSE_LIMIT_STRING_SIZE,
+ BOOST_METAPARSE_POP_FRONT,
+ ~
+ ),
+ BOOST_NO_CHAR
+ >
+ {};
+
+ #undef BOOST_METAPARSE_POP_FRONT
+#endif
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/push_back_c.hpp b/boost/metaparse/v1/impl/push_back_c.hpp
new file mode 100644
index 0000000000..453043d97c
--- /dev/null
+++ b/boost/metaparse/v1/impl/push_back_c.hpp
@@ -0,0 +1,40 @@
+#ifndef BOOST_METAPARSE_V1_PUSH_BACK_C_HPP
+#define BOOST_METAPARSE_V1_PUSH_BACK_C_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/config.hpp>
+#include <boost/metaparse/v1/fwd/string.hpp>
+#include <boost/metaparse/v1/impl/update_c.hpp>
+#include <boost/metaparse/v1/impl/size.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <class S, char C>
+ struct push_back_c;
+
+#ifdef BOOST_METAPARSE_VARIADIC_STRING
+ template <char... Cs, char C>
+ struct push_back_c<string<Cs...>, C> : string<Cs..., C> {};
+#else
+ template <class S, char C>
+ struct push_back_c :
+ update_c<typename S::type, size<typename S::type>::type::value, C>
+ {};
+#endif
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/push_front_c.hpp b/boost/metaparse/v1/impl/push_front_c.hpp
new file mode 100644
index 0000000000..27d0d3c7c9
--- /dev/null
+++ b/boost/metaparse/v1/impl/push_front_c.hpp
@@ -0,0 +1,53 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_PUSH_FRONT_C_HPP
+#define BOOST_METAPARSE_V1_IMPL_PUSH_FRONT_C_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/config.hpp>
+#include <boost/metaparse/v1/fwd/string.hpp>
+
+#include <boost/preprocessor/arithmetic/dec.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <class S, char C>
+ struct push_front_c;
+
+#ifdef BOOST_METAPARSE_VARIADIC_STRING
+ template <char... Cs, char C>
+ struct push_front_c<string<Cs...>, C> : string<C, Cs...> {};
+#else
+ template <
+ BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, int C),
+ char Ch
+ >
+ struct push_front_c<
+ string<BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, C)>,
+ Ch
+ > :
+ string<
+ Ch,
+ BOOST_PP_ENUM_PARAMS(
+ BOOST_PP_DEC(BOOST_METAPARSE_LIMIT_STRING_SIZE),
+ C
+ )
+ >
+ {};
+#endif
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/remove_trailing_no_chars.hpp b/boost/metaparse/v1/impl/remove_trailing_no_chars.hpp
new file mode 100644
index 0000000000..7d561d2709
--- /dev/null
+++ b/boost/metaparse/v1/impl/remove_trailing_no_chars.hpp
@@ -0,0 +1,57 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_REMOVE_TRAILING_NO_CHARS_HPP
+#define BOOST_METAPARSE_V1_IMPL_REMOVE_TRAILING_NO_CHARS_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/config.hpp>
+#include <boost/metaparse/v1/string.hpp>
+#include <boost/metaparse/v1/impl/push_front_c.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <class S>
+ struct remove_trailing_no_chars : S {};
+
+#ifdef BOOST_METAPARSE_VARIADIC_STRING
+ // this code assumes that BOOST_NO_CHARs are at the end of the string
+ template <char... Cs>
+ struct remove_trailing_no_chars<string<BOOST_NO_CHAR, Cs...>> :
+ string<>
+ {};
+
+ template <char C, char... Cs>
+ struct remove_trailing_no_chars<string<C, Cs...>> :
+ push_front_c<typename remove_trailing_no_chars<string<Cs...>>::type,C>
+ {};
+
+#ifdef _MSC_VER
+ /*
+ * These specialisations are needed to avoid an internal compiler error
+ * in Visual C++ 12
+ */
+ template <char C>
+ struct remove_trailing_no_chars<string<C>> : string<C> {};
+
+ template <>
+ struct remove_trailing_no_chars<string<BOOST_NO_CHAR>> : string<> {};
+
+ template <>
+ struct remove_trailing_no_chars<string<>> : string<> {};
+#endif
+#endif
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/returns.hpp b/boost/metaparse/v1/impl/returns.hpp
new file mode 100644
index 0000000000..ede50f6a8f
--- /dev/null
+++ b/boost/metaparse/v1/impl/returns.hpp
@@ -0,0 +1,28 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_RETURNS_HPP
+#define BOOST_METAPARSE_V1_IMPL_RETURNS_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <class T>
+ struct returns
+ {
+ typedef T type;
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/sequence.hpp b/boost/metaparse/v1/impl/sequence.hpp
new file mode 100644
index 0000000000..c500cdf046
--- /dev/null
+++ b/boost/metaparse/v1/impl/sequence.hpp
@@ -0,0 +1,59 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_SEQUENCE_HPP
+#define BOOST_METAPARSE_V1_IMPL_SEQUENCE_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/impl/sequence_impl.hpp>
+#include <boost/metaparse/limit_sequence_size.hpp>
+
+#include <boost/mpl/vector.hpp>
+
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/cat.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ #ifdef BOOST_METAPARSE_SEQUENCE_CASE
+ # error BOOST_METAPARSE_SEQUENCE_CASE already defined
+ #endif
+ #define BOOST_METAPARSE_SEQUENCE_CASE(z, n, unused) \
+ template <BOOST_PP_ENUM_PARAMS(n, class P)> \
+ struct BOOST_PP_CAT(sequence, n) \
+ { \
+ typedef BOOST_PP_CAT(sequence, n) type; \
+ \
+ template <class S, class Pos> \
+ struct apply : \
+ sequence_impl< \
+ boost::mpl::vector<BOOST_PP_ENUM_PARAMS(n, P)>, \
+ S, \
+ Pos \
+ > \
+ {}; \
+ };
+
+ BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
+ BOOST_METAPARSE_SEQUENCE_CASE,
+ ~
+ )
+
+ #undef BOOST_METAPARSE_SEQUENCE_CASE
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/sequence_impl.hpp b/boost/metaparse/v1/impl/sequence_impl.hpp
new file mode 100644
index 0000000000..d3310ed8af
--- /dev/null
+++ b/boost/metaparse/v1/impl/sequence_impl.hpp
@@ -0,0 +1,37 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_SEQUENCE_IMPL_HPP
+#define BOOST_METAPARSE_V1_IMPL_SEQUENCE_IMPL_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/impl/apply_parser.hpp>
+#include <boost/metaparse/v1/accept.hpp>
+
+#include <boost/mpl/deque.hpp>
+#include <boost/mpl/fold.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <class Ps, class S, class Pos>
+ struct sequence_impl :
+ boost::mpl::fold<
+ Ps,
+ accept<boost::mpl::deque<>, S, Pos>,
+ apply_parser
+ >
+ {};
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/size.hpp b/boost/metaparse/v1/impl/size.hpp
new file mode 100644
index 0000000000..c6e0ee7e27
--- /dev/null
+++ b/boost/metaparse/v1/impl/size.hpp
@@ -0,0 +1,69 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_SIZE_HPP
+#define BOOST_METAPARSE_V1_IMPL_SIZE_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/config.hpp>
+#include <boost/metaparse/v1/fwd/string.hpp>
+
+#include <boost/mpl/int.hpp>
+
+#include <boost/preprocessor/arithmetic/sub.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/repetition/enum.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/tuple/eat.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <class S>
+ struct size;
+
+#ifdef BOOST_METAPARSE_VARIADIC_STRING
+ template <char... Cs>
+ struct size<string<Cs...>> : boost::mpl::int_<sizeof...(Cs)> {};
+#else
+ #ifdef BOOST_METAPARSE_STRING_CASE
+ # error BOOST_METAPARSE_STRING_CASE
+ #endif
+ #define BOOST_METAPARSE_STRING_CASE(z, n, unused) \
+ template <BOOST_PP_ENUM_PARAMS(n, int C)> \
+ struct \
+ size< \
+ string< \
+ BOOST_PP_ENUM_PARAMS(n, C) BOOST_PP_COMMA_IF(n) \
+ BOOST_PP_ENUM( \
+ BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_STRING_SIZE, n), \
+ BOOST_NO_CHAR BOOST_PP_TUPLE_EAT(3), \
+ ~ \
+ ) \
+ > \
+ > : \
+ boost::mpl::int_<n> \
+ {};
+
+ BOOST_PP_REPEAT(
+ BOOST_METAPARSE_LIMIT_STRING_SIZE,
+ BOOST_METAPARSE_STRING_CASE,
+ ~
+ )
+
+ #undef BOOST_METAPARSE_STRING_CASE
+#endif
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/skip_seq.hpp b/boost/metaparse/v1/impl/skip_seq.hpp
new file mode 100644
index 0000000000..4d7e5b138a
--- /dev/null
+++ b/boost/metaparse/v1/impl/skip_seq.hpp
@@ -0,0 +1,74 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_SKIP_SEQ_HPP
+#define BOOST_METAPARSE_V1_IMPL_SKIP_SEQ_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/is_error.hpp>
+#include <boost/metaparse/v1/accept.hpp>
+#include <boost/metaparse/v1/get_remaining.hpp>
+#include <boost/metaparse/v1/get_position.hpp>
+#include <boost/metaparse/v1/get_result.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ struct skip_seq
+ {
+ private:
+ template <class ParsingResult, class NewResultValue>
+ struct change_result :
+ accept<
+ NewResultValue,
+ typename get_remaining<ParsingResult>::type,
+ typename get_position<ParsingResult>::type
+ >
+ {};
+
+ template <class Result, class P>
+ struct apply_unchecked :
+ boost::mpl::eval_if<
+ typename is_error<
+ typename P::template apply<
+ typename get_remaining<Result>::type,
+ typename get_position<Result>::type
+ >
+ >::type,
+ typename P::template apply<
+ typename get_remaining<Result>::type,
+ typename get_position<Result>::type
+ >,
+ change_result<
+ typename P::template apply<
+ typename get_remaining<Result>::type,
+ typename get_position<Result>::type
+ >,
+ typename get_result<Result>::type
+ >
+ >
+ {};
+
+ public:
+ template <class Result, class P>
+ struct apply :
+ boost::mpl::eval_if<
+ is_error<Result>,
+ Result,
+ apply_unchecked<Result, P>
+ >
+ {};
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/split_at_c.hpp b/boost/metaparse/v1/impl/split_at_c.hpp
new file mode 100644
index 0000000000..44c2675905
--- /dev/null
+++ b/boost/metaparse/v1/impl/split_at_c.hpp
@@ -0,0 +1,101 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_SPLIT_AT_C_HPP
+#define BOOST_METAPARSE_V1_IMPL_SPLIT_AT_C_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/config.hpp>
+#include <boost/metaparse/v1/fwd/string.hpp>
+#include <boost/metaparse/v1/impl/push_front_c.hpp>
+
+#include <boost/preprocessor/arithmetic/add.hpp>
+#include <boost/preprocessor/arithmetic/sub.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/repetition/enum.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+
+#include <boost/mpl/pair.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <int N, class S>
+ struct split_at_c;
+
+#ifdef BOOST_METAPARSE_VARIADIC_STRING
+ template <int N, char C, char... Cs>
+ struct split_at_c<N, string<C, Cs...>> :
+ boost::mpl::pair<
+ typename push_front_c<
+ typename split_at_c<N - 1, string<Cs...>>::type::first,
+ C
+ >::type,
+ typename split_at_c<N - 1, string<Cs...>>::type::second
+ >
+ {};
+
+ template <char C, char... Cs>
+ struct split_at_c<0, string<C, Cs...>> :
+ boost::mpl::pair<string<>, string<C, Cs...>>
+ {};
+
+ template <char... Cs>
+ struct split_at_c<0, string<Cs...>> :
+ boost::mpl::pair<string<>, string<Cs...>>
+ {};
+#else
+ #ifdef BOOST_METAPARSE_ARG
+ # error BOOST_METAPARSE_ARG already defined
+ #endif
+ #define BOOST_METAPARSE_ARG(z, n, d) BOOST_PP_CAT(C, BOOST_PP_ADD(n, d))
+
+ #ifdef BOOST_METAPARSE_SPLIT_AT
+ # error BOOST_METAPARSE_SPLIT_AT already defined
+ #endif
+ #define BOOST_METAPARSE_SPLIT_AT(z, n, unused) \
+ template < \
+ BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, int C) \
+ > \
+ struct \
+ split_at_c< \
+ n, \
+ string<BOOST_PP_ENUM_PARAMS( \
+ BOOST_METAPARSE_LIMIT_STRING_SIZE, C) \
+ > \
+ > : \
+ boost::mpl::pair< \
+ string<BOOST_PP_ENUM_PARAMS(n, C)>, \
+ string< \
+ BOOST_PP_ENUM( \
+ BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_STRING_SIZE, n), \
+ BOOST_METAPARSE_ARG, \
+ n \
+ ) \
+ > \
+ > \
+ {};
+
+ BOOST_PP_REPEAT(
+ BOOST_METAPARSE_LIMIT_STRING_SIZE,
+ BOOST_METAPARSE_SPLIT_AT,
+ ~
+ )
+
+ #undef BOOST_METAPARSE_SPLIT_AT
+ #undef BOOST_METAPARSE_ARG
+#endif
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/string_iterator.hpp b/boost/metaparse/v1/impl/string_iterator.hpp
new file mode 100644
index 0000000000..3e37ff3b0d
--- /dev/null
+++ b/boost/metaparse/v1/impl/string_iterator.hpp
@@ -0,0 +1,159 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_STRING_ITERATOR_HPP
+#define BOOST_METAPARSE_V1_IMPL_STRING_ITERATOR_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/impl/string_iterator_tag.hpp>
+#include <boost/metaparse/v1/impl/at_c.hpp>
+
+
+#include <boost/mpl/iterator_tags.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/bool.hpp>
+
+#include <boost/type_traits/is_same.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ // string_iterator
+ template <class S, int N>
+ struct string_iterator
+ {
+ typedef string_iterator type;
+ typedef string_iterator_tag tag;
+ typedef boost::mpl::random_access_iterator_tag category;
+ };
+
+ // advance_c
+
+ template <class S, int N>
+ struct advance_c;
+
+ template <class S, int N, int P>
+ struct advance_c<string_iterator<S, N>, P> :
+ string_iterator<S, N + P>
+ {};
+
+ // distance
+
+ template <class A, class B>
+ struct distance;
+
+ template <class S, int A, int B>
+ struct distance<string_iterator<S, A>, string_iterator<S, B> > :
+ boost::mpl::int_<B - A>
+ {};
+ }
+ }
+ }
+}
+
+namespace boost
+{
+ namespace mpl
+ {
+ // advance
+ template <class S>
+ struct advance_impl;
+
+ template <>
+ struct advance_impl<boost::metaparse::v1::impl::string_iterator_tag>
+ {
+ typedef advance_impl type;
+
+ template <class S, class N>
+ struct apply :
+ boost::metaparse::v1::impl::advance_c<
+ typename S::type, N::type::value
+ >
+ {};
+ };
+
+ // distance
+ template <class S>
+ struct distance_impl;
+
+ template <>
+ struct distance_impl<boost::metaparse::v1::impl::string_iterator_tag>
+ {
+ typedef distance_impl type;
+
+ template <class A, class B>
+ struct apply :
+ boost::metaparse::v1::impl::distance<
+ typename A::type,
+ typename B::type
+ >
+ {};
+ };
+
+ // next
+ template <class S>
+ struct next;
+
+ template <class S, int N>
+ struct next<boost::metaparse::v1::impl::string_iterator<S, N> > :
+ boost::metaparse::v1::impl::string_iterator<S, N + 1>
+ {};
+
+ // prior
+ template <class S>
+ struct prior;
+
+ template <class S, int N>
+ struct prior<boost::metaparse::v1::impl::string_iterator<S, N> > :
+ boost::metaparse::v1::impl::string_iterator<S, N - 1>
+ {};
+
+ // deref
+ template <class S>
+ struct deref;
+
+ template <class S, int N>
+ struct deref<boost::metaparse::v1::impl::string_iterator<S, N> > :
+ boost::metaparse::v1::impl::at_c<S, N>
+ {};
+
+ // equal_to
+ template <class A, class B>
+ struct equal_to_impl;
+
+ template <>
+ struct equal_to_impl<
+ boost::metaparse::v1::impl::string_iterator_tag,
+ boost::metaparse::v1::impl::string_iterator_tag
+ >
+ {
+ typedef equal_to_impl type;
+
+ template <class A, class B>
+ struct apply : is_same<typename A::type, typename B::type> {};
+ };
+
+ template <class T>
+ struct equal_to_impl<boost::metaparse::v1::impl::string_iterator_tag, T>
+ {
+ typedef equal_to_impl type;
+
+ template <class, class>
+ struct apply : false_ {};
+ };
+
+ template <class T>
+ struct equal_to_impl<T, boost::metaparse::v1::impl::string_iterator_tag> :
+ equal_to_impl<boost::metaparse::v1::impl::string_iterator_tag, T>
+ {};
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/string_iterator_tag.hpp b/boost/metaparse/v1/impl/string_iterator_tag.hpp
new file mode 100644
index 0000000000..b7d9041006
--- /dev/null
+++ b/boost/metaparse/v1/impl/string_iterator_tag.hpp
@@ -0,0 +1,27 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_STRING_ITERATOR_TAG_HPP
+#define BOOST_METAPARSE_V1_IMPL_STRING_ITERATOR_TAG_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ struct string_iterator_tag
+ {
+ typedef string_iterator_tag type;
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/update_c.hpp b/boost/metaparse/v1/impl/update_c.hpp
new file mode 100644
index 0000000000..5553933e95
--- /dev/null
+++ b/boost/metaparse/v1/impl/update_c.hpp
@@ -0,0 +1,93 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_UPDATE_C_HPP
+#define BOOST_METAPARSE_V1_IMPL_UPDATE_C_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/config.hpp>
+#include <boost/metaparse/v1/fwd/string.hpp>
+#include <boost/metaparse/v1/impl/split_at_c.hpp>
+#include <boost/metaparse/v1/impl/concat.hpp>
+
+#include <boost/preprocessor/arithmetic/dec.hpp>
+#include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+#ifndef BOOST_METAPARSE_VARIADIC_STRING
+ template <class S, int N, int C>
+ struct update_c;
+
+ #ifdef BOOST_METAPARSE_ARGN
+ # error BOOST_METAPARSE_ARGN already defined
+ #endif
+ #define BOOST_METAPARSE_ARGN(z, n, unused) , BOOST_PP_CAT(C, n)
+
+ #ifdef BOOST_METAPARSE_UPDATE
+ # error BOOST_METAPARSE_UPDATE already defined
+ #endif
+ #define BOOST_METAPARSE_UPDATE(z, n, unused) \
+ template < \
+ BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, int C), \
+ int Ch \
+ > \
+ struct update_c< \
+ string<BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, C)>,\
+ n, \
+ Ch \
+ > : \
+ string< \
+ BOOST_PP_ENUM_PARAMS(n, C) BOOST_PP_COMMA_IF(n) \
+ Ch \
+ BOOST_PP_REPEAT_FROM_TO( \
+ BOOST_PP_INC(n), \
+ BOOST_PP_DEC(BOOST_METAPARSE_LIMIT_STRING_SIZE), \
+ BOOST_METAPARSE_ARGN, \
+ ~ \
+ ) \
+ > \
+ {};
+
+ BOOST_PP_REPEAT(
+ BOOST_METAPARSE_LIMIT_STRING_SIZE,
+ BOOST_METAPARSE_UPDATE,
+ ~
+ )
+
+ #undef BOOST_METAPARSE_UPDATE
+ #undef BOOST_METAPARSE_ARGN
+#else
+ template <class S, int N, char C>
+ struct update_c :
+ concat<
+ typename split_at_c<N, S>::type::first,
+ typename
+ update_c<typename split_at_c<N, S>::type::second, 0, C>::type
+ >
+ {};
+
+ template <char... Cs, char C, char NewChar>
+ struct update_c<string<C, Cs...>, 0, NewChar> :
+ string<NewChar, Cs...>
+ {};
+#endif
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/void_.hpp b/boost/metaparse/v1/impl/void_.hpp
new file mode 100644
index 0000000000..03c1d4598f
--- /dev/null
+++ b/boost/metaparse/v1/impl/void_.hpp
@@ -0,0 +1,25 @@
+#ifndef BOOST_METAPARSE_V1_IMPL_VOID_HPP
+#define BOOST_METAPARSE_V1_IMPL_VOID_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ struct void_ { typedef void_ type; };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/int_.hpp b/boost/metaparse/v1/int_.hpp
new file mode 100644
index 0000000000..12228d2c12
--- /dev/null
+++ b/boost/metaparse/v1/int_.hpp
@@ -0,0 +1,25 @@
+#ifndef BOOST_METAPARSE_V1_INT__HPP
+#define BOOST_METAPARSE_V1_INT__HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/digit_val.hpp>
+#include <boost/metaparse/v1/foldl1.hpp>
+#include <boost/metaparse/v1/impl/next_digit.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ typedef foldl1<digit_val, boost::mpl::int_<0>, impl::next_digit> int_;
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/is_error.hpp b/boost/metaparse/v1/is_error.hpp
new file mode 100644
index 0000000000..78866cde30
--- /dev/null
+++ b/boost/metaparse/v1/is_error.hpp
@@ -0,0 +1,43 @@
+#ifndef BOOST_METAPARSE_V1_IS_ERROR_HPP
+#define BOOST_METAPARSE_V1_IS_ERROR_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/fail_tag.hpp>
+
+#include <boost/mpl/tag.hpp>
+#include <boost/mpl/vector.hpp>
+
+#include <boost/type_traits/is_same.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class T = boost::mpl::na>
+ struct is_error :
+ boost::is_same<
+ fail_tag,
+ typename boost::mpl::tag<typename T::type>::type
+ >
+ {};
+
+ template <>
+ struct is_error<boost::mpl::na>
+ {
+ typedef is_error type;
+
+ template <class T = boost::mpl::na>
+ struct apply : is_error<T> {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/iterate.hpp b/boost/metaparse/v1/iterate.hpp
new file mode 100644
index 0000000000..8efa61efd0
--- /dev/null
+++ b/boost/metaparse/v1/iterate.hpp
@@ -0,0 +1,24 @@
+#ifndef BOOST_METAPARSE_V1_ITERATE_HPP
+#define BOOST_METAPARSE_V1_ITERATE_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/iterate_c.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class N>
+ struct iterate : iterate_c<P, N::type::value> {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/iterate_c.hpp b/boost/metaparse/v1/iterate_c.hpp
new file mode 100644
index 0000000000..bb50f15deb
--- /dev/null
+++ b/boost/metaparse/v1/iterate_c.hpp
@@ -0,0 +1,26 @@
+#ifndef BOOST_METAPARSE_V1_ITERATE_C_HPP
+#define BOOST_METAPARSE_V1_ITERATE_C_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/impl/iterate_impl.hpp>
+
+#include <boost/mpl/deque.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, int N>
+ struct iterate_c : impl::iterate_impl<N, P, boost::mpl::deque<> > {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/keyword.hpp b/boost/metaparse/v1/keyword.hpp
new file mode 100644
index 0000000000..c5a9f60622
--- /dev/null
+++ b/boost/metaparse/v1/keyword.hpp
@@ -0,0 +1,82 @@
+#ifndef BOOST_METAPARSE_V1_KEYWORD_HPP
+#define BOOST_METAPARSE_V1_KEYWORD_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/impl/void_.hpp>
+#include <boost/metaparse/v1/lit.hpp>
+#include <boost/metaparse/v1/return_.hpp>
+#include <boost/metaparse/v1/is_error.hpp>
+#include <boost/metaparse/v1/get_remaining.hpp>
+#include <boost/metaparse/v1/get_position.hpp>
+
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/empty.hpp>
+#include <boost/mpl/pop_front.hpp>
+#include <boost/mpl/front.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ // Does not consume/check anything after the keyword
+ template <class Kw, class ResultType = impl::void_>
+ struct keyword
+ {
+ private:
+ struct nonempty
+ {
+ private:
+ typedef lit<typename boost::mpl::front<Kw>::type> next_char_parser;
+
+ typedef
+ keyword<typename boost::mpl::pop_front<Kw>::type, ResultType>
+ rest_parser;
+
+ template <class S, class Pos>
+ struct apply_unchecked :
+ rest_parser::template apply<
+ typename get_remaining<
+ typename next_char_parser::template apply<S, Pos>
+ >::type,
+ typename get_position<
+ typename next_char_parser::template apply<S, Pos>
+ >::type
+ >
+ {};
+ public:
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::eval_if<
+ typename is_error<
+ typename next_char_parser::template apply<S, Pos>
+ >::type,
+ typename next_char_parser::template apply<S, Pos>,
+ apply_unchecked<S, Pos>
+ >
+ {};
+ };
+ public:
+ typedef keyword type;
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::if_<
+ boost::mpl::empty<Kw>,
+ return_<ResultType>,
+ nonempty
+ >::type::template apply<S, Pos>
+ {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/last_of.hpp b/boost/metaparse/v1/last_of.hpp
new file mode 100644
index 0000000000..583ed6db3e
--- /dev/null
+++ b/boost/metaparse/v1/last_of.hpp
@@ -0,0 +1,66 @@
+#ifndef BOOST_METAPARSE_V1_LAST_OF_HPP
+#define BOOST_METAPARSE_V1_LAST_OF_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/nth_of.hpp>
+
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+#include <boost/preprocessor/repetition/enum.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/arithmetic/sub.hpp>
+#include <boost/preprocessor/tuple/eat.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+ BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
+ class P,
+ boost::mpl::na
+ )
+ >
+ struct last_of;
+
+ #ifdef BOOST_METAPARSE_LAST_OF_N
+ # error BOOST_METAPARSE_LAST_OF_N already defined
+ #endif
+ #define BOOST_METAPARSE_LAST_OF_N(z, n, unused) \
+ template <BOOST_PP_ENUM_PARAMS(n, class P)> \
+ struct last_of< \
+ BOOST_PP_ENUM_PARAMS(n, P) \
+ BOOST_PP_COMMA_IF(n) \
+ BOOST_PP_ENUM( \
+ BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE, n), \
+ boost::mpl::na BOOST_PP_TUPLE_EAT(3), \
+ ~ \
+ ) \
+ > : \
+ impl::BOOST_PP_CAT(nth_of_c, n)< \
+ n - 1 BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, P) \
+ > \
+ {};
+
+ BOOST_PP_REPEAT(
+ BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
+ BOOST_METAPARSE_LAST_OF_N,
+ ~
+ )
+
+ #undef BOOST_METAPARSE_LAST_OF_N
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/letter.hpp b/boost/metaparse/v1/letter.hpp
new file mode 100644
index 0000000000..cf1f0d3aff
--- /dev/null
+++ b/boost/metaparse/v1/letter.hpp
@@ -0,0 +1,29 @@
+#ifndef BOOST_METAPARSE_V1_LETTER_HPP
+#define BOOST_METAPARSE_V1_LETTER_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/error/letter_expected.hpp>
+#include <boost/metaparse/v1/accept_when.hpp>
+#include <boost/metaparse/v1/one_char.hpp>
+
+#include <boost/metaparse/v1/util/is_letter.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ typedef
+ accept_when<one_char, util::is_letter<>, error::letter_expected>
+ letter;
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/lit.hpp b/boost/metaparse/v1/lit.hpp
new file mode 100644
index 0000000000..c045420898
--- /dev/null
+++ b/boost/metaparse/v1/lit.hpp
@@ -0,0 +1,24 @@
+#ifndef BOOST_METAPARSE_V1_LIT_HPP
+#define BOOST_METAPARSE_V1_LIT_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/lit_c.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class C>
+ struct lit : lit_c<C::type::value> {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/lit_c.hpp b/boost/metaparse/v1/lit_c.hpp
new file mode 100644
index 0000000000..c5eccbc59a
--- /dev/null
+++ b/boost/metaparse/v1/lit_c.hpp
@@ -0,0 +1,34 @@
+#ifndef BOOST_METAPARSE_V1_LIT_C_HPP
+#define BOOST_METAPARSE_V1_LIT_C_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/error/literal_expected.hpp>
+#include <boost/metaparse/v1/accept_when.hpp>
+#include <boost/metaparse/v1/one_char.hpp>
+#include <boost/metaparse/v1/change_error_message.hpp>
+#include <boost/metaparse/v1/impl/is_char_c.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <char C>
+ struct lit_c :
+ accept_when<
+ change_error_message<one_char, error::literal_expected<C> >,
+ impl::is_char_c<C>,
+ error::literal_expected<C>
+ >
+ {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/look_ahead.hpp b/boost/metaparse/v1/look_ahead.hpp
new file mode 100644
index 0000000000..768d980c70
--- /dev/null
+++ b/boost/metaparse/v1/look_ahead.hpp
@@ -0,0 +1,50 @@
+#ifndef BOOST_METAPARSE_V1_LOOK_AHEAD_HPP
+#define BOOST_METAPARSE_V1_LOOK_AHEAD_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/is_error.hpp>
+#include <boost/metaparse/v1/accept.hpp>
+#include <boost/metaparse/v1/get_result.hpp>
+
+#include <boost/mpl/eval_if.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P>
+ struct look_ahead
+ {
+ private:
+ template <class S, class Pos>
+ struct no_error :
+ accept<
+ typename get_result<typename P::template apply<S, Pos> >::type,
+ S,
+ Pos
+ >
+ {};
+ public:
+ typedef look_ahead type;
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::eval_if<
+ typename is_error<typename P::template apply<S, Pos> >::type,
+ typename P::template apply<S, Pos>,
+ no_error<S, Pos>
+ >
+ {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/middle_of.hpp b/boost/metaparse/v1/middle_of.hpp
new file mode 100644
index 0000000000..3526153af8
--- /dev/null
+++ b/boost/metaparse/v1/middle_of.hpp
@@ -0,0 +1,48 @@
+#ifndef BOOST_METAPARSE_V1_KEEP_MIDDLE_HPP
+#define BOOST_METAPARSE_V1_KEEP_MIDDLE_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/nth_of.hpp>
+#include <boost/metaparse/v1/transform_error_message.hpp>
+#include <boost/metaparse/v1/get_col.hpp>
+#include <boost/metaparse/v1/get_line.hpp>
+
+#include <boost/metaparse/v1/error/unpaired.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P1, class P2, class P3>
+ struct middle_of
+ {
+ typedef middle_of type;
+
+ template <class S, class Pos>
+ struct apply :
+ nth_of_c<
+ 1,
+ P1,
+ P2,
+ transform_error_message<
+ P3,
+ error::unpaired<
+ get_line<Pos>::type::value,
+ get_col<Pos>::type::value
+ >
+ >
+ >::template apply<S, Pos>
+ {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/next_char.hpp b/boost/metaparse/v1/next_char.hpp
new file mode 100644
index 0000000000..053e4fd7d1
--- /dev/null
+++ b/boost/metaparse/v1/next_char.hpp
@@ -0,0 +1,30 @@
+#ifndef BOOST_METAPARSE_V1_NEXT_CHAR_HPP
+#define BOOST_METAPARSE_V1_NEXT_CHAR_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/fwd/next_char.hpp>
+
+#include <boost/mpl/tag.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class Ch>
+ struct next_char :
+ next_char_impl<
+ typename boost::mpl::tag<typename P::type>::type
+ >::template apply<typename P::type, typename Ch::type>
+ {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/next_line.hpp b/boost/metaparse/v1/next_line.hpp
new file mode 100644
index 0000000000..4f190369cc
--- /dev/null
+++ b/boost/metaparse/v1/next_line.hpp
@@ -0,0 +1,30 @@
+#ifndef BOOST_METAPARSE_V1_NEXT_LINE_HPP
+#define BOOST_METAPARSE_V1_NEXT_LINE_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/fwd/next_line.hpp>
+
+#include <boost/mpl/tag.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class Ch>
+ struct next_line :
+ next_line_impl<
+ typename boost::mpl::tag<typename P::type>::type
+ >::template apply<typename P::type, typename Ch::type>
+ {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/nth_of.hpp b/boost/metaparse/v1/nth_of.hpp
new file mode 100644
index 0000000000..843733a91d
--- /dev/null
+++ b/boost/metaparse/v1/nth_of.hpp
@@ -0,0 +1,39 @@
+#ifndef BOOST_METAPARSE_V1_NTH_OF_HPP
+#define BOOST_METAPARSE_V1_NTH_OF_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/nth_of_c.hpp>
+
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <
+ class K,
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+ BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
+ class P,
+ boost::mpl::na
+ )
+ >
+ struct nth_of :
+ nth_of_c<
+ K::type::value,
+ BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE, P)
+ >
+ {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/nth_of_c.hpp b/boost/metaparse/v1/nth_of_c.hpp
new file mode 100644
index 0000000000..12af00a224
--- /dev/null
+++ b/boost/metaparse/v1/nth_of_c.hpp
@@ -0,0 +1,70 @@
+#ifndef BOOST_METAPARSE_V1_NTH_OF_C_HPP
+#define BOOST_METAPARSE_V1_NTH_OF_C_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/impl/nth_of_c.hpp>
+#include <boost/metaparse/limit_sequence_size.hpp>
+
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/repetition/enum.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+#include <boost/preprocessor/arithmetic/sub.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/tuple/eat.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <
+ int N,
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+ BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
+ class P,
+ boost::mpl::na
+ )
+ >
+ struct nth_of_c;
+
+ #ifdef BOOST_METAPARSE_NTH_OF_N
+ # error BOOST_METAPARSE_NTH_OF_N already defined
+ #endif
+ #define BOOST_METAPARSE_NTH_OF_N(z, n, unused) \
+ template <int K BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, class P)> \
+ struct nth_of_c< \
+ K, \
+ BOOST_PP_ENUM_PARAMS(n, P) \
+ BOOST_PP_COMMA_IF(n) \
+ BOOST_PP_ENUM( \
+ BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE, n), \
+ boost::mpl::na BOOST_PP_TUPLE_EAT(3), \
+ ~ \
+ ) \
+ > : \
+ impl::BOOST_PP_CAT(nth_of_c, n)< \
+ K BOOST_PP_COMMA_IF(n) \
+ BOOST_PP_ENUM_PARAMS(n, P) \
+ > \
+ {};
+
+ BOOST_PP_REPEAT(
+ BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
+ BOOST_METAPARSE_NTH_OF_N,
+ ~
+ )
+
+ #undef BOOST_METAPARSE_NTH_OF_N
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/one_char.hpp b/boost/metaparse/v1/one_char.hpp
new file mode 100644
index 0000000000..0b129b2702
--- /dev/null
+++ b/boost/metaparse/v1/one_char.hpp
@@ -0,0 +1,71 @@
+#ifndef BOOST_METAPARSE_V1_ONE_CHAR_HPP
+#define BOOST_METAPARSE_V1_ONE_CHAR_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/error/unexpected_end_of_input.hpp>
+#include <boost/metaparse/v1/next_char.hpp>
+#include <boost/metaparse/v1/next_line.hpp>
+#include <boost/metaparse/v1/accept.hpp>
+#include <boost/metaparse/v1/reject.hpp>
+#include <boost/metaparse/v1/get_prev_char.hpp>
+
+#include <boost/mpl/empty.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/pop_front.hpp>
+#include <boost/mpl/bool.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ struct one_char
+ {
+ private:
+ template <class C, class Pos>
+ struct next_pos :
+ boost::mpl::eval_if<
+ boost::mpl::bool_<
+ C::type::value == '\r'
+ || (
+ C::type::value == '\n'
+ && get_prev_char<Pos>::type::value != '\r'
+ )
+ >,
+ next_line<Pos, C>,
+ next_char<Pos, C>
+ >
+ {};
+
+ template <class S, class NextPos>
+ struct unchecked :
+ accept<
+ typename boost::mpl::front<S>::type,
+ boost::mpl::pop_front<S>,
+ NextPos
+ >
+ {};
+ public:
+ typedef one_char type;
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::eval_if<
+ typename boost::mpl::empty<S>::type,
+ reject<error::unexpected_end_of_input, Pos>,
+ unchecked<S, next_pos<boost::mpl::front<S>, Pos> >
+ >
+ {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/one_char_except.hpp b/boost/metaparse/v1/one_char_except.hpp
new file mode 100644
index 0000000000..c859ab23f3
--- /dev/null
+++ b/boost/metaparse/v1/one_char_except.hpp
@@ -0,0 +1,85 @@
+#ifndef BOOST_METAPARSE_V1_ONE_CHAR_EXCEPT_HPP
+#define BOOST_METAPARSE_V1_ONE_CHAR_EXCEPT_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/error/unexpected_character.hpp>
+#include <boost/metaparse/v1/impl/is_any.hpp>
+#include <boost/metaparse/v1/impl/one_char_except_not_used.hpp>
+#include <boost/metaparse/v1/one_char.hpp>
+#include <boost/metaparse/v1/accept_when.hpp>
+#include <boost/metaparse/v1/define_error.hpp>
+#include <boost/metaparse/limit_one_char_except_size.hpp>
+
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/arithmetic/dec.hpp>
+#include <boost/preprocessor/arithmetic/mul.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/repetition/enum.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/tuple/eat.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+ BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE,
+ class C,
+ impl::one_char_except_not_used
+ )
+ >
+ struct one_char_except;
+
+ #ifdef MPLLBIS_METAPARSE_ONE_CHAR_EXCEPT_CASE
+ # error MPLLBIS_METAPARSE_ONE_CHAR_EXCEPT_CASE already defined
+ #endif
+ #define MPLLBIS_METAPARSE_ONE_CHAR_EXCEPT_CASE(z, n, unused) \
+ template <BOOST_PP_ENUM_PARAMS(n, class T)> \
+ struct one_char_except< \
+ BOOST_PP_ENUM_PARAMS(n, T) \
+ BOOST_PP_COMMA_IF( \
+ BOOST_PP_MUL( \
+ n, \
+ BOOST_PP_SUB( \
+ BOOST_PP_DEC(BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE), \
+ n \
+ ) \
+ ) \
+ ) \
+ BOOST_PP_ENUM( \
+ BOOST_PP_SUB( \
+ BOOST_PP_DEC(BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE), \
+ n \
+ ), \
+ impl::one_char_except_not_used BOOST_PP_TUPLE_EAT(3), \
+ ~ \
+ ) \
+ > :\
+ accept_when< \
+ one_char, \
+ impl::BOOST_PP_CAT(is_any, n)<BOOST_PP_ENUM_PARAMS(n, T)>, \
+ error::unexpected_character \
+ > \
+ {};
+
+ BOOST_PP_REPEAT(
+ BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE,
+ MPLLBIS_METAPARSE_ONE_CHAR_EXCEPT_CASE,
+ ~
+ )
+
+ #undef MPLLBIS_METAPARSE_ONE_CHAR_EXCEPT_CASE
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/one_char_except_c.hpp b/boost/metaparse/v1/one_char_except_c.hpp
new file mode 100644
index 0000000000..780cb5924f
--- /dev/null
+++ b/boost/metaparse/v1/one_char_except_c.hpp
@@ -0,0 +1,96 @@
+#ifndef BOOST_METAPARSE_V1_ONE_CHAR_EXCEPT_C_HPP
+#define BOOST_METAPARSE_V1_ONE_CHAR_EXCEPT_C_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/limit_one_char_except_size.hpp>
+#include <boost/metaparse/v1/error/unexpected_character.hpp>
+#include <boost/metaparse/v1/impl/is_any.hpp>
+#include <boost/metaparse/v1/accept_when.hpp>
+#include <boost/metaparse/v1/one_char.hpp>
+
+#include <boost/mpl/char.hpp>
+
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/arithmetic/sub.hpp>
+#include <boost/preprocessor/arithmetic/mul.hpp>
+#include <boost/preprocessor/arithmetic/dec.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/repetition/enum.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/tuple/eat.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+ BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE,
+ int C,
+ 1024
+ )
+ >
+ struct one_char_except_c;
+
+ #ifdef BOOST_METAPARSE_WRAP
+ # error BOOST_METAPARSE_WRAP already defined
+ #endif
+ #define BOOST_METAPARSE_WRAP(z, n, unused) \
+ boost::mpl::char_<BOOST_PP_CAT(C, n)>
+
+ #ifdef MPLLBIS_METAPARSE_ONE_CHAR_EXCEPT_CASE
+ # error MPLLBIS_METAPARSE_ONE_CHAR_EXCEPT_CASE already defined
+ #endif
+ #define MPLLBIS_METAPARSE_ONE_CHAR_EXCEPT_CASE(z, n, unused) \
+ template <BOOST_PP_ENUM_PARAMS(n, int C)> \
+ struct one_char_except_c< \
+ BOOST_PP_ENUM_PARAMS(n, C) \
+ BOOST_PP_COMMA_IF( \
+ BOOST_PP_MUL( \
+ n, \
+ BOOST_PP_SUB( \
+ BOOST_PP_DEC(BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE), \
+ n \
+ )\
+ ) \
+ ) \
+ BOOST_PP_ENUM( \
+ BOOST_PP_SUB( \
+ BOOST_PP_DEC(BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE), \
+ n \
+ ), \
+ 1024 BOOST_PP_TUPLE_EAT(3), \
+ ~ \
+ ) \
+ > : \
+ accept_when< \
+ one_char, \
+ impl::BOOST_PP_CAT(is_any, n)< \
+ BOOST_PP_ENUM(n, BOOST_METAPARSE_WRAP, ~) \
+ >, \
+ error::unexpected_character \
+ > \
+ {};
+
+ BOOST_PP_REPEAT(
+ BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE,
+ MPLLBIS_METAPARSE_ONE_CHAR_EXCEPT_CASE,
+ ~
+ )
+
+ #undef MPLLBIS_METAPARSE_ONE_CHAR_EXCEPT_CASE
+ #undef BOOST_METAPARSE_WRAP
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/one_of.hpp b/boost/metaparse/v1/one_of.hpp
new file mode 100644
index 0000000000..d48db4c4c0
--- /dev/null
+++ b/boost/metaparse/v1/one_of.hpp
@@ -0,0 +1,42 @@
+#ifndef BOOST_METAPARSE_V1_ONE_OF_HPP
+#define BOOST_METAPARSE_V1_ONE_OF_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/impl/one_of.hpp>
+#include <boost/metaparse/limit_one_of_size.hpp>
+
+#include <boost/mpl/vector.hpp>
+
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+ BOOST_METAPARSE_LIMIT_ONE_OF_SIZE,
+ class P,
+ boost::mpl::na
+ )
+ >
+ struct one_of :
+ impl::one_of<
+ boost::mpl::vector<
+ BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_ONE_OF_SIZE, P)
+ >
+ >
+ {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/one_of_c.hpp b/boost/metaparse/v1/one_of_c.hpp
new file mode 100644
index 0000000000..ff7251a4e0
--- /dev/null
+++ b/boost/metaparse/v1/one_of_c.hpp
@@ -0,0 +1,80 @@
+#ifndef BOOST_METAPARSE_V1_ONE_OF_C_HPP
+#define BOOST_METAPARSE_V1_ONE_OF_C_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/one_of.hpp>
+#include <boost/metaparse/v1/lit_c.hpp>
+
+#include <boost/preprocessor/arithmetic/sub.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/repetition/enum.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/tuple/eat.hpp>
+
+#include <climits>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ #ifdef BOOST_NO_SCALAR_VALUE
+ # error BOOST_NO_SCALAR_VALUE already defined
+ #endif
+ #define BOOST_NO_SCALAR_VALUE LONG_MAX
+
+ template <
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+ BOOST_METAPARSE_LIMIT_ONE_OF_SIZE,
+ long C,
+ BOOST_NO_SCALAR_VALUE
+ )
+ >
+ struct one_of_c;
+
+ #ifdef BOOST_METAPARSE_ONE_OF_C_LIT
+ # error BOOST_METAPARSE_ONE_OF_C_LIT already defined
+ #endif
+ #define BOOST_METAPARSE_ONE_OF_C_LIT(z, n, unused) lit_c<BOOST_PP_CAT(C, n)>
+
+ #ifdef BOOST_METAPARSE_ONE_OF_C_CASE
+ # error BOOST_METAPARSE_ONE_OF_C_CASE already defined
+ #endif
+ #define BOOST_METAPARSE_ONE_OF_C_CASE(z, n, unused) \
+ template <BOOST_PP_ENUM_PARAMS(n, long C)> \
+ struct \
+ one_of_c< \
+ BOOST_PP_ENUM_PARAMS(n, C) \
+ BOOST_PP_COMMA_IF(n) \
+ BOOST_PP_ENUM( \
+ BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_ONE_OF_SIZE, n), \
+ BOOST_NO_SCALAR_VALUE BOOST_PP_TUPLE_EAT(3), \
+ ~ \
+ ) \
+ > : \
+ one_of< BOOST_PP_ENUM(n, BOOST_METAPARSE_ONE_OF_C_LIT, ~) > \
+ {};
+
+ BOOST_PP_REPEAT(
+ BOOST_METAPARSE_LIMIT_ONE_OF_SIZE,
+ BOOST_METAPARSE_ONE_OF_C_CASE,
+ ~
+ )
+
+ #undef BOOST_METAPARSE_ONE_OF_C_CASE
+ #undef BOOST_METAPARSE_ONE_OF_C_LIT
+ #undef BOOST_NO_SCALAR_VALUE
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/optional.hpp b/boost/metaparse/v1/optional.hpp
new file mode 100644
index 0000000000..efebcd4663
--- /dev/null
+++ b/boost/metaparse/v1/optional.hpp
@@ -0,0 +1,40 @@
+#ifndef BOOST_METAPARSE_V1_OPTIONAL_HPP
+#define BOOST_METAPARSE_V1_OPTIONAL_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/is_error.hpp>
+#include <boost/metaparse/v1/accept.hpp>
+
+#include <boost/mpl/if.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class Default = void>
+ struct optional
+ {
+ typedef optional type;
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::if_<
+ is_error<typename P::template apply<S, Pos> >,
+ accept<Default, S, Pos>,
+ // is_error evaluates it anyway
+ typename P::template apply<S, Pos>::type
+ >
+ {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/range.hpp b/boost/metaparse/v1/range.hpp
new file mode 100644
index 0000000000..efddfc41f8
--- /dev/null
+++ b/boost/metaparse/v1/range.hpp
@@ -0,0 +1,33 @@
+#ifndef BOOST_METAPARSE_V1_RANGE_HPP
+#define BOOST_METAPARSE_V1_RANGE_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/accept_when.hpp>
+#include <boost/metaparse/v1/one_char.hpp>
+#include <boost/metaparse/v1/util/in_range_c.hpp>
+#include <boost/metaparse/v1/error/unexpected_character.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class From, class To>
+ struct range :
+ accept_when<
+ one_char,
+ util::in_range_c<char, From::type::value, To::type::value>,
+ error::unexpected_character
+ >
+ {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/range_c.hpp b/boost/metaparse/v1/range_c.hpp
new file mode 100644
index 0000000000..d843df19c9
--- /dev/null
+++ b/boost/metaparse/v1/range_c.hpp
@@ -0,0 +1,33 @@
+#ifndef BOOST_METAPARSE_V1_RANGE_C_HPP
+#define BOOST_METAPARSE_V1_RANGE_C_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/accept_when.hpp>
+#include <boost/metaparse/v1/one_char.hpp>
+#include <boost/metaparse/v1/util/in_range_c.hpp>
+#include <boost/metaparse/v1/error/unexpected_character.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <char From, char To>
+ struct range_c :
+ accept_when<
+ one_char,
+ util::in_range_c<char, From, To>,
+ error::unexpected_character
+ >
+ {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/reject.hpp b/boost/metaparse/v1/reject.hpp
new file mode 100644
index 0000000000..a25e3b0dbe
--- /dev/null
+++ b/boost/metaparse/v1/reject.hpp
@@ -0,0 +1,33 @@
+#ifndef BOOST_METAPARSE_V1_REJECT_HPP
+#define BOOST_METAPARSE_V1_REJECT_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/fwd/reject.hpp>
+#include <boost/metaparse/v1/fail_tag.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class Msg, class Pos>
+ struct reject
+ {
+ typedef fail_tag tag;
+
+ typedef reject<Msg, typename Pos::type> type;
+
+ typedef Pos source_position;
+ typedef Msg message;
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/repeated.hpp b/boost/metaparse/v1/repeated.hpp
new file mode 100644
index 0000000000..111f3a10d0
--- /dev/null
+++ b/boost/metaparse/v1/repeated.hpp
@@ -0,0 +1,27 @@
+#ifndef BOOST_METAPARSE_V1_REPEATED_HPP
+#define BOOST_METAPARSE_V1_REPEATED_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/foldl.hpp>
+#include <boost/metaparse/v1/impl/back_inserter.hpp>
+
+#include <boost/mpl/vector.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P>
+ struct repeated : foldl<P, boost::mpl::vector<>, impl::back_inserter> {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/repeated1.hpp b/boost/metaparse/v1/repeated1.hpp
new file mode 100644
index 0000000000..ea77b20385
--- /dev/null
+++ b/boost/metaparse/v1/repeated1.hpp
@@ -0,0 +1,29 @@
+#ifndef BOOST_METAPARSE_V1_REPEATED1_HPP
+#define BOOST_METAPARSE_V1_REPEATED1_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/foldl1.hpp>
+#include <boost/metaparse/v1/impl/back_inserter.hpp>
+
+#include <boost/mpl/vector.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P>
+ struct repeated1 :
+ foldl1<P, boost::mpl::vector<>, impl::back_inserter>
+ {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/repeated_one_of.hpp b/boost/metaparse/v1/repeated_one_of.hpp
new file mode 100644
index 0000000000..3296030b62
--- /dev/null
+++ b/boost/metaparse/v1/repeated_one_of.hpp
@@ -0,0 +1,45 @@
+#ifndef BOOST_METAPARSE_V1_REPEATED_ONE_OF_HPP
+#define BOOST_METAPARSE_V1_REPEATED_ONE_OF_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/limit_one_of_size.hpp>
+#include <boost/metaparse/v1/impl/one_of.hpp>
+#include <boost/metaparse/v1/repeated.hpp>
+
+#include <boost/mpl/vector.hpp>
+
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+ BOOST_METAPARSE_LIMIT_ONE_OF_SIZE,
+ class P,
+ boost::mpl::na
+ )
+ >
+ struct repeated_one_of :
+ repeated<
+ impl::one_of<
+ boost::mpl::vector<
+ BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_ONE_OF_SIZE, P)
+ >
+ >
+ >
+ {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/repeated_one_of1.hpp b/boost/metaparse/v1/repeated_one_of1.hpp
new file mode 100644
index 0000000000..2d305d2abd
--- /dev/null
+++ b/boost/metaparse/v1/repeated_one_of1.hpp
@@ -0,0 +1,45 @@
+#ifndef BOOST_METAPARSE_V1_REPEATED_ONE_OF1_HPP
+#define BOOST_METAPARSE_V1_REPEATED_ONE_OF1_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/limit_one_of_size.hpp>
+#include <boost/metaparse/v1/impl/one_of.hpp>
+#include <boost/metaparse/v1/repeated1.hpp>
+
+#include <boost/mpl/vector.hpp>
+
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+ BOOST_METAPARSE_LIMIT_ONE_OF_SIZE,
+ class P,
+ boost::mpl::na
+ )
+ >
+ struct repeated_one_of1 :
+ repeated1<
+ impl::one_of<
+ boost::mpl::vector<
+ BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_ONE_OF_SIZE, P)
+ >
+ >
+ >
+ {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/repeated_reject_incomplete.hpp b/boost/metaparse/v1/repeated_reject_incomplete.hpp
new file mode 100644
index 0000000000..ec82597949
--- /dev/null
+++ b/boost/metaparse/v1/repeated_reject_incomplete.hpp
@@ -0,0 +1,29 @@
+#ifndef BOOST_METAPARSE_V1_REPEATED_REJECT_INCOMPLETE_HPP
+#define BOOST_METAPARSE_V1_REPEATED_REJECT_INCOMPLETE_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/foldl_reject_incomplete.hpp>
+#include <boost/metaparse/v1/impl/back_inserter.hpp>
+
+#include <boost/mpl/vector.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P>
+ struct repeated_reject_incomplete :
+ foldl_reject_incomplete<P, boost::mpl::vector<>, impl::back_inserter>
+ {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/repeated_reject_incomplete1.hpp b/boost/metaparse/v1/repeated_reject_incomplete1.hpp
new file mode 100644
index 0000000000..e67ca8e8f1
--- /dev/null
+++ b/boost/metaparse/v1/repeated_reject_incomplete1.hpp
@@ -0,0 +1,29 @@
+#ifndef BOOST_METAPARSE_V1_REPEATED_REJECT_INCOMPLETE1_HPP
+#define BOOST_METAPARSE_V1_REPEATED_REJECT_INCOMPLETE1_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/foldl_reject_incomplete1.hpp>
+#include <boost/metaparse/v1/impl/back_inserter.hpp>
+
+#include <boost/mpl/vector.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P>
+ struct repeated_reject_incomplete1 :
+ foldl_reject_incomplete1<P, boost::mpl::vector<>, impl::back_inserter>
+ {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/return_.hpp b/boost/metaparse/v1/return_.hpp
new file mode 100644
index 0000000000..5333b106c6
--- /dev/null
+++ b/boost/metaparse/v1/return_.hpp
@@ -0,0 +1,34 @@
+#ifndef BOOST_METAPARSE_V1_RETURN__HPP
+#define BOOST_METAPARSE_V1_RETURN__HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/accept.hpp>
+#include <boost/metaparse/v1/get_result.hpp>
+
+
+#include <iostream>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class C>
+ struct return_
+ {
+ typedef return_ type;
+
+ template <class S, class Pos>
+ struct apply : accept<C, S, Pos> {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/sequence.hpp b/boost/metaparse/v1/sequence.hpp
new file mode 100644
index 0000000000..f25c632fbd
--- /dev/null
+++ b/boost/metaparse/v1/sequence.hpp
@@ -0,0 +1,64 @@
+#ifndef BOOST_METAPARSE_V1_SEQUENCE_HPP
+#define BOOST_METAPARSE_V1_SEQUENCE_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/impl/sequence.hpp>
+
+#include <boost/preprocessor/comma_if.hpp>
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+#include <boost/preprocessor/repetition/enum.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+#include <boost/preprocessor/arithmetic/sub.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/tuple/eat.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+ BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
+ class P,
+ boost::mpl::na
+ )
+ >
+ struct sequence;
+
+ #ifdef BOOST_METAPARSE_SEQUENCE_N
+ # error BOOST_METAPARSE_SEQUENCE_N already defined
+ #endif
+ #define BOOST_METAPARSE_SEQUENCE_N(z, n, unused) \
+ template <BOOST_PP_ENUM_PARAMS(n, class P)> \
+ struct sequence< \
+ BOOST_PP_ENUM_PARAMS(n, P) \
+ BOOST_PP_COMMA_IF(n) \
+ BOOST_PP_ENUM( \
+ BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE, n), \
+ boost::mpl::na BOOST_PP_TUPLE_EAT(3), \
+ ~ \
+ ) \
+ > : impl::BOOST_PP_CAT(sequence, n)<BOOST_PP_ENUM_PARAMS(n, P)> \
+ {};
+
+ BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
+ BOOST_METAPARSE_SEQUENCE_N,
+ ~
+ )
+
+ #undef BOOST_METAPARSE_SEQUENCE_N
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/sequence_apply.hpp b/boost/metaparse/v1/sequence_apply.hpp
new file mode 100644
index 0000000000..54ee03fa23
--- /dev/null
+++ b/boost/metaparse/v1/sequence_apply.hpp
@@ -0,0 +1,80 @@
+#ifndef BOOST_METAPARSE_V1_SEQUENCE_APPLY_HPP
+#define BOOST_METAPARSE_V1_SEQUENCE_APPLY_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/letter.hpp>
+#include <boost/metaparse/v1/sequence.hpp>
+
+#include <boost/metaparse/limit_sequence_size.hpp>
+
+#include <boost/mpl/at.hpp>
+
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+#include <boost/preprocessor/repetition/enum.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/tuple/eat.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+#ifdef BOOST_METAPARSE_SEQUENCE_APPLY_ARG
+# error BOOST_METAPARSE_SEQUENCE_APPLY_ARG already defined
+#endif
+#define BOOST_METAPARSE_SEQUENCE_APPLY_ARG(z, n, container) \
+ typename boost::mpl::at_c<container, n>::type
+
+#ifdef BOOST_METAPARSE_SEQUENCE_APPLY
+# error BOOST_METAPARSE_SEQUENCE_APPLY already defined
+#endif
+#define BOOST_METAPARSE_SEQUENCE_APPLY(z, n, unused) \
+ namespace impl \
+ { \
+ template < \
+ template <BOOST_PP_ENUM(n, class BOOST_PP_TUPLE_EAT(3), ~)> class T \
+ > \
+ struct BOOST_PP_CAT(sequence_apply_transform, n) \
+ { \
+ typedef BOOST_PP_CAT(sequence_apply_transform, n) type; \
+ \
+ template <class V> \
+ struct apply \
+ { \
+ typedef T<BOOST_PP_ENUM(n, BOOST_METAPARSE_SEQUENCE_APPLY_ARG, V)> type; \
+ }; \
+ }; \
+ } \
+ \
+ template < \
+ template <BOOST_PP_ENUM(n, class BOOST_PP_TUPLE_EAT(3), ~)> class T, \
+ BOOST_PP_ENUM_PARAMS(n, class P) \
+ > \
+ struct BOOST_PP_CAT(sequence_apply, n) : \
+ transform< \
+ sequence<BOOST_PP_ENUM_PARAMS(n, P)>, \
+ BOOST_PP_CAT(impl::sequence_apply_transform, n)<T> \
+ > \
+ {};
+
+ BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
+ BOOST_METAPARSE_SEQUENCE_APPLY,
+ ~
+ )
+
+#undef BOOST_METAPARSE_SEQUENCE_APPLY
+#undef BOOST_METAPARSE_SEQUENCE_APPLY_ARG
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/source_position.hpp b/boost/metaparse/v1/source_position.hpp
new file mode 100644
index 0000000000..3548940ea9
--- /dev/null
+++ b/boost/metaparse/v1/source_position.hpp
@@ -0,0 +1,156 @@
+#ifndef BOOST_METAPARSE_V1_SOURCE_POSITION_HPP
+#define BOOST_METAPARSE_V1_SOURCE_POSITION_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/fwd/source_position.hpp>
+#include <boost/metaparse/v1/source_position_tag.hpp>
+
+
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/equal_to.hpp>
+#include <boost/mpl/less.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class Line, class Col, class PrevChar>
+ struct source_position
+ {
+ typedef source_position_tag tag;
+ typedef source_position type;
+
+ typedef Line line;
+ typedef Col col;
+ typedef PrevChar prev_char;
+ };
+ }
+ }
+}
+
+namespace boost
+{
+ namespace mpl
+ {
+ template <class TagA, class TagB>
+ struct equal_to_impl;
+
+ template <>
+ struct equal_to_impl<
+ boost::metaparse::v1::source_position_tag,
+ boost::metaparse::v1::source_position_tag
+ >
+ {
+ typedef equal_to_impl type;
+
+ template <class A, class B>
+ struct apply :
+ bool_<
+ A::type::line::value == B::type::line::value
+ && A::type::col::value == B::type::col::value
+ && A::type::prev_char::value == B::type::prev_char::value
+ >
+ {};
+ };
+
+ template <class TagA, class TagB>
+ struct not_equal_to_impl;
+
+ template <>
+ struct not_equal_to_impl<
+ boost::metaparse::v1::source_position_tag,
+ boost::metaparse::v1::source_position_tag
+ >
+ {
+ typedef not_equal_to_impl type;
+
+ template <class A, class B>
+ struct apply : bool_<!equal_to<A, B>::type::value> {};
+ };
+
+ template <class TagA, class TagB>
+ struct less_impl;
+
+ template <>
+ struct less_impl<
+ boost::metaparse::v1::source_position_tag,
+ boost::metaparse::v1::source_position_tag
+ >
+ {
+ typedef less_impl type;
+
+ template <class A, class B>
+ struct apply :
+ bool_<(
+ (A::type::line::value) < (B::type::line::value) || (
+ (A::type::line::value) == (B::type::line::value) && (
+ (A::type::col::value) < (B::type::col::value) || (
+ (A::type::col::value) == (B::type::col::value) &&
+ (A::type::prev_char::value) < (B::type::prev_char::value)
+ )
+ )
+ )
+ )>
+ {};
+ };
+
+ template <class TagA, class TagB>
+ struct greater_impl;
+
+ template <>
+ struct greater_impl<
+ boost::metaparse::v1::source_position_tag,
+ boost::metaparse::v1::source_position_tag
+ >
+ {
+ typedef greater_impl type;
+
+ template <class A, class B>
+ struct apply :
+ bool_<!(less<A, B>::type::value || equal_to<A, B>::type::value)>
+ {};
+ };
+
+ template <class TagA, class TagB>
+ struct greater_equal_impl;
+
+ template <>
+ struct greater_equal_impl<
+ boost::metaparse::v1::source_position_tag,
+ boost::metaparse::v1::source_position_tag
+ >
+ {
+ typedef greater_equal_impl type;
+
+ template <class A, class B>
+ struct apply : bool_<!less<A, B>::type::value> {};
+ };
+
+ template <class TagA, class TagB>
+ struct less_equal_impl;
+
+ template <>
+ struct less_equal_impl<
+ boost::metaparse::v1::source_position_tag,
+ boost::metaparse::v1::source_position_tag
+ >
+ {
+ typedef less_equal_impl type;
+
+ template <class A, class B>
+ struct apply :
+ bool_<less<A, B>::type::value || equal_to<A, B>::type::value>
+ {};
+ };
+
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/source_position_tag.hpp b/boost/metaparse/v1/source_position_tag.hpp
new file mode 100644
index 0000000000..d0178bce35
--- /dev/null
+++ b/boost/metaparse/v1/source_position_tag.hpp
@@ -0,0 +1,80 @@
+#ifndef BOOST_METAPARSE_V1_SOURCE_POSITION_TAG_HPP
+#define BOOST_METAPARSE_V1_SOURCE_POSITION_TAG_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/fwd/source_position.hpp>
+#include <boost/metaparse/v1/fwd/get_prev_char.hpp>
+#include <boost/metaparse/v1/fwd/next_line.hpp>
+#include <boost/metaparse/v1/fwd/next_char.hpp>
+#include <boost/metaparse/v1/get_col.hpp>
+#include <boost/metaparse/v1/get_line.hpp>
+
+
+#include <boost/mpl/int.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ struct source_position_tag { typedef source_position_tag type; };
+
+ template <>
+ struct get_col_impl<source_position_tag>
+ {
+ template <class P>
+ struct apply : P::col {};
+ };
+
+ template <>
+ struct get_line_impl<source_position_tag>
+ {
+ template <class P>
+ struct apply : P::line {};
+ };
+
+
+ template <>
+ struct get_prev_char_impl<source_position_tag>
+ {
+ template <class P>
+ struct apply : P::prev_char {};
+ };
+
+
+ template <>
+ struct next_char_impl<source_position_tag>
+ {
+ template <class P, class Ch>
+ struct apply :
+ source_position<
+ typename get_line<P>::type,
+ boost::mpl::int_<get_col<P>::type::value + 1>,
+ Ch
+ >
+ {};
+ };
+
+ template <>
+ struct next_line_impl<source_position_tag>
+ {
+ template <class P, class Ch>
+ struct apply :
+ source_position<
+ boost::mpl::int_<get_line<P>::type::value + 1>,
+ boost::mpl::int_<1>,
+ Ch
+ >
+ {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/space.hpp b/boost/metaparse/v1/space.hpp
new file mode 100644
index 0000000000..dda377b422
--- /dev/null
+++ b/boost/metaparse/v1/space.hpp
@@ -0,0 +1,30 @@
+#ifndef BOOST_METAPARSE_V1_SPACE_HPP
+#define BOOST_METAPARSE_V1_SPACE_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/error/whitespace_expected.hpp>
+#include <boost/metaparse/v1/accept_when.hpp>
+#include <boost/metaparse/v1/one_char.hpp>
+
+#include <boost/metaparse/v1/util/is_whitespace.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ typedef
+ accept_when<one_char, util::is_whitespace<>, error::whitespace_expected>
+ space;
+ }
+ }
+}
+
+#endif
+
+
diff --git a/boost/metaparse/v1/spaces.hpp b/boost/metaparse/v1/spaces.hpp
new file mode 100644
index 0000000000..6d35ee7893
--- /dev/null
+++ b/boost/metaparse/v1/spaces.hpp
@@ -0,0 +1,24 @@
+#ifndef BOOST_METAPARSE_V1_SPACES_HPP
+#define BOOST_METAPARSE_V1_SPACES_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/repeated1.hpp>
+#include <boost/metaparse/v1/space.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ typedef repeated1<space> spaces;
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/start.hpp b/boost/metaparse/v1/start.hpp
new file mode 100644
index 0000000000..d38b897968
--- /dev/null
+++ b/boost/metaparse/v1/start.hpp
@@ -0,0 +1,32 @@
+#ifndef BOOST_METAPARSE_V1_START_HPP
+#define BOOST_METAPARSE_V1_START_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/source_position.hpp>
+
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/char.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ typedef
+ source_position<
+ boost::mpl::int_<1>,
+ boost::mpl::int_<1>,
+ boost::mpl::char_<0>
+ >
+ start;
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/string.hpp b/boost/metaparse/v1/string.hpp
new file mode 100644
index 0000000000..d72c28ec94
--- /dev/null
+++ b/boost/metaparse/v1/string.hpp
@@ -0,0 +1,408 @@
+#ifndef BOOST_METAPARSE_V1_STRING_HPP
+#define BOOST_METAPARSE_V1_STRING_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2012.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/config.hpp>
+#include <boost/metaparse/v1/fwd/string.hpp>
+#include <boost/metaparse/v1/string_tag.hpp>
+#include <boost/metaparse/v1/impl/string_iterator.hpp>
+#include <boost/metaparse/v1/impl/empty_string.hpp>
+#include <boost/metaparse/v1/impl/size.hpp>
+#include <boost/metaparse/v1/impl/pop_front.hpp>
+#include <boost/metaparse/v1/impl/push_front_c.hpp>
+#include <boost/metaparse/v1/impl/push_back_c.hpp>
+#include <boost/metaparse/v1/impl/pop_back.hpp>
+#include <boost/metaparse/v1/impl/assert_string_length.hpp>
+
+
+#include <boost/preprocessor/arithmetic/sub.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/repetition/enum.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+#include <boost/preprocessor/tuple/eat.hpp>
+
+#include <boost/type_traits/is_same.hpp>
+
+/*
+ * The string type
+ */
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+#ifdef BOOST_METAPARSE_VARIADIC_STRING
+ template <char... Cs>
+ struct string
+ {
+ typedef string type;
+ typedef string_tag tag;
+ };
+#else
+ template <BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, int C)>
+ struct string
+ {
+ typedef string type;
+ typedef string_tag tag;
+ };
+#endif
+ }
+ }
+}
+
+/*
+ * Boost.MPL overloads
+ */
+
+namespace boost
+{
+ namespace mpl
+ {
+ // push_back
+ template <class S>
+ struct push_back_impl;
+
+ template <>
+ struct push_back_impl<boost::metaparse::v1::string_tag>
+ {
+ typedef push_back_impl type;
+
+ template <class S, class C>
+ struct apply :
+ boost::metaparse::v1::impl::push_back_c<
+ typename S::type,
+ C::type::value
+ >
+ {};
+ };
+
+ // pop_back
+ template <class S>
+ struct pop_back_impl;
+
+ template <>
+ struct pop_back_impl<boost::metaparse::v1::string_tag>
+ {
+ typedef pop_back_impl type;
+
+ template <class S>
+ struct apply : boost::metaparse::v1::impl::pop_back<S> {};
+ };
+
+ // push_front
+ template <class S>
+ struct push_front_impl;
+
+ template <>
+ struct push_front_impl<boost::metaparse::v1::string_tag>
+ {
+ typedef push_front_impl type;
+
+ template <class S, class C>
+ struct apply :
+ boost::metaparse::v1::impl::push_front_c<
+ typename S::type,
+ C::type::value
+ >
+ {};
+ };
+
+ // pop_front
+ template <class S>
+ struct pop_front_impl;
+
+ template <>
+ struct pop_front_impl<boost::metaparse::v1::string_tag>
+ {
+ typedef pop_front_impl type;
+
+ template <class S>
+ struct apply : boost::metaparse::v1::impl::pop_front<S> {};
+ };
+
+ // clear
+ template <class S>
+ struct clear_impl;
+
+ template <>
+ struct clear_impl<boost::metaparse::v1::string_tag>
+ {
+ typedef clear_impl type;
+
+ template <class S>
+ struct apply : boost::metaparse::v1::string<> {};
+ };
+
+ // begin
+ template <class S>
+ struct begin_impl;
+
+ template <>
+ struct begin_impl<boost::metaparse::v1::string_tag>
+ {
+ typedef begin_impl type;
+
+ template <class S>
+ struct apply :
+ boost::metaparse::v1::impl::string_iterator<typename S::type, 0>
+ {};
+ };
+
+ // end
+ template <class S>
+ struct end_impl;
+
+ template <>
+ struct end_impl<boost::metaparse::v1::string_tag>
+ {
+ typedef end_impl type;
+
+ template <class S>
+ struct apply :
+ boost::metaparse::v1::impl::string_iterator<
+ typename S::type,
+ boost::metaparse::v1::impl::size<typename S::type>::type::value
+ >
+ {};
+ };
+
+ // equal_to
+ template <class A, class B>
+ struct equal_to_impl;
+
+ template <>
+ struct equal_to_impl<
+ boost::metaparse::v1::string_tag,
+ boost::metaparse::v1::string_tag
+ >
+ {
+ typedef equal_to_impl type;
+
+ template <class A, class B>
+ struct apply : boost::is_same<typename A::type, typename B::type> {};
+ };
+
+ template <class T>
+ struct equal_to_impl<boost::metaparse::v1::string_tag, T>
+ {
+ typedef equal_to_impl type;
+
+ template <class, class>
+ struct apply : false_ {};
+ };
+
+ template <class T>
+ struct equal_to_impl<T, boost::metaparse::v1::string_tag> :
+ equal_to_impl<boost::metaparse::v1::string_tag, T>
+ {};
+
+ // c_str
+ template <class S>
+ struct c_str;
+
+#ifdef BOOST_METAPARSE_VARIADIC_STRING
+ template <char... Cs>
+ struct c_str<boost::metaparse::v1::string<Cs...>>
+ {
+ typedef c_str type;
+ #ifdef BOOST_NO_CONSTEXPR_C_STR
+ static const char value[sizeof...(Cs) + 1];
+ #else
+ static constexpr char value[sizeof...(Cs) + 1] = {Cs..., 0};
+ #endif
+ };
+
+ template <>
+ struct c_str<boost::metaparse::v1::string<>> :
+ boost::metaparse::v1::impl::empty_string<>
+ {};
+
+ #ifdef BOOST_NO_CONSTEXPR_C_STR
+ template <char... Cs>
+ const char c_str<boost::metaparse::v1::string<Cs...>>::value[]
+ = {Cs..., 0};
+ #else
+ template <char... Cs>
+ constexpr char c_str<boost::metaparse::v1::string<Cs...>>::value[];
+ #endif
+
+#else
+ template <BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, int C)>
+ struct c_str<
+ boost::metaparse::v1::string<
+ BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, C)
+ >
+ >
+ {
+ typedef c_str type;
+ static BOOST_CONSTEXPR const char
+ value[BOOST_METAPARSE_LIMIT_STRING_SIZE + 1]
+ #if !defined BOOST_NO_CONSTEXPR && !defined BOOST_NO_CXX11_CONSTEXPR
+ = {BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, C), 0}
+ #endif
+ ;
+ };
+
+ template <BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, int C)>
+ BOOST_CONSTEXPR const char
+ c_str<
+ boost::metaparse::v1::string<
+ BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, C)
+ >
+ >::value[BOOST_METAPARSE_LIMIT_STRING_SIZE + 1]
+ #if defined BOOST_NO_CONSTEXPR || defined BOOST_NO_CXX11_CONSTEXPR
+ = {BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, C), 0}
+ #endif
+ ;
+
+ template <>
+ struct c_str<boost::metaparse::v1::string<> > :
+ boost::metaparse::v1::impl::empty_string<>
+ {
+ typedef c_str type;
+ };
+
+ #ifdef BOOST_METAPARSE_DEF
+ # error BOOST_METAPARSE_DEF already defined
+ #endif
+ #define BOOST_METAPARSE_DEF(n) \
+ = {BOOST_PP_ENUM_PARAMS(n, C) BOOST_PP_COMMA_IF(n) 0}
+
+ #ifdef BOOST_METAPARSE_STRING_DECLARE
+ # error BOOST_METAPARSE_STRING_DECLARE already defined
+ #endif
+ #ifdef BOOST_METAPARSE_STRING_DEFINE
+ # error BOOST_METAPARSE_STRING_DECLARE already defined
+ #endif
+ #if !defined BOOST_NO_CONSTEXPR && !defined BOOST_NO_CXX11_CONSTEXPR
+ # define BOOST_METAPARSE_STRING_DECLARE(n) BOOST_METAPARSE_DEF(n)
+ # define BOOST_METAPARSE_STRING_DEFINE(n)
+ #else
+ # define BOOST_METAPARSE_STRING_DECLARE(n)
+ # define BOOST_METAPARSE_STRING_DEFINE(n) BOOST_METAPARSE_DEF(n)
+ #endif
+
+ #ifdef BOOST_METAPARSE_STRING_CASE
+ # error BOOST_METAPARSE_STRING_CASE is already defined
+ #endif
+ #define BOOST_METAPARSE_STRING_CASE(z, n, unused) \
+ template <BOOST_PP_ENUM_PARAMS(n, int C)> \
+ struct \
+ c_str< \
+ boost::metaparse::v1::string< \
+ BOOST_PP_ENUM_PARAMS(n, C) BOOST_PP_COMMA_IF(n) \
+ BOOST_PP_ENUM( \
+ BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_STRING_SIZE, n), \
+ BOOST_NO_CHAR BOOST_PP_TUPLE_EAT(3), \
+ ~ \
+ ) \
+ > \
+ > \
+ { \
+ typedef c_str type; \
+ static BOOST_CONSTEXPR const char value[n + 1] \
+ BOOST_METAPARSE_STRING_DECLARE(n); \
+ }; \
+ \
+ template <BOOST_PP_ENUM_PARAMS(n, int C)> \
+ BOOST_CONSTEXPR const char c_str< \
+ boost::metaparse::v1::string< \
+ BOOST_PP_ENUM_PARAMS(n, C) BOOST_PP_COMMA_IF(n) \
+ BOOST_PP_ENUM( \
+ BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_STRING_SIZE, n), \
+ BOOST_NO_CHAR BOOST_PP_TUPLE_EAT(3), \
+ ~ \
+ ) \
+ > \
+ >::value[n + 1] BOOST_METAPARSE_STRING_DEFINE(n);
+
+ BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_METAPARSE_LIMIT_STRING_SIZE,
+ BOOST_METAPARSE_STRING_CASE,
+ ~
+ )
+
+ #undef BOOST_METAPARSE_STRING_CASE
+ #undef BOOST_METAPARSE_STRING_DECLARE
+ #undef BOOST_METAPARSE_STRING_DEFINE
+ #undef BOOST_METAPARSE_DEF
+#endif
+ }
+}
+
+/*
+ * The BOOST_METAPARSE_STRING macro
+ */
+
+#if \
+ !defined BOOST_NO_CONSTEXPR && !defined BOOST_NO_CXX11_CONSTEXPR \
+ && !defined BOOST_CONFIG_NO_BOOST_METAPARSE_STRING
+
+#include <boost/metaparse/v1/impl/remove_trailing_no_chars.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <int Len, class T>
+ constexpr int string_at(const T (&s)[Len], int n)
+ {
+ return n >= Len - 1 ? BOOST_NO_CHAR : s[n];
+ }
+ }
+ }
+ }
+}
+
+ #ifdef BOOST_METAPARSE_V1_STRING_N
+ # error BOOST_METAPARSE_V1_STRING_N already defined
+ #endif
+ #define BOOST_METAPARSE_V1_STRING_N(z, n, s) \
+ boost::metaparse::v1::impl::string_at((s), n)
+
+ #ifdef BOOST_METAPARSE_V1_STRING
+ # error BOOST_METAPARSE_V1_STRING already defined
+ #endif
+ #define BOOST_METAPARSE_V1_STRING(s) \
+ boost::metaparse::v1::impl::assert_string_length< \
+ sizeof(s) - 1, \
+ boost::metaparse::v1::impl::remove_trailing_no_chars< \
+ boost::metaparse::v1::string< \
+ BOOST_PP_ENUM( \
+ BOOST_METAPARSE_LIMIT_STRING_SIZE, \
+ BOOST_METAPARSE_V1_STRING_N, \
+ s \
+ ) \
+ > \
+ > \
+ >::type
+
+#else
+
+ // Include it only when it is needed
+ #include <boost/static_assert.hpp>
+
+ #ifdef BOOST_METAPARSE_V1_STRING
+ # error BOOST_METAPARSE_V1_STRING already defined
+ #endif
+ #define BOOST_METAPARSE_V1_STRING(s) \
+ BOOST_STATIC_ASSERT_MSG(false, "BOOST_METAPARSE_STRING is not supported")
+
+ #define BOOST_METAPARSE_V1_CONFIG_NO_BOOST_METAPARSE_STRING
+
+#endif
+
+#endif
+
diff --git a/boost/metaparse/v1/string_tag.hpp b/boost/metaparse/v1/string_tag.hpp
new file mode 100644
index 0000000000..f60a9fa731
--- /dev/null
+++ b/boost/metaparse/v1/string_tag.hpp
@@ -0,0 +1,24 @@
+#ifndef BOOST_METAPARSE_V1_STRING_TAG_HPP
+#define BOOST_METAPARSE_V1_STRING_TAG_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ struct string_tag
+ {
+ typedef string_tag type;
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/swap.hpp b/boost/metaparse/v1/swap.hpp
new file mode 100644
index 0000000000..b73ebf1b32
--- /dev/null
+++ b/boost/metaparse/v1/swap.hpp
@@ -0,0 +1,29 @@
+#ifndef BOOST_METAPARSE_V1_SWAP_HPP
+#define BOOST_METAPARSE_V1_SWAP_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class F>
+ struct swap
+ {
+ typedef swap type;
+
+ template <class A, class B>
+ struct apply : F::template apply<B, A> {};
+ };
+ }
+ }
+}
+
+#endif
+
+
diff --git a/boost/metaparse/v1/token.hpp b/boost/metaparse/v1/token.hpp
new file mode 100644
index 0000000000..5eef9a0bff
--- /dev/null
+++ b/boost/metaparse/v1/token.hpp
@@ -0,0 +1,28 @@
+#ifndef BOOST_METAPARSE_V1_TOKEN_HPP
+#define BOOST_METAPARSE_V1_TOKEN_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/space.hpp>
+#include <boost/metaparse/v1/repeated.hpp>
+#include <boost/metaparse/v1/first_of.hpp>
+
+#include <boost/mpl/void.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P>
+ struct token : first_of<P, repeated<space> > {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/transform.hpp b/boost/metaparse/v1/transform.hpp
new file mode 100644
index 0000000000..7573210a0c
--- /dev/null
+++ b/boost/metaparse/v1/transform.hpp
@@ -0,0 +1,50 @@
+#ifndef BOOST_METAPARSE_V1_TRANSFORM_HPP
+#define BOOST_METAPARSE_V1_TRANSFORM_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/accept.hpp>
+#include <boost/metaparse/v1/get_result.hpp>
+#include <boost/metaparse/v1/get_remaining.hpp>
+#include <boost/metaparse/v1/get_position.hpp>
+#include <boost/metaparse/v1/unless_error.hpp>
+
+#include <boost/mpl/eval_if.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class T>
+ struct transform
+ {
+ private:
+ template <class S, class Pos>
+ struct no_error :
+ accept<
+ typename T::template apply<
+ typename get_result<typename P::template apply<S, Pos> >::type
+ >::type,
+ get_remaining<typename P::template apply<S, Pos> >,
+ get_position<typename P::template apply<S, Pos> >
+ >
+ {};
+ public:
+ typedef transform type;
+
+ template <class S, class Pos>
+ struct apply :
+ unless_error<typename P::template apply<S, Pos>, no_error<S, Pos> >
+ {};
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/transform_error.hpp b/boost/metaparse/v1/transform_error.hpp
new file mode 100644
index 0000000000..87ce37b84b
--- /dev/null
+++ b/boost/metaparse/v1/transform_error.hpp
@@ -0,0 +1,40 @@
+#ifndef BOOST_METAPARSE_V1_TRANSFORM_ERROR_HPP
+#define BOOST_METAPARSE_V1_TRANSFORM_ERROR_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/is_error.hpp>
+
+#include <boost/mpl/eval_if.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class F>
+ struct transform_error
+ {
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::eval_if<
+ typename is_error<typename P::template apply<S, Pos> >::type,
+ typename F::template apply<
+ typename P::template apply<S, Pos>::type
+ >,
+ typename P::template apply<S, Pos>
+ >
+ {};
+
+ typedef transform_error type;
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/transform_error_message.hpp b/boost/metaparse/v1/transform_error_message.hpp
new file mode 100644
index 0000000000..7aba6c3bcb
--- /dev/null
+++ b/boost/metaparse/v1/transform_error_message.hpp
@@ -0,0 +1,49 @@
+#ifndef BOOST_METAPARSE_V1_TRANSFORM_ERROR_MESSAGE_HPP
+#define BOOST_METAPARSE_V1_TRANSFORM_ERROR_MESSAGE_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/is_error.hpp>
+#include <boost/metaparse/v1/reject.hpp>
+#include <boost/metaparse/v1/get_position.hpp>
+#include <boost/metaparse/v1/get_message.hpp>
+
+#include <boost/mpl/eval_if.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class P, class F>
+ struct transform_error_message
+ {
+ template <class R>
+ struct rejection :
+ reject<
+ typename F::template apply<typename get_message<R>::type>::type,
+ get_position<R>
+ >
+ {};
+
+ template <class S, class Pos>
+ struct apply :
+ boost::mpl::eval_if<
+ typename is_error<typename P::template apply<S, Pos> >::type,
+ rejection<typename P::template apply<S, Pos> >,
+ typename P::template apply<S, Pos>
+ >
+ {};
+
+ typedef transform_error_message type;
+ };
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/unless_error.hpp b/boost/metaparse/v1/unless_error.hpp
new file mode 100644
index 0000000000..0578cd41b2
--- /dev/null
+++ b/boost/metaparse/v1/unless_error.hpp
@@ -0,0 +1,29 @@
+#ifndef BOOST_METAPARSE_V1_UTIL_UNLESS_ERROR_HPP
+#define BOOST_METAPARSE_V1_UTIL_UNLESS_ERROR_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/is_error.hpp>
+
+#include <boost/mpl/equal_to.hpp>
+#include <boost/mpl/eval_if.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class T, class NotErrorCase>
+ struct unless_error :
+ boost::mpl::eval_if<typename is_error<T>::type, T, NotErrorCase>
+ {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/util/digit_to_int.hpp b/boost/metaparse/v1/util/digit_to_int.hpp
new file mode 100644
index 0000000000..5ec885bbd1
--- /dev/null
+++ b/boost/metaparse/v1/util/digit_to_int.hpp
@@ -0,0 +1,38 @@
+#ifndef BOOST_METAPARSE_V1_UTIL_DIGIT_TO_INT_HPP
+#define BOOST_METAPARSE_V1_UTIL_DIGIT_TO_INT_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/util/digit_to_int_c.hpp>
+
+#include <boost/mpl/vector.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace util
+ {
+ template <class D = boost::mpl::na>
+ struct digit_to_int : digit_to_int_c<D::type::value> {};
+
+ template <>
+ struct digit_to_int<boost::mpl::na>
+ {
+ typedef digit_to_int type;
+
+ template <class D = boost::mpl::na>
+ struct apply : digit_to_int<D> {};
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/util/digit_to_int_c.hpp b/boost/metaparse/v1/util/digit_to_int_c.hpp
new file mode 100644
index 0000000000..51cc13d915
--- /dev/null
+++ b/boost/metaparse/v1/util/digit_to_int_c.hpp
@@ -0,0 +1,40 @@
+#ifndef BOOST_METAPARSE_V1_UTIL_DIGIT_TO_INT_C_HPP
+#define BOOST_METAPARSE_V1_UTIL_DIGIT_TO_INT_C_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/error/digit_expected.hpp>
+
+#include <boost/mpl/int.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace util
+ {
+ template <char C>
+ struct digit_to_int_c : error::digit_expected {};
+
+ template <> struct digit_to_int_c<'0'> : boost::mpl::int_<0> {};
+ template <> struct digit_to_int_c<'1'> : boost::mpl::int_<1> {};
+ template <> struct digit_to_int_c<'2'> : boost::mpl::int_<2> {};
+ template <> struct digit_to_int_c<'3'> : boost::mpl::int_<3> {};
+ template <> struct digit_to_int_c<'4'> : boost::mpl::int_<4> {};
+ template <> struct digit_to_int_c<'5'> : boost::mpl::int_<5> {};
+ template <> struct digit_to_int_c<'6'> : boost::mpl::int_<6> {};
+ template <> struct digit_to_int_c<'7'> : boost::mpl::int_<7> {};
+ template <> struct digit_to_int_c<'8'> : boost::mpl::int_<8> {};
+ template <> struct digit_to_int_c<'9'> : boost::mpl::int_<9> {};
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/util/in_range.hpp b/boost/metaparse/v1/util/in_range.hpp
new file mode 100644
index 0000000000..a4baba073c
--- /dev/null
+++ b/boost/metaparse/v1/util/in_range.hpp
@@ -0,0 +1,75 @@
+#ifndef BOOST_METAPARSE_V1_UTIL_IN_RANGE_HPP
+#define BOOST_METAPARSE_V1_UTIL_IN_RANGE_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/mpl/less_equal.hpp>
+#include <boost/mpl/comparison.hpp>
+#include <boost/mpl/quote.hpp>
+#include <boost/mpl/bool.hpp>
+
+#include <boost/mpl/vector.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace util
+ {
+ template <
+ class LowerBound = boost::mpl::na,
+ class UpperBound = boost::mpl::na,
+ class Item = boost::mpl::na
+ >
+ struct in_range :
+ boost::mpl::bool_<
+ boost::mpl::less_equal<LowerBound, Item>::type::value
+ && boost::mpl::less_equal<Item, UpperBound>::type::value
+ >
+ {};
+
+ template <class LowerBound, class UpperBound>
+ struct in_range<LowerBound, UpperBound, boost::mpl::na>
+ {
+ typedef in_range type;
+
+ template <class Item = boost::mpl::na>
+ struct apply : in_range<LowerBound, UpperBound, Item> {};
+ };
+
+ template <class LowerBound>
+ struct in_range<LowerBound, boost::mpl::na, boost::mpl::na>
+ {
+ typedef in_range type;
+
+ template <
+ class UpperBound = boost::mpl::na,
+ class Item = boost::mpl::na
+ >
+ struct apply : in_range<LowerBound, UpperBound, Item> {};
+ };
+
+ template <>
+ struct in_range<boost::mpl::na, boost::mpl::na, boost::mpl::na>
+ {
+ typedef in_range type;
+
+ template <
+ class LowerBound = boost::mpl::na,
+ class UpperBound = boost::mpl::na,
+ class Item = boost::mpl::na
+ >
+ struct apply : in_range<LowerBound, UpperBound, Item> {};
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/util/in_range_c.hpp b/boost/metaparse/v1/util/in_range_c.hpp
new file mode 100644
index 0000000000..21fde89871
--- /dev/null
+++ b/boost/metaparse/v1/util/in_range_c.hpp
@@ -0,0 +1,38 @@
+#ifndef BOOST_METAPARSE_V1_UTIL_IN_RANGE_C_HPP
+#define BOOST_METAPARSE_V1_UTIL_IN_RANGE_C_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/mpl/bool.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace util
+ {
+ template <class T, T LowerBound, T UpperBound>
+ struct in_range_c
+ {
+ typedef in_range_c type;
+
+ template <class Item>
+ struct apply :
+ boost::mpl::bool_<(
+ LowerBound <= Item::type::value
+ && Item::type::value <= UpperBound
+ )>
+ {};
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/util/int_to_digit.hpp b/boost/metaparse/v1/util/int_to_digit.hpp
new file mode 100644
index 0000000000..0e093e9de3
--- /dev/null
+++ b/boost/metaparse/v1/util/int_to_digit.hpp
@@ -0,0 +1,38 @@
+#ifndef BOOST_METAPARSE_V1_UTIL_INT_TO_DIGIT_HPP
+#define BOOST_METAPARSE_V1_UTIL_INT_TO_DIGIT_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2012.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/util/int_to_digit_c.hpp>
+
+#include <boost/mpl/vector.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace util
+ {
+ template <class N = boost::mpl::na>
+ struct int_to_digit : int_to_digit_c<N::type::value> {};
+
+ template <>
+ struct int_to_digit<boost::mpl::na>
+ {
+ typedef int_to_digit type;
+
+ template <class N = boost::mpl::na>
+ struct apply : int_to_digit<N> {};
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/util/int_to_digit_c.hpp b/boost/metaparse/v1/util/int_to_digit_c.hpp
new file mode 100644
index 0000000000..2742e330b6
--- /dev/null
+++ b/boost/metaparse/v1/util/int_to_digit_c.hpp
@@ -0,0 +1,38 @@
+#ifndef BOOST_METAPARSE_V1_UTIL_INT_TO_DIGIT_C_HPP
+#define BOOST_METAPARSE_V1_UTIL_INT_TO_DIGIT_C_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/mpl/char.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace util
+ {
+ template <int N>
+ struct int_to_digit_c;
+
+ template <> struct int_to_digit_c<0> : boost::mpl::char_<'0'> {};
+ template <> struct int_to_digit_c<1> : boost::mpl::char_<'1'> {};
+ template <> struct int_to_digit_c<2> : boost::mpl::char_<'2'> {};
+ template <> struct int_to_digit_c<3> : boost::mpl::char_<'3'> {};
+ template <> struct int_to_digit_c<4> : boost::mpl::char_<'4'> {};
+ template <> struct int_to_digit_c<5> : boost::mpl::char_<'5'> {};
+ template <> struct int_to_digit_c<6> : boost::mpl::char_<'6'> {};
+ template <> struct int_to_digit_c<7> : boost::mpl::char_<'7'> {};
+ template <> struct int_to_digit_c<8> : boost::mpl::char_<'8'> {};
+ template <> struct int_to_digit_c<9> : boost::mpl::char_<'9'> {};
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/util/is_digit.hpp b/boost/metaparse/v1/util/is_digit.hpp
new file mode 100644
index 0000000000..ccc9b456f0
--- /dev/null
+++ b/boost/metaparse/v1/util/is_digit.hpp
@@ -0,0 +1,38 @@
+#ifndef BOOST_METAPARSE_V1_UTIL_IS_DIGIT_HPP
+#define BOOST_METAPARSE_V1_UTIL_IS_DIGIT_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/util/in_range_c.hpp>
+
+#include <boost/mpl/vector.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace util
+ {
+ template <class C = boost::mpl::na>
+ struct is_digit : in_range_c<char, '0', '9'>::apply<C> {};
+
+ template <>
+ struct is_digit<boost::mpl::na>
+ {
+ typedef is_digit type;
+
+ template <class C = boost::mpl::na>
+ struct apply : is_digit<C> {};
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/util/is_lcase_letter.hpp b/boost/metaparse/v1/util/is_lcase_letter.hpp
new file mode 100644
index 0000000000..9c05b48208
--- /dev/null
+++ b/boost/metaparse/v1/util/is_lcase_letter.hpp
@@ -0,0 +1,38 @@
+#ifndef BOOST_METAPARSE_V1_UTIL_IS_LCASE_LETTER_HPP
+#define BOOST_METAPARSE_V1_UTIL_IS_LCASE_LETTER_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/util/in_range_c.hpp>
+
+#include <boost/mpl/vector.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace util
+ {
+ template <class C = boost::mpl::na>
+ struct is_lcase_letter : in_range_c<char, 'a', 'z'>::apply<C> {};
+
+ template <>
+ struct is_lcase_letter<boost::mpl::na>
+ {
+ typedef is_lcase_letter type;
+
+ template <class C = boost::mpl::na>
+ struct apply : is_lcase_letter<C> {};
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/util/is_letter.hpp b/boost/metaparse/v1/util/is_letter.hpp
new file mode 100644
index 0000000000..a3bc3114a7
--- /dev/null
+++ b/boost/metaparse/v1/util/is_letter.hpp
@@ -0,0 +1,44 @@
+#ifndef BOOST_METAPARSE_V1_UTIL_IS_LETTER_HPP
+#define BOOST_METAPARSE_V1_UTIL_IS_LETTER_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/util/is_ucase_letter.hpp>
+#include <boost/metaparse/v1/util/is_lcase_letter.hpp>
+
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/vector.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace util
+ {
+ template <class C = boost::mpl::na>
+ struct is_letter :
+ boost::mpl::bool_<
+ is_lcase_letter<C>::type::value || is_ucase_letter<C>::type::value
+ >
+ {};
+
+ template <>
+ struct is_letter<boost::mpl::na>
+ {
+ typedef is_letter type;
+
+ template <class C = boost::mpl::na>
+ struct apply : is_letter<C> {};
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/util/is_ucase_letter.hpp b/boost/metaparse/v1/util/is_ucase_letter.hpp
new file mode 100644
index 0000000000..37926b6075
--- /dev/null
+++ b/boost/metaparse/v1/util/is_ucase_letter.hpp
@@ -0,0 +1,38 @@
+#ifndef BOOST_METAPARSE_V1_UTIL_IS_UCASE_LETTER_HPP
+#define BOOST_METAPARSE_V1_UTIL_IS_UCASE_LETTER_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/util/in_range_c.hpp>
+
+#include <boost/mpl/vector.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace util
+ {
+ template <class C = boost::mpl::na>
+ struct is_ucase_letter : in_range_c<char, 'A', 'Z'>::apply<C> {};
+
+ template <>
+ struct is_ucase_letter<boost::mpl::na>
+ {
+ typedef is_ucase_letter type;
+
+ template <class C = boost::mpl::na>
+ struct apply : is_ucase_letter<C> {};
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/util/is_whitespace.hpp b/boost/metaparse/v1/util/is_whitespace.hpp
new file mode 100644
index 0000000000..93940fd8fb
--- /dev/null
+++ b/boost/metaparse/v1/util/is_whitespace.hpp
@@ -0,0 +1,38 @@
+#ifndef BOOST_METAPARSE_V1_UTIL_IS_WHITESPACE_HPP
+#define BOOST_METAPARSE_V1_UTIL_IS_WHITESPACE_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/util/is_whitespace_c.hpp>
+
+#include <boost/mpl/vector.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace util
+ {
+ template <class C = boost::mpl::na>
+ struct is_whitespace : is_whitespace_c<C::type::value> {};
+
+ template <>
+ struct is_whitespace<boost::mpl::na>
+ {
+ typedef is_whitespace type;
+
+ template <class C = boost::mpl::na>
+ struct apply : is_whitespace<C> {};
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/util/is_whitespace_c.hpp b/boost/metaparse/v1/util/is_whitespace_c.hpp
new file mode 100644
index 0000000000..b37ab7cbc6
--- /dev/null
+++ b/boost/metaparse/v1/util/is_whitespace_c.hpp
@@ -0,0 +1,32 @@
+#ifndef BOOST_METAPARSE_V1_UTIL_IS_WHITESPACE_C_HPP
+#define BOOST_METAPARSE_V1_UTIL_IS_WHITESPACE_C_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/mpl/bool.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace util
+ {
+ template <char C>
+ struct is_whitespace_c : boost::mpl::false_ {};
+
+ template <> struct is_whitespace_c<' '> : boost::mpl::true_ {};
+ template <> struct is_whitespace_c<'\r'> : boost::mpl::true_ {};
+ template <> struct is_whitespace_c<'\n'> : boost::mpl::true_ {};
+ template <> struct is_whitespace_c<'\t'> : boost::mpl::true_ {};
+ }
+ }
+ }
+}
+
+#endif
+