Initial commit

This commit is contained in:
Bassem Girgis
2018-12-20 17:34:07 -06:00
parent 7a2d899662
commit 81b4b9e273
34743 changed files with 5940233 additions and 0 deletions

View File

@@ -0,0 +1,88 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
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)
==============================================================================*/
#if !defined(BOOST_SPIRIT_EXPAND_ARG_FEB_19_2007_1107AM)
#define BOOST_SPIRIT_EXPAND_ARG_FEB_19_2007_1107AM
#if defined(_MSC_VER)
#pragma once
#endif
#include <boost/mpl/bool.hpp>
#include <boost/mpl/or.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/utility/result_of.hpp>
#include <boost/type_traits/is_scalar.hpp>
#include <boost/spirit/home/support/string_traits.hpp>
namespace boost { namespace spirit { namespace detail
{
///////////////////////////////////////////////////////////////////////////
template <typename Context>
struct expand_arg
{
template <typename T>
struct result_type
{
// This is a temporary hack. The better way is to detect if T
// can be called given unused context.
typedef typename
mpl::eval_if<
mpl::or_<is_scalar<T>, traits::is_string<T> >
, mpl::identity<T const &>
, boost::result_of<T(unused_type, Context)>
>::type
type;
};
template <typename T>
struct result;
template <typename F, typename A0>
struct result<F(A0)>
: result_type<A0> {};
template <typename F, typename A0>
struct result<F(A0&)>
: result_type<A0> {};
expand_arg(Context& context_)
: context(context_)
{
}
template <typename T>
typename result_type<T>::type
call(T const& f, mpl::false_) const
{
return f(unused, context);
}
template <typename T>
typename result_type<T>::type
call(T const& val, mpl::true_) const
{
return val;
}
template <typename T>
typename result_type<T>::type
operator()(T const& x) const
{
return call(x, mpl::or_<is_scalar<T>, traits::is_string<T> >());
}
Context& context;
private:
// silence MSVC warning C4512: assignment operator could not be generated
expand_arg& operator= (expand_arg const&);
};
}}}
#endif

View File

@@ -0,0 +1,148 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2001-2011 Hartmut Kaiser
Copyright (c) 2009 Francois Barel
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)
==============================================================================*/
#if !defined(BOOST_SPIRIT_EXTRACT_PARAM_AUGUST_08_2009_0848AM)
#define BOOST_SPIRIT_EXTRACT_PARAM_AUGUST_08_2009_0848AM
#if defined(_MSC_VER)
#pragma once
#endif
#include <boost/spirit/home/support/meta_compiler.hpp>
#include <boost/spirit/home/support/nonterminal/locals.hpp>
#include <boost/spirit/home/support/unused.hpp>
#include <boost/spirit/home/support/common_terminals.hpp>
#include <boost/function_types/is_function.hpp>
#include <boost/function_types/parameter_types.hpp>
#include <boost/function_types/result_type.hpp>
#include <boost/fusion/include/as_list.hpp>
#include <boost/fusion/include/as_vector.hpp>
#include <boost/mpl/deref.hpp>
#include <boost/mpl/end.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/find_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/or.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost { namespace spirit { namespace detail
{
///////////////////////////////////////////////////////////////////////////
// Helpers to extract params (locals, attributes, ...) from nonterminal
// template arguments
///////////////////////////////////////////////////////////////////////////
template <typename Types, typename Pred, typename Default>
struct extract_param
{
typedef typename mpl::find_if<Types, Pred>::type pos;
typedef typename
mpl::eval_if<
is_same<pos, typename mpl::end<Types>::type>
, mpl::identity<Default>
, mpl::deref<pos>
>::type
type;
};
///////////////////////////////////////////////////////////////////////////
template <typename Types>
struct extract_locals
: fusion::result_of::as_vector<
typename extract_param<
Types
, is_locals<mpl::_>
, locals<>
>::type
>
{};
///////////////////////////////////////////////////////////////////////////
template <typename Domain, typename Types>
struct extract_component
: spirit::result_of::compile<
Domain
, typename extract_param<
Types
, traits::matches<Domain, mpl::_>
, unused_type
>::type
>
{};
///////////////////////////////////////////////////////////////////////////
template <typename T>
struct make_function_type : mpl::identity<T()> {};
///////////////////////////////////////////////////////////////////////////
template <typename Types, typename Encoding, typename Domain>
struct extract_sig
{
typedef typename
extract_param<
Types
, mpl::or_<
function_types::is_function<mpl::_>
, mpl::and_<
mpl::not_<is_locals<mpl::_> >
, mpl::not_<is_same<mpl::_, Encoding> >
, mpl::not_<traits::matches<Domain, mpl::_> >
, mpl::not_<is_same<mpl::_, unused_type> >
>
>
, void()
>::type
attr_of_ftype;
typedef typename
mpl::eval_if<
function_types::is_function<attr_of_ftype>
, mpl::identity<attr_of_ftype>
, make_function_type<attr_of_ftype>
>::type
type;
};
template <typename Sig>
struct attr_from_sig
{
typedef typename function_types::result_type<Sig>::type attr;
typedef typename
mpl::if_<
is_same<attr, void>
, unused_type
, attr
>::type
type;
};
template <typename Sig>
struct params_from_sig
{
typedef typename function_types::parameter_types<Sig>::type params;
typedef typename fusion::result_of::as_list<params>::type type;
};
///////////////////////////////////////////////////////////////////////////
template <typename Types>
struct extract_encoding
: extract_param<
Types
, is_char_encoding<mpl::_>
, unused_type
>
{};
}}}
#endif

View File

@@ -0,0 +1,54 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2001-2011 Hartmut Kaiser
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)
==============================================================================*/
#if !defined(BOOST_SPIRIT_LOCALS_APRIL_03_2007_0506PM)
#define BOOST_SPIRIT_LOCALS_APRIL_03_2007_0506PM
#if defined(_MSC_VER)
#pragma once
#endif
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/bool.hpp>
#if !defined(BOOST_SPIRIT_MAX_LOCALS_SIZE)
# define BOOST_SPIRIT_MAX_LOCALS_SIZE 10
#else
# if BOOST_SPIRIT_MAX_LOCALS_SIZE < 3
# undef BOOST_SPIRIT_MAX_LOCALS_SIZE
# define BOOST_SPIRIT_MAX_LOCALS_SIZE 10
# endif
#endif
namespace boost { namespace spirit
{
///////////////////////////////////////////////////////////////////////////
template <
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
BOOST_SPIRIT_MAX_LOCALS_SIZE, typename T, mpl::na)
>
struct locals
: mpl::vector<BOOST_PP_ENUM_PARAMS(BOOST_SPIRIT_MAX_LOCALS_SIZE, T)> {};
///////////////////////////////////////////////////////////////////////////
namespace detail
{
template <typename T>
struct is_locals
: mpl::false_
{};
template <BOOST_PP_ENUM_PARAMS(BOOST_SPIRIT_MAX_LOCALS_SIZE, typename T)>
struct is_locals<locals<BOOST_PP_ENUM_PARAMS(BOOST_SPIRIT_MAX_LOCALS_SIZE, T)> >
: mpl::true_
{};
}
}}
#endif