Пример #1
0
		inline static int apply(lua_State* L)	
		{
			int top = lua_gettop(L) - StartIndex + 1;
			if (top != Sig::arity) return -1;

			return match_params(L, StartIndex, (Sig*)0, (Policies*)0);
		}};
Пример #2
0
	int match(R(*)(
		BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A))
	  , lua_State* L
	  , WrappedClass*
	  , Policies const*)
	{
		typedef constructor<BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)> ParameterTypes;
		return match_params(
			L, 1, (ParameterTypes*)0, (Policies*)0);
	}
bool match_function(const Function &function, vespalib::string &reduce_dim) {
    const Node &expect_max = function.root();
    if ((function.num_params() == 2) && match_max_reduce(expect_max, reduce_dim)) {
        const Node &expect_mul = expect_max.get_child(0);
        if (as<Mul>(expect_mul) || match_prod_join(expect_mul)) {
            return match_params(expect_mul.get_child(0), expect_mul.get_child(1));
        }
    }
    return false;
}
Пример #4
0
 double match_initializer(iterator& current, iterator end)
 {
     traits.skip_space(current, end);
     if(!traits.match(current, end, "{")) return 0.0;
     double res = match_params(current, end);
     if(res == 0.0) return 0.0;
     traits.skip_space(current, end);
     if(!traits.match(current, end, "}")) return 0.0;
     traits.skip_space(current, end);
     return res;
 }
Пример #5
0
	int match(
		R(T::*)(BOOST_PP_ENUM_PARAMS(N, A)) const
	  , lua_State* L
	  , WrappedClass*
	  , Policies const* policies)
	{
		typedef constructor<
			T const&
			BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
		> params_t;
		return match_params(
			L, 1, (params_t*)0, (Policies*)0);
	}
Пример #6
0
	int match(
		R(T::*)(BOOST_PP_ENUM_PARAMS(N, A)) const
	  , lua_State* L
	  , WrappedClass*
	  , Policies const* policies)
	{
		typedef constructor<
			BOOST_DEDUCED_TYPENAME most_derived<T,WrappedClass>::type const&
			BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
		> params_t;
		return match_params(
			L, 1, (params_t*)0, (Policies*)0);
	}
Пример #7
0
 double match_explicit(iterator& current, iterator end)
 {
     traits.skip_space(current, end);
     if(!traits.match_skip_space(
                 current,
                 end,
                 traits.get_shared_string(shared_data, type_name)
             )) return 0.0;
     traits.skip_space(current, end);
     if(!traits.match(current, end, "(")) return 0.0;
     if(match_params(current, end) == 0.0) return 0.0;
     traits.skip_space(current, end);
     if(!traits.match(current, end, ")")) return 0.0;
     traits.skip_space(current, end);
     return 1.0;
 }
Пример #8
0
 double match(iterator& begin, iterator end)
 {
     iterator current = begin;
     double result = match_explicit(current, end);
     if(result == 0.0)
     {
         current = begin;
         result = match_initializer(current, end);
         if(result == 0.0)
         {
             if(this->subparsers.size() == 1)
             {
                 current = begin;
                 result = match_params(current, end);
             }
             if(result == 0.0) return 0.0;
         }
     }
     traits.skip_space(current, end);
     begin = current;
     return result;
 }