mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
weed::traits::attribute_of をコンテキストに依存するよう変更
This commit is contained in:
parent
a7698fa6e9
commit
1c898f8b93
13 changed files with 64 additions and 79 deletions
|
@ -10,12 +10,8 @@
|
|||
#include <sprout/weed/traits/type/is_c_str.hpp>
|
||||
#include <sprout/weed/traits/type/is_string.hpp>
|
||||
#include <sprout/weed/traits/expr/is_expr.hpp>
|
||||
#include <sprout/weed/traits/expr/terminal_of.hpp>
|
||||
#include <sprout/weed/traits/parser/is_parser.hpp>
|
||||
#include <sprout/weed/traits/parser/limit_of.hpp>
|
||||
#include <sprout/weed/attr_cnv/result_of/times.hpp>
|
||||
#include <sprout/weed/attr_cnv/result_of/shift_left.hpp>
|
||||
#include <sprout/weed/attr_cnv/result_of/modulus.hpp>
|
||||
#include <sprout/weed/attr_cnv/result_of/bitwise_or.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace weed {
|
||||
|
@ -46,6 +42,18 @@ namespace sprout {
|
|||
typedef typename T::template attribute<Context, Iterator>::type type;
|
||||
};
|
||||
template<typename T, typename Iterator, typename Context>
|
||||
struct attribute_of<
|
||||
T,
|
||||
Iterator,
|
||||
Context,
|
||||
typename std::enable_if<
|
||||
sprout::weed::traits::is_expr<T>::value
|
||||
>::type
|
||||
> {
|
||||
public:
|
||||
typedef typename Context::template eval<T>::attribute_type type;
|
||||
};
|
||||
template<typename T, typename Iterator, typename Context>
|
||||
struct attribute_of<
|
||||
T,
|
||||
Iterator,
|
||||
|
@ -55,68 +63,11 @@ namespace sprout {
|
|||
|| sprout::weed::traits::is_c_str<T>::value
|
||||
|| sprout::weed::traits::is_string<T>::value
|
||||
>::type
|
||||
> {
|
||||
public:
|
||||
typedef sprout::weed::unused type;
|
||||
};
|
||||
template<typename Arg, typename Iterator, typename Context>
|
||||
struct attribute_of<sprout::weed::expr<sprout::weed::tag::terminal, Arg>, Iterator, Context>
|
||||
: public sprout::weed::traits::attribute_of<Arg, Iterator, Context>
|
||||
{};
|
||||
template<typename Arg, typename Iterator, typename Context>
|
||||
struct attribute_of<sprout::weed::expr<sprout::weed::tag::unary_plus, Arg>, Iterator, Context>
|
||||
: public sprout::weed::attr_cnv::result_of::times<
|
||||
sprout::weed::traits::limit_of<Arg, Iterator, Context>::value,
|
||||
typename sprout::weed::traits::attribute_of<Arg, Iterator, Context>::type
|
||||
>
|
||||
{};
|
||||
template<typename Arg, typename Iterator, typename Context>
|
||||
struct attribute_of<sprout::weed::expr<sprout::weed::tag::negate, Arg>, Iterator, Context>
|
||||
: public sprout::weed::attr_cnv::result_of::negate<
|
||||
typename sprout::weed::traits::attribute_of<Arg, Iterator, Context>::type
|
||||
>
|
||||
{};
|
||||
template<typename Arg, typename Iterator, typename Context>
|
||||
struct attribute_of<sprout::weed::expr<sprout::weed::tag::dereference, Arg>, Iterator, Context>
|
||||
: public sprout::weed::attr_cnv::result_of::times<
|
||||
sprout::weed::traits::limit_of<Arg, Iterator, Context>::value,
|
||||
typename sprout::weed::traits::attribute_of<Arg, Iterator, Context>::type
|
||||
>
|
||||
{};
|
||||
template<typename Arg, typename Iterator, typename Context>
|
||||
struct attribute_of<sprout::weed::expr<sprout::weed::tag::address_of, Arg>, Iterator, Context> {
|
||||
public:
|
||||
typedef sprout::weed::unused type;
|
||||
};
|
||||
template<typename Arg, typename Iterator, typename Context>
|
||||
struct attribute_of<sprout::weed::expr<sprout::weed::tag::logical_not, Arg>, Iterator, Context> {
|
||||
public:
|
||||
typedef sprout::weed::unused type;
|
||||
};
|
||||
template<typename Arg1, typename Arg2, typename Iterator, typename Context>
|
||||
struct attribute_of<sprout::weed::expr<sprout::weed::tag::shift_left, Arg1, Arg2>, Iterator, Context>
|
||||
: public sprout::weed::attr_cnv::result_of::shift_left<
|
||||
typename sprout::weed::traits::attribute_of<Arg1, Iterator, Context>::type,
|
||||
typename sprout::weed::traits::attribute_of<Arg2, Iterator, Context>::type
|
||||
>
|
||||
{};
|
||||
template<typename Arg1, typename Arg2, typename Iterator, typename Context>
|
||||
struct attribute_of<sprout::weed::expr<sprout::weed::tag::modulus, Arg1, Arg2>, Iterator, Context>
|
||||
: public sprout::weed::attr_cnv::result_of::modulus<
|
||||
sprout::weed::traits::limit_of<Arg1, Iterator, Context>::value,
|
||||
typename sprout::weed::traits::attribute_of<Arg1, Iterator, Context>::type
|
||||
>
|
||||
{};
|
||||
template<typename Arg1, typename Arg2, typename Iterator, typename Context>
|
||||
struct attribute_of<sprout::weed::expr<sprout::weed::tag::minus, Arg1, Arg2>, Iterator, Context> {
|
||||
public:
|
||||
typedef typename sprout::weed::traits::attribute_of<Arg1, Iterator, Context>::type type;
|
||||
};
|
||||
template<typename Arg1, typename Arg2, typename Iterator, typename Context>
|
||||
struct attribute_of<sprout::weed::expr<sprout::weed::tag::bitwise_or, Arg1, Arg2>, Iterator, Context>
|
||||
: public sprout::weed::attr_cnv::result_of::bitwise_or<
|
||||
typename sprout::weed::traits::attribute_of<Arg1, Iterator, Context>::type,
|
||||
typename sprout::weed::traits::attribute_of<Arg2, Iterator, Context>::type
|
||||
>
|
||||
: public sprout::weed::traits::attribute_of<
|
||||
typename sprout::weed::traits::terminal_of<T>::type,
|
||||
Iterator,
|
||||
Context
|
||||
>
|
||||
{};
|
||||
} // namespace traits
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue