stabilize build system: depends, installer, boost/bdb fixes, cross targets groundwork
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+29
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
+29
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+30
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+58
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+55
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+44
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+24
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+57
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
#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 <class S>
|
||||
struct split_at_c<0, S> : boost::mpl::pair<string<>, S> {};
|
||||
#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
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,41 @@
|
||||
#ifndef BOOST_METAPARSE_V1_IMPL_STRING_AT_HPP
|
||||
#define BOOST_METAPARSE_V1_IMPL_STRING_AT_HPP
|
||||
|
||||
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2016.
|
||||
// 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/static_assert.hpp>
|
||||
#include <boost/metaparse/v1/impl/no_char.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace metaparse
|
||||
{
|
||||
namespace v1
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <int MaxLen, int Len, class T>
|
||||
BOOST_CONSTEXPR int string_at(const T (&s)[Len], int n)
|
||||
{
|
||||
// "MaxLen + 1" adds the \0 character of the string literal to the
|
||||
// limit
|
||||
BOOST_STATIC_ASSERT((Len <= MaxLen + 1));
|
||||
return n >= Len - 1 ? BOOST_NO_CHAR : s[n];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BOOST_METAPARSE_V1_STRING_AT
|
||||
# error BOOST_METAPARSE_V1_STRING_AT already defined
|
||||
#endif
|
||||
#define BOOST_METAPARSE_V1_STRING_AT \
|
||||
::boost::metaparse::v1::impl::string_at<BOOST_METAPARSE_LIMIT_STRING_SIZE>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user