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,53 @@
/*=============================================================================
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)
==============================================================================*/
#ifndef BOOST_PP_IS_ITERATING
#include <boost/preprocessor/iterate.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#define BOOST_PP_FILENAME_1 \
<boost/spirit/home/qi/nonterminal/detail/fcall.hpp>
#define BOOST_PP_ITERATION_LIMITS (1, SPIRIT_ARGUMENTS_LIMIT)
#include BOOST_PP_ITERATE()
///////////////////////////////////////////////////////////////////////////////
//
// Preprocessor vertical repetition code
//
///////////////////////////////////////////////////////////////////////////////
#else // defined(BOOST_PP_IS_ITERATING)
#define N BOOST_PP_ITERATION()
template <BOOST_PP_ENUM_PARAMS(N, typename A)>
typename lazy_enable_if_c<
(params_size == N)
, proto::terminal<
spirit::qi::parameterized_nonterminal<
parameterized_subject_type
, fusion::vector<BOOST_PP_ENUM_PARAMS(N, A)> >
>
>::type
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& f)) const
{
typedef fusion::vector<BOOST_PP_ENUM_PARAMS(N, A)> vector_type;
typedef spirit::qi::parameterized_nonterminal<
parameterized_subject_type, vector_type> parameterized_type;
typedef typename proto::terminal<parameterized_type>::type result_type;
return result_type::make(
parameterized_type(
this->get_parameterized_subject()
, fusion::make_vector(BOOST_PP_ENUM_PARAMS(N, f)))
);
}
#undef N
#endif // defined(BOOST_PP_IS_ITERATING)

View File

@@ -0,0 +1,75 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
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_PARAMETERIZED_AUGUST_09_2009_0539AM)
#define BOOST_SPIRIT_PARAMETERIZED_AUGUST_09_2009_0539AM
#if defined(_MSC_VER)
#pragma once
#endif
#include <boost/ref.hpp>
#include <boost/spirit/home/support/handles_container.hpp>
#include <boost/spirit/home/qi/parser.hpp>
namespace boost { namespace spirit { namespace qi
{
///////////////////////////////////////////////////////////////////////////
// parameterized_nonterminal: parser representing the invocation of a
// nonterminal, passing inherited attributes
///////////////////////////////////////////////////////////////////////////
template <typename Subject, typename Params>
struct parameterized_nonterminal
: parser<parameterized_nonterminal<Subject, Params> >
{
parameterized_nonterminal(Subject const& subject, Params const& params_)
: ref(subject), params(params_)
{
}
template <typename Context, typename Iterator>
struct attribute
// Forward to subject.
: Subject::template attribute<Context, Iterator> {};
template <typename Iterator, typename Context
, typename Skipper, typename Attribute>
bool parse(Iterator& first, Iterator const& last
, Context& context, Skipper const& skipper
, Attribute& attr_) const
{
// Forward to subject, passing the additional
// params argument to parse.
return ref.get().parse(first, last, context, skipper, attr_, params);
}
template <typename Context>
info what(Context& context) const
{
// Forward to subject.
return ref.get().what(context);
}
boost::reference_wrapper<Subject const> ref;
Params params;
};
}}}
namespace boost { namespace spirit { namespace traits
{
///////////////////////////////////////////////////////////////////////////
template <typename Subject, typename Params, typename Attribute
, typename Context, typename Iterator>
struct handles_container<qi::parameterized_nonterminal<Subject, Params>
, Attribute, Context, Iterator>
: handles_container<typename remove_const<Subject>::type
, Attribute, Context, Iterator>
{};
}}}
#endif

View File

@@ -0,0 +1,87 @@
/*=============================================================================
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_PARSER_BINDER_DECEMBER_05_2008_0516_PM)
#define BOOST_SPIRIT_PARSER_BINDER_DECEMBER_05_2008_0516_PM
#if defined(_MSC_VER)
#pragma once
#endif
#include <boost/fusion/include/at.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/spirit/home/support/has_semantic_action.hpp>
namespace boost { namespace spirit { namespace qi { namespace detail
{
// parser_binder for plain rules
template <typename Parser, typename Auto>
struct parser_binder
{
parser_binder(Parser const& p_)
: p(p_) {}
template <typename Iterator, typename Skipper, typename Context>
bool call(Iterator& first, Iterator const& last
, Context& context, Skipper const& skipper, mpl::true_) const
{
// If DeducedAuto is false (semantic actions is present), the
// component's attribute is unused.
return p.parse(first, last, context, skipper, unused);
}
template <typename Iterator, typename Skipper, typename Context>
bool call(Iterator& first, Iterator const& last
, Context& context, Skipper const& skipper, mpl::false_) const
{
// If DeducedAuto is true (no semantic action), we pass the rule's
// attribute on to the component.
return p.parse(first, last, context, skipper
, fusion::at_c<0>(context.attributes));
}
template <typename Iterator, typename Skipper, typename Context>
bool operator()(
Iterator& first, Iterator const& last
, Context& context, Skipper const& skipper) const
{
// If Auto is false, we need to deduce whether to apply auto rule
typedef typename traits::has_semantic_action<Parser>::type auto_rule;
return call(first, last, context, skipper, auto_rule());
}
Parser p;
};
// parser_binder for auto rules
template <typename Parser>
struct parser_binder<Parser, mpl::true_>
{
parser_binder(Parser const& p_)
: p(p_) {}
template <typename Iterator, typename Skipper, typename Context>
bool operator()(
Iterator& first, Iterator const& last
, Context& context, Skipper const& skipper) const
{
// If Auto is true, we pass the rule's attribute on to the component.
return p.parse(first, last, context, skipper
, fusion::at_c<0>(context.attributes));
}
Parser p;
};
template <typename Auto, typename Parser>
inline parser_binder<Parser, Auto>
bind_parser(Parser const& p)
{
return parser_binder<Parser, Auto>(p);
}
}}}}
#endif