diff --git a/sprout/weed/context/parse_context/operator/address_of.hpp b/sprout/weed/context/parse_context/operator/address_of.hpp index 5a021fb3..b5f916d5 100644 --- a/sprout/weed/context/parse_context/operator/address_of.hpp +++ b/sprout/weed/context/parse_context/operator/address_of.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -30,7 +31,7 @@ namespace sprout { private: typedef sprout::weed::parse_context context_type; public: - typedef typename sprout::weed::traits::attribute_of::type attribute_type; + typedef sprout::weed::unused attribute_type; typedef sprout::weed::eval_result result_type; public: SPROUT_CONSTEXPR result_type operator()( diff --git a/sprout/weed/context/parse_context/operator/bitwise_or.hpp b/sprout/weed/context/parse_context/operator/bitwise_or.hpp index 3928cab1..79513e39 100644 --- a/sprout/weed/context/parse_context/operator/bitwise_or.hpp +++ b/sprout/weed/context/parse_context/operator/bitwise_or.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -35,7 +36,10 @@ namespace sprout { typedef typename sprout::weed::traits::attribute_of::type attr1_type; typedef typename sprout::weed::traits::attribute_of::type attr2_type; public: - typedef typename sprout::weed::traits::attribute_of::type attribute_type; + typedef typename sprout::weed::attr_cnv::result_of::bitwise_or< + typename sprout::weed::traits::attribute_of::type, + typename sprout::weed::traits::attribute_of::type + >::type attribute_type; typedef sprout::weed::eval_result result_type; private: template diff --git a/sprout/weed/context/parse_context/operator/dereference.hpp b/sprout/weed/context/parse_context/operator/dereference.hpp index 0d874951..f7623763 100644 --- a/sprout/weed/context/parse_context/operator/dereference.hpp +++ b/sprout/weed/context/parse_context/operator/dereference.hpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -36,7 +37,10 @@ namespace sprout { typedef typename sprout::weed::traits::limit_of::type limit; typedef typename sprout::weed::traits::attribute_of::type attr_type; public: - typedef typename sprout::weed::traits::attribute_of::type attribute_type; + typedef typename sprout::weed::attr_cnv::result_of::times< + limit::value, + typename sprout::weed::traits::attribute_of::type + >::type attribute_type; typedef sprout::weed::eval_result result_type; private: template diff --git a/sprout/weed/context/parse_context/operator/logical_not.hpp b/sprout/weed/context/parse_context/operator/logical_not.hpp index 644a2cea..abd2a14c 100644 --- a/sprout/weed/context/parse_context/operator/logical_not.hpp +++ b/sprout/weed/context/parse_context/operator/logical_not.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -30,7 +31,7 @@ namespace sprout { private: typedef sprout::weed::parse_context context_type; public: - typedef typename sprout::weed::traits::attribute_of::type attribute_type; + typedef sprout::weed::unused attribute_type; typedef sprout::weed::eval_result result_type; public: SPROUT_CONSTEXPR result_type operator()( diff --git a/sprout/weed/context/parse_context/operator/minus.hpp b/sprout/weed/context/parse_context/operator/minus.hpp index 3a4a32d8..a095b124 100644 --- a/sprout/weed/context/parse_context/operator/minus.hpp +++ b/sprout/weed/context/parse_context/operator/minus.hpp @@ -29,8 +29,10 @@ namespace sprout { > { private: typedef sprout::weed::parse_context context_type; + typedef typename sprout::tuples::tuple_element<0, typename Expr::args_type>::type expr1_type; + typedef typename sprout::tuples::tuple_element<1, typename Expr::args_type>::type expr2_type; public: - typedef typename sprout::weed::traits::attribute_of::type attribute_type; + typedef typename sprout::weed::traits::attribute_of::type attribute_type; typedef sprout::weed::eval_result result_type; private: template diff --git a/sprout/weed/context/parse_context/operator/modulus.hpp b/sprout/weed/context/parse_context/operator/modulus.hpp index 228cf242..4b728ec1 100644 --- a/sprout/weed/context/parse_context/operator/modulus.hpp +++ b/sprout/weed/context/parse_context/operator/modulus.hpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -37,7 +38,10 @@ namespace sprout { typedef typename sprout::weed::traits::limit_of::type limit; typedef typename sprout::weed::traits::attribute_of::type attr_type; public: - typedef typename sprout::weed::traits::attribute_of::type attribute_type; + typedef typename sprout::weed::attr_cnv::result_of::modulus< + limit::value, + typename sprout::weed::traits::attribute_of::type + >::type attribute_type; typedef sprout::weed::eval_result result_type; private: template diff --git a/sprout/weed/context/parse_context/operator/negate.hpp b/sprout/weed/context/parse_context/operator/negate.hpp index d74606f9..0da860d7 100644 --- a/sprout/weed/context/parse_context/operator/negate.hpp +++ b/sprout/weed/context/parse_context/operator/negate.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -30,8 +31,11 @@ namespace sprout { > { private: typedef sprout::weed::parse_context context_type; + typedef typename sprout::tuples::tuple_element<0, typename Expr::args_type>::type expr_type; public: - typedef typename sprout::weed::traits::attribute_of::type attribute_type; + typedef typename sprout::weed::attr_cnv::result_of::negate< + typename sprout::weed::traits::attribute_of::type + >::type attribute_type; typedef sprout::weed::eval_result result_type; private: template diff --git a/sprout/weed/context/parse_context/operator/shift_left.hpp b/sprout/weed/context/parse_context/operator/shift_left.hpp index a6ba5875..d3054cac 100644 --- a/sprout/weed/context/parse_context/operator/shift_left.hpp +++ b/sprout/weed/context/parse_context/operator/shift_left.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -30,8 +31,13 @@ namespace sprout { > { private: typedef sprout::weed::parse_context context_type; + typedef typename sprout::tuples::tuple_element<0, typename Expr::args_type>::type expr1_type; + typedef typename sprout::tuples::tuple_element<1, typename Expr::args_type>::type expr2_type; public: - typedef typename sprout::weed::traits::attribute_of::type attribute_type; + typedef typename sprout::weed::attr_cnv::result_of::shift_left< + typename sprout::weed::traits::attribute_of::type, + typename sprout::weed::traits::attribute_of::type + >::type attribute_type; typedef sprout::weed::eval_result result_type; private: template diff --git a/sprout/weed/context/parse_context/operator/unary_plus.hpp b/sprout/weed/context/parse_context/operator/unary_plus.hpp index 272ca7f3..ffc9bd71 100644 --- a/sprout/weed/context/parse_context/operator/unary_plus.hpp +++ b/sprout/weed/context/parse_context/operator/unary_plus.hpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -36,7 +37,10 @@ namespace sprout { typedef typename sprout::weed::traits::limit_of::type limit; typedef typename sprout::weed::traits::attribute_of::type attr_type; public: - typedef typename sprout::weed::traits::attribute_of::type attribute_type; + typedef typename sprout::weed::attr_cnv::result_of::times< + limit::value, + typename sprout::weed::traits::attribute_of::type + >::type attribute_type; typedef sprout::weed::eval_result result_type; private: template diff --git a/sprout/weed/context/parse_context/terminal/char_type.hpp b/sprout/weed/context/parse_context/terminal/char_type.hpp index 4e1340a6..a7643a8e 100644 --- a/sprout/weed/context/parse_context/terminal/char_type.hpp +++ b/sprout/weed/context/parse_context/terminal/char_type.hpp @@ -35,7 +35,7 @@ namespace sprout { private: typedef sprout::weed::parse_context context_type; public: - typedef typename sprout::weed::traits::attribute_of::type attribute_type; + typedef sprout::weed::unused attribute_type; typedef sprout::weed::eval_result result_type; public: SPROUT_CONSTEXPR result_type operator()( diff --git a/sprout/weed/context/parse_context/terminal/parser.hpp b/sprout/weed/context/parse_context/terminal/parser.hpp index 2b8a24c8..e1afc741 100644 --- a/sprout/weed/context/parse_context/terminal/parser.hpp +++ b/sprout/weed/context/parse_context/terminal/parser.hpp @@ -38,7 +38,11 @@ namespace sprout { typedef sprout::weed::parse_context context_type; typedef typename sprout::tuples::tuple_element<0, typename Expr::args_type>::type parser_type; public: - typedef typename sprout::weed::traits::attribute_of::type attribute_type; + typedef typename sprout::weed::traits::attribute_of< + parser_type, + Iterator, + context_type + >::type attribute_type; typedef sprout::weed::eval_result result_type; private: template diff --git a/sprout/weed/context/parse_context/terminal/string.hpp b/sprout/weed/context/parse_context/terminal/string.hpp index eed0f2e2..6ab54a4d 100644 --- a/sprout/weed/context/parse_context/terminal/string.hpp +++ b/sprout/weed/context/parse_context/terminal/string.hpp @@ -39,7 +39,7 @@ namespace sprout { private: typedef sprout::weed::parse_context context_type; public: - typedef typename sprout::weed::traits::attribute_of::type attribute_type; + typedef sprout::weed::unused attribute_type; typedef sprout::weed::eval_result result_type; private: template diff --git a/sprout/weed/traits/parser/attribute_of.hpp b/sprout/weed/traits/parser/attribute_of.hpp index 52e4a85c..f6b22caa 100644 --- a/sprout/weed/traits/parser/attribute_of.hpp +++ b/sprout/weed/traits/parser/attribute_of.hpp @@ -10,12 +10,8 @@ #include #include #include +#include #include -#include -#include -#include -#include -#include namespace sprout { namespace weed { @@ -46,6 +42,18 @@ namespace sprout { typedef typename T::template attribute::type type; }; template + struct attribute_of< + T, + Iterator, + Context, + typename std::enable_if< + sprout::weed::traits::is_expr::value + >::type + > { + public: + typedef typename Context::template eval::attribute_type type; + }; + template struct attribute_of< T, Iterator, @@ -55,68 +63,11 @@ namespace sprout { || sprout::weed::traits::is_c_str::value || sprout::weed::traits::is_string::value >::type - > { - public: - typedef sprout::weed::unused type; - }; - template - struct attribute_of, Iterator, Context> - : public sprout::weed::traits::attribute_of - {}; - template - struct attribute_of, Iterator, Context> - : public sprout::weed::attr_cnv::result_of::times< - sprout::weed::traits::limit_of::value, - typename sprout::weed::traits::attribute_of::type - > - {}; - template - struct attribute_of, Iterator, Context> - : public sprout::weed::attr_cnv::result_of::negate< - typename sprout::weed::traits::attribute_of::type - > - {}; - template - struct attribute_of, Iterator, Context> - : public sprout::weed::attr_cnv::result_of::times< - sprout::weed::traits::limit_of::value, - typename sprout::weed::traits::attribute_of::type - > - {}; - template - struct attribute_of, Iterator, Context> { - public: - typedef sprout::weed::unused type; - }; - template - struct attribute_of, Iterator, Context> { - public: - typedef sprout::weed::unused type; - }; - template - struct attribute_of, Iterator, Context> - : public sprout::weed::attr_cnv::result_of::shift_left< - typename sprout::weed::traits::attribute_of::type, - typename sprout::weed::traits::attribute_of::type - > - {}; - template - struct attribute_of, Iterator, Context> - : public sprout::weed::attr_cnv::result_of::modulus< - sprout::weed::traits::limit_of::value, - typename sprout::weed::traits::attribute_of::type - > - {}; - template - struct attribute_of, Iterator, Context> { - public: - typedef typename sprout::weed::traits::attribute_of::type type; - }; - template - struct attribute_of, Iterator, Context> - : public sprout::weed::attr_cnv::result_of::bitwise_or< - typename sprout::weed::traits::attribute_of::type, - typename sprout::weed::traits::attribute_of::type + > + : public sprout::weed::traits::attribute_of< + typename sprout::weed::traits::terminal_of::type, + Iterator, + Context > {}; } // namespace traits