1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

fix weed type_traits

This commit is contained in:
bolero-MURAKAMI 2013-03-25 12:43:47 +09:00
parent f712788cce
commit c78e1d0e6d
27 changed files with 279 additions and 306 deletions

View file

@ -3,6 +3,7 @@
#include <cstddef>
#include <sprout/config.hpp>
#include <sprout/type_traits/identity.hpp>
#include <sprout/weed/unused.hpp>
#include <sprout/weed/parser_result.hpp>
#include <sprout/weed/parser/parser_base.hpp>
@ -17,15 +18,13 @@ namespace sprout {
{
public:
template<typename Context, typename Iterator>
struct attribute {
public:
typedef sprout::weed::unused type;
};
struct attribute
: public sprout::identity<sprout::weed::unused>
{};
template<typename Context, typename Iterator>
struct result {
public:
typedef sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> type;
};
struct result
: public sprout::identity<sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> >
{};
public:
template<typename Context, typename Iterator>
SPROUT_CONSTEXPR typename result<Context, Iterator>::type operator()(

View file

@ -4,6 +4,7 @@
#include <cstddef>
#include <sprout/config.hpp>
#include <sprout/iterator/next.hpp>
#include <sprout/type_traits/identity.hpp>
#include <sprout/weed/unused.hpp>
#include <sprout/weed/parser_result.hpp>
#include <sprout/weed/parser/parser_base.hpp>
@ -18,15 +19,13 @@ namespace sprout {
{
public:
template<typename Context, typename Iterator>
struct attribute {
public:
typedef sprout::weed::unused type;
};
struct attribute
: public sprout::identity<sprout::weed::unused>
{};
template<typename Context, typename Iterator>
struct result {
public:
typedef sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> type;
};
struct result
: public sprout::identity<sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> >
{};
public:
template<typename Context, typename Iterator>
SPROUT_CONSTEXPR typename result<Context, Iterator>::type operator()(

View file

@ -3,6 +3,7 @@
#include <cstddef>
#include <sprout/config.hpp>
#include <sprout/type_traits/identity.hpp>
#include <sprout/weed/unused.hpp>
#include <sprout/weed/parser_result.hpp>
#include <sprout/weed/parser/parser_base.hpp>
@ -17,15 +18,13 @@ namespace sprout {
{
public:
template<typename Context, typename Iterator>
struct attribute {
public:
typedef sprout::weed::unused type;
};
struct attribute
: public sprout::identity<sprout::weed::unused>
{};
template<typename Context, typename Iterator>
struct result {
public:
typedef sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> type;
};
struct result
: public sprout::identity<sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> >
{};
public:
template<typename Context, typename Iterator>
SPROUT_CONSTEXPR typename result<Context, Iterator>::type operator()(

View file

@ -5,6 +5,7 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/iterator/next.hpp>
#include <sprout/type_traits/identity.hpp>
#include <sprout/weed/unused.hpp>
#include <sprout/weed/parser_result.hpp>
#include <sprout/weed/parser/parser_base.hpp>
@ -22,15 +23,13 @@ namespace sprout {
{
public:
template<typename Context, typename Iterator>
struct attribute {
public:
typedef sprout::weed::unused type;
};
struct attribute
: public sprout::identity<sprout::weed::unused>
{};
template<typename Context, typename Iterator>
struct result {
public:
typedef sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> type;
};
struct result
: public sprout::identity<sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> >
{};
private:
T t_;
public:
@ -81,15 +80,13 @@ namespace sprout {
{
public:
template<typename Context, typename Iterator>
struct attribute {
public:
typedef typename std::iterator_traits<Iterator>::value_type type;
};
struct attribute
: public sprout::identity<typename std::iterator_traits<Iterator>::value_type>
{};
template<typename Context, typename Iterator>
struct result {
public:
typedef sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> type;
};
struct result
: public sprout::identity<sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> >
{};
private:
T t_;
public:
@ -122,15 +119,13 @@ namespace sprout {
{
public:
template<typename Context, typename Iterator>
struct attribute {
public:
typedef typename std::iterator_traits<Iterator>::value_type type;
};
struct attribute
: public sprout::identity<typename std::iterator_traits<Iterator>::value_type>
{};
template<typename Context, typename Iterator>
struct result {
public:
typedef sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> type;
};
struct result
: public sprout::identity<sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> >
{};
public:
template<typename Context, typename Iterator>
SPROUT_CONSTEXPR typename result<Context, Iterator>::type operator()(

View file

@ -5,6 +5,7 @@
#include <sprout/config.hpp>
#include <sprout/iterator/next.hpp>
#include <sprout/ctype/ascii.hpp>
#include <sprout/type_traits/identity.hpp>
#include <sprout/weed/unused.hpp>
#include <sprout/weed/parser_result.hpp>
#include <sprout/weed/parser/parser_base.hpp>
@ -18,19 +19,17 @@ namespace sprout {
{ \
public: \
template<typename Context, typename Iterator> \
struct attribute { \
public: \
typedef typename std::conditional< \
struct attribute \
: public std::conditional< \
Nil, \
sprout::weed::unused, \
typename std::iterator_traits<Iterator>::value_type \
>::type type; \
}; \
> \
{}; \
template<typename Context, typename Iterator> \
struct result { \
public: \
typedef sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> type; \
}; \
struct result \
: public sprout::identity<sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> > \
{}; \
public: \
template<typename Context, typename Iterator> \
SPROUT_CONSTEXPR typename result<Context, Iterator>::type operator()( \

View file

@ -4,6 +4,7 @@
#include <cstddef>
#include <sprout/config.hpp>
#include <sprout/array/array.hpp>
#include <sprout/type_traits/identity.hpp>
#include <sprout/weed/parser_result.hpp>
#include <sprout/weed/expr/make_terminal_or_expr.hpp>
#include <sprout/weed/expr/eval.hpp>
@ -32,10 +33,9 @@ namespace sprout {
typedef sprout::array<attr_type, 1> type;
};
template<typename Context, typename Iterator>
struct result {
public:
typedef sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> type;
};
struct result
: public sprout::identity<sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> >
{};
private:
typedef typename sprout::weed::traits::terminal_or_expr_of<Parser>::type expr_type;
private:

View file

@ -4,6 +4,7 @@
#include <cstddef>
#include <sprout/config.hpp>
#include <sprout/tuple/tuple.hpp>
#include <sprout/type_traits/identity.hpp>
#include <sprout/weed/parser_result.hpp>
#include <sprout/weed/expr/make_terminal_or_expr.hpp>
#include <sprout/weed/expr/eval.hpp>
@ -32,10 +33,9 @@ namespace sprout {
typedef sprout::tuples::tuple<attr_type> type;
};
template<typename Context, typename Iterator>
struct result {
public:
typedef sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> type;
};
struct result
: public sprout::identity<sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> >
{};
private:
typedef typename sprout::weed::traits::terminal_or_expr_of<Parser>::type expr_type;
private:

View file

@ -3,6 +3,7 @@
#include <cstddef>
#include <sprout/config.hpp>
#include <sprout/type_traits/identity.hpp>
#include <sprout/weed/unused.hpp>
#include <sprout/weed/parser_result.hpp>
#include <sprout/weed/expr/make_terminal_or_expr.hpp>
@ -22,15 +23,13 @@ namespace sprout {
{
public:
template<typename Context, typename Iterator>
struct attribute {
public:
typedef sprout::weed::unused type;
};
struct attribute
: public sprout::identity<sprout::weed::unused>
{};
template<typename Context, typename Iterator>
struct result {
public:
typedef sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> type;
};
struct result
: public sprout::identity<sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> >
{};
private:
typedef typename sprout::weed::traits::terminal_or_expr_of<Parser>::type expr_type;
private:

View file

@ -3,6 +3,7 @@
#include <cstddef>
#include <sprout/config.hpp>
#include <sprout/type_traits/identity.hpp>
#include <sprout/weed/parser_result.hpp>
#include <sprout/weed/expr/make_terminal_or_expr.hpp>
#include <sprout/weed/expr/eval.hpp>
@ -142,18 +143,16 @@ namespace sprout {
};
public:
template<typename Context, typename Iterator>
struct attribute {
public:
typedef typename sprout::weed::attr_cnv::result_of::times<
struct attribute
: public sprout::weed::attr_cnv::result_of::times<
sprout::weed::traits::limit_of<Parser, Iterator, Context>::value,
typename sprout::weed::traits::attribute_of<Parser, Iterator, Context>::type
>::type type;
};
>
{};
template<typename Context, typename Iterator>
struct result {
public:
typedef sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> type;
};
struct result
: public sprout::identity<sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> >
{};
private:
typedef typename sprout::weed::traits::terminal_or_expr_of<Parser>::type expr_type;
private:

View file

@ -3,6 +3,7 @@
#include <cstddef>
#include <sprout/config.hpp>
#include <sprout/type_traits/identity.hpp>
#include <sprout/weed/unused.hpp>
#include <sprout/weed/parser_result.hpp>
#include <sprout/weed/expr/make_terminal_or_expr.hpp>
@ -23,15 +24,13 @@ namespace sprout {
public:
typedef T value_type;
template<typename Context, typename Iterator>
struct attribute {
public:
typedef value_type type;
};
struct attribute
: public sprout::identity<value_type>
{};
template<typename Context, typename Iterator>
struct result {
public:
typedef sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> type;
};
struct result
: public sprout::identity<sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> >
{};
private:
typedef typename sprout::weed::traits::terminal_or_expr_of<Parser>::type expr_type;
private:

View file

@ -3,6 +3,7 @@
#include <cstddef>
#include <sprout/config.hpp>
#include <sprout/type_traits/identity.hpp>
#include <sprout/weed/parser_result.hpp>
#include <sprout/weed/limited.hpp>
#include <sprout/weed/expr/make_terminal_or_expr.hpp>
@ -25,15 +26,13 @@ namespace sprout {
SPROUT_STATIC_CONSTEXPR std::size_t limit = Limit;
public:
template<typename Context, typename Iterator>
struct attribute {
public:
typedef typename sprout::weed::traits::attribute_of<Parser, Iterator, Context>::type type;
};
struct attribute
: public sprout::weed::traits::attribute_of<Parser, Iterator, Context>
{};
template<typename Context, typename Iterator>
struct result {
public:
typedef sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> type;
};
struct result
: public sprout::identity<sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> >
{};
private:
typedef typename sprout::weed::traits::terminal_or_expr_of<Parser>::type expr_type;
private:

View file

@ -6,6 +6,7 @@
#include <sprout/iterator/next.hpp>
#include <sprout/tuple/tuple.hpp>
#include <sprout/integer/integer_digits.hpp>
#include <sprout/type_traits/identity.hpp>
#include <sprout/weed/unused.hpp>
#include <sprout/weed/parser_result.hpp>
#include <sprout/weed/parser/parser_base.hpp>
@ -32,15 +33,13 @@ namespace sprout {
;
public:
template<typename Context, typename Iterator>
struct attribute {
public:
typedef IntType type;
};
struct attribute
: public sprout::identity<IntType>
{};
template<typename Context, typename Iterator>
struct result {
public:
typedef sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> type;
};
struct result
: public sprout::identity<sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> >
{};
private:
template<typename Context, typename Iterator>
SPROUT_CONSTEXPR typename result<Context, Iterator>::type make_result(

View file

@ -6,6 +6,7 @@
#include <sprout/iterator/next.hpp>
#include <sprout/tuple/tuple.hpp>
#include <sprout/integer/integer_digits.hpp>
#include <sprout/type_traits/identity.hpp>
#include <sprout/weed/unused.hpp>
#include <sprout/weed/parser_result.hpp>
#include <sprout/weed/parser/parser_base.hpp>
@ -32,15 +33,13 @@ namespace sprout {
;
public:
template<typename Context, typename Iterator>
struct attribute {
public:
typedef UIntType type;
};
struct attribute
: public sprout::identity<UIntType>
{};
template<typename Context, typename Iterator>
struct result {
public:
typedef sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> type;
};
struct result
: public sprout::identity<sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> >
{};
private:
template<typename Context, typename Iterator>
SPROUT_CONSTEXPR typename result<Context, Iterator>::type make_result(

View file

@ -9,6 +9,7 @@
#include <sprout/container/size.hpp>
#include <sprout/iterator/operation.hpp>
#include <sprout/algorithm/equal.hpp>
#include <sprout/type_traits/identity.hpp>
#include <sprout/weed/unused.hpp>
#include <sprout/weed/parser_result.hpp>
#include <sprout/weed/parser/parser_base.hpp>
@ -27,15 +28,13 @@ namespace sprout {
{
public:
template<typename Context, typename Iterator>
struct attribute {
public:
typedef sprout::weed::unused type;
};
struct attribute
: public sprout::identity<sprout::weed::unused>
{};
template<typename Context, typename Iterator>
struct result {
public:
typedef sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> type;
};
struct result
: public sprout::identity<sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> >
{};
private:
T t_;
public:
@ -102,15 +101,13 @@ namespace sprout {
{
public:
template<typename Context, typename Iterator>
struct attribute {
public:
typedef T type;
};
struct attribute
: public sprout::identity<T>
{};
template<typename Context, typename Iterator>
struct result {
public:
typedef sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> type;
};
struct result
: public sprout::identity<sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> >
{};
private:
T t_;
public: