mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-22 15:18:12 +00:00
Added thirdparty: boost library
This commit is contained in:
+152
@@ -0,0 +1,152 @@
|
||||
// Copyright (c) 2009 Chris Hoeppler
|
||||
//
|
||||
// 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_REPOSITORY_QI_CONFIX_JUN_22_2009_1041AM)
|
||||
#define BOOST_SPIRIT_REPOSITORY_QI_CONFIX_JUN_22_2009_1041AM
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/spirit/home/qi/domain.hpp>
|
||||
#include <boost/spirit/home/qi/meta_compiler.hpp>
|
||||
#include <boost/spirit/home/qi/auxiliary/lazy.hpp>
|
||||
#include <boost/spirit/home/support/common_terminals.hpp>
|
||||
#include <boost/spirit/home/support/info.hpp>
|
||||
#include <boost/spirit/home/support/unused.hpp>
|
||||
#include <boost/spirit/home/qi/detail/attributes.hpp>
|
||||
|
||||
#include <boost/spirit/repository/home/support/confix.hpp>
|
||||
|
||||
#include <boost/fusion/include/vector.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Enablers
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// enables confix(..., ...)[]
|
||||
template <typename Prefix, typename Suffix>
|
||||
struct use_directive<qi::domain
|
||||
, terminal_ex<repository::tag::confix, fusion::vector2<Prefix, Suffix> > >
|
||||
: mpl::true_ {};
|
||||
|
||||
// enables *lazy* confix(..., ...)[]
|
||||
template <>
|
||||
struct use_lazy_directive<qi::domain, repository::tag::confix, 2>
|
||||
: mpl::true_ {};
|
||||
|
||||
}}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit { namespace repository { namespace qi
|
||||
{
|
||||
#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||
using repository::confix;
|
||||
#endif
|
||||
using repository::confix_type;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// the confix() generated parser
|
||||
template <typename Subject, typename Prefix, typename Suffix>
|
||||
struct confix_parser
|
||||
: spirit::qi::unary_parser<confix_parser<Subject, Prefix, Suffix> >
|
||||
{
|
||||
typedef Subject subject_type;
|
||||
|
||||
template <typename Context, typename Iterator>
|
||||
struct attribute
|
||||
: traits::attribute_of<subject_type, Context, Iterator>
|
||||
{};
|
||||
|
||||
confix_parser(Subject const& subject, Prefix const& prefix
|
||||
, Suffix const& suffix)
|
||||
: subject(subject), prefix(prefix), suffix(suffix) {}
|
||||
|
||||
template <typename Iterator, typename Context
|
||||
, typename Skipper, typename Attribute>
|
||||
bool parse(Iterator& first, Iterator const& last
|
||||
, Context& context, Skipper const& skipper
|
||||
, Attribute& attr) const
|
||||
{
|
||||
Iterator iter = first;
|
||||
|
||||
if (!(prefix.parse(iter, last, context, skipper, unused) &&
|
||||
subject.parse(iter, last, context, skipper, attr) &&
|
||||
suffix.parse(iter, last, context, skipper, unused)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
first = iter;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename Context>
|
||||
info what(Context const& ctx) const
|
||||
{
|
||||
return info("confix", subject.what(ctx));
|
||||
}
|
||||
|
||||
Subject subject;
|
||||
Prefix prefix;
|
||||
Suffix suffix;
|
||||
};
|
||||
|
||||
}}}}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit { namespace qi
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Parser generators: make_xxx function (objects)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// creates confix(..., ...)[] directive
|
||||
template <typename Prefix, typename Suffix, typename Subject
|
||||
, typename Modifiers>
|
||||
struct make_directive<
|
||||
terminal_ex<repository::tag::confix, fusion::vector2<Prefix, Suffix> >
|
||||
, Subject, Modifiers>
|
||||
{
|
||||
typedef typename
|
||||
result_of::compile<qi::domain, Prefix, Modifiers>::type
|
||||
prefix_type;
|
||||
typedef typename
|
||||
result_of::compile<qi::domain, Suffix, Modifiers>::type
|
||||
suffix_type;
|
||||
|
||||
typedef repository::qi::confix_parser<
|
||||
Subject, prefix_type, suffix_type> result_type;
|
||||
|
||||
template <typename Terminal>
|
||||
result_type operator()(Terminal const& term, Subject const& subject
|
||||
, Modifiers const& modifiers) const
|
||||
{
|
||||
return result_type(subject
|
||||
, compile<qi::domain>(fusion::at_c<0>(term.args), modifiers)
|
||||
, compile<qi::domain>(fusion::at_c<1>(term.args), modifiers));
|
||||
}
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
namespace boost { namespace spirit { namespace traits
|
||||
{
|
||||
template <typename Subject, typename Prefix, typename Suffix>
|
||||
struct has_semantic_action<
|
||||
repository::qi::confix_parser<Subject, Prefix, Suffix> >
|
||||
: mpl::or_<
|
||||
has_semantic_action<Subject>
|
||||
, has_semantic_action<Prefix>
|
||||
, has_semantic_action<Suffix>
|
||||
> {};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
// Copyright (c) 2001-2011 Hartmut Kaiser
|
||||
// Copyright (c) 2001-2011 Joel de Guzman
|
||||
// Copyright (c) 2003 Vaclav Vesely
|
||||
//
|
||||
// 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_SPIRIT_REPOSITORY_QI_DIRECTIVE_DISTINCT_HPP
|
||||
#define BOOST_SPIRIT_REPOSITORY_QI_DIRECTIVE_DISTINCT_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/spirit/home/qi/skip_over.hpp>
|
||||
#include <boost/spirit/home/qi/domain.hpp>
|
||||
#include <boost/spirit/home/qi/parser.hpp>
|
||||
#include <boost/spirit/home/qi/meta_compiler.hpp>
|
||||
#include <boost/spirit/home/qi/detail/unused_skipper.hpp>
|
||||
#include <boost/spirit/home/support/common_terminals.hpp>
|
||||
#include <boost/spirit/home/support/make_component.hpp>
|
||||
#include <boost/spirit/home/support/info.hpp>
|
||||
#include <boost/spirit/home/support/unused.hpp>
|
||||
#include <boost/spirit/home/qi/detail/attributes.hpp>
|
||||
#include <boost/spirit/home/support/string_traits.hpp>
|
||||
#include <boost/spirit/home/qi/auxiliary/eps.hpp>
|
||||
#include <boost/spirit/home/qi/auxiliary/lazy.hpp>
|
||||
#include <boost/spirit/home/qi/directive/lexeme.hpp>
|
||||
#include <boost/spirit/home/qi/operator/not_predicate.hpp>
|
||||
|
||||
#include <boost/spirit/repository/home/support/distinct.hpp>
|
||||
|
||||
#include <boost/fusion/include/at.hpp>
|
||||
#include <boost/fusion/include/vector.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Enablers
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// enables distinct(...)[...]
|
||||
template <typename Tail>
|
||||
struct use_directive<qi::domain
|
||||
, terminal_ex<repository::tag::distinct, fusion::vector1<Tail> > >
|
||||
: mpl::true_ {};
|
||||
|
||||
// enables *lazy* distinct(...)[...]
|
||||
template <>
|
||||
struct use_lazy_directive<qi::domain, repository::tag::distinct, 1>
|
||||
: mpl::true_ {};
|
||||
|
||||
}}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit { namespace repository {namespace qi
|
||||
{
|
||||
#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||
using repository::distinct;
|
||||
#endif
|
||||
using repository::distinct_type;
|
||||
|
||||
template <typename Subject, typename Tail, typename Modifier>
|
||||
struct distinct_parser
|
||||
: spirit::qi::unary_parser<distinct_parser<Subject, Tail, Modifier> >
|
||||
{
|
||||
template <typename Context, typename Iterator>
|
||||
struct attribute
|
||||
: traits::attribute_of<Subject, Context, Iterator>
|
||||
{};
|
||||
|
||||
distinct_parser(Subject const& subject, Tail const& tail)
|
||||
: subject(subject), tail(tail) {}
|
||||
|
||||
template <typename Iterator, typename Context
|
||||
, typename Skipper, typename Attribute>
|
||||
bool parse(Iterator& first, Iterator const& last
|
||||
, Context& context, Skipper const& skipper, Attribute& attr) const
|
||||
{
|
||||
Iterator iter = first;
|
||||
|
||||
spirit::qi::skip_over(iter, last, skipper);
|
||||
if (!subject.parse(iter, last, context
|
||||
, spirit::qi::detail::unused_skipper<Skipper>(skipper), attr))
|
||||
return false;
|
||||
|
||||
Iterator i = iter;
|
||||
if (tail.parse(i, last, context, unused, unused))
|
||||
return false;
|
||||
|
||||
first = iter;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename Context>
|
||||
info what(Context& ctx) const
|
||||
{
|
||||
return info("distinct", subject.what(ctx));
|
||||
}
|
||||
|
||||
Subject subject;
|
||||
Tail tail;
|
||||
};
|
||||
|
||||
}}}}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit { namespace qi
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Parser generators: make_xxx function (objects)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Tail, typename Subject, typename Modifiers>
|
||||
struct make_directive<
|
||||
terminal_ex<repository::tag::distinct, fusion::vector1<Tail> >
|
||||
, Subject, Modifiers>
|
||||
{
|
||||
typedef typename result_of::compile<qi::domain, Tail, Modifiers>::type
|
||||
tail_type;
|
||||
|
||||
typedef repository::qi::distinct_parser<
|
||||
Subject, tail_type, Modifiers> result_type;
|
||||
|
||||
template <typename Terminal>
|
||||
result_type operator()(Terminal const& term, Subject const& subject
|
||||
, Modifiers const& modifiers) const
|
||||
{
|
||||
return result_type(subject
|
||||
, compile<qi::domain>(fusion::at_c<0>(term.args), modifiers));
|
||||
}
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
namespace boost { namespace spirit { namespace traits
|
||||
{
|
||||
template <typename Subject, typename Tail, typename Modifier>
|
||||
struct has_semantic_action<
|
||||
repository::qi::distinct_parser<Subject, Tail, Modifier> >
|
||||
: unary_has_semantic_action<Subject> {};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
||||
+1194
File diff suppressed because it is too large
Load Diff
+134
@@ -0,0 +1,134 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2011 Jamboree
|
||||
|
||||
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_SPIRIT_REPOSITORY_QI_SEEK
|
||||
#define BOOST_SPIRIT_REPOSITORY_QI_SEEK
|
||||
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
#include <boost/spirit/home/qi/meta_compiler.hpp>
|
||||
#include <boost/spirit/home/qi/parser.hpp>
|
||||
#include <boost/spirit/home/qi/detail/attributes.hpp>
|
||||
#include <boost/spirit/home/support/info.hpp>
|
||||
#include <boost/spirit/home/support/unused.hpp>
|
||||
#include <boost/spirit/home/support/has_semantic_action.hpp>
|
||||
#include <boost/spirit/home/support/handles_container.hpp>
|
||||
#include <boost/spirit/repository/home/support/seek.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace spirit
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Enablers
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// enables seek[...]
|
||||
template <>
|
||||
struct use_directive<qi::domain, repository::tag::seek>
|
||||
: mpl::true_ {};
|
||||
}} // namespace boost::spirit
|
||||
|
||||
|
||||
namespace boost { namespace spirit { namespace repository {namespace qi
|
||||
{
|
||||
#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||
using repository::seek;
|
||||
#endif
|
||||
using repository::seek_type;
|
||||
|
||||
template <typename Subject>
|
||||
struct seek_directive
|
||||
: spirit::qi::unary_parser<seek_directive<Subject> >
|
||||
{
|
||||
typedef Subject subject_type;
|
||||
|
||||
template <typename Context, typename Iterator>
|
||||
struct attribute
|
||||
{
|
||||
typedef typename
|
||||
traits::attribute_of<subject_type, Context, Iterator>::type
|
||||
type;
|
||||
};
|
||||
|
||||
seek_directive(Subject const& subject)
|
||||
: subject(subject)
|
||||
{}
|
||||
|
||||
template
|
||||
<
|
||||
typename Iterator, typename Context
|
||||
, typename Skipper, typename Attribute
|
||||
>
|
||||
bool parse
|
||||
(
|
||||
Iterator& first, Iterator const& last
|
||||
, Context& context, Skipper const& skipper
|
||||
, Attribute& attr
|
||||
) const
|
||||
{
|
||||
for (Iterator it(first); ; ++it)
|
||||
{
|
||||
if (subject.parse(it, last, context, skipper, attr))
|
||||
{
|
||||
first = it;
|
||||
return true;
|
||||
}
|
||||
// fail only after subject fails & no input
|
||||
if (it == last)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Context>
|
||||
info what(Context& context) const
|
||||
{
|
||||
return info("seek", subject.what(context));
|
||||
}
|
||||
|
||||
Subject subject;
|
||||
};
|
||||
}}}} // namespace boost::spirit::repository::qi
|
||||
|
||||
|
||||
namespace boost { namespace spirit { namespace qi
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Parser generators: make_xxx function (objects)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Subject, typename Modifiers>
|
||||
struct make_directive<repository::tag::seek, Subject, Modifiers>
|
||||
{
|
||||
typedef repository::qi::seek_directive<Subject> result_type;
|
||||
|
||||
result_type operator()(unused_type, Subject const& subject, unused_type) const
|
||||
{
|
||||
return result_type(subject);
|
||||
}
|
||||
};
|
||||
}}} // namespace boost::spirit::qi
|
||||
|
||||
|
||||
namespace boost { namespace spirit { namespace traits
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Subject>
|
||||
struct has_semantic_action<repository::qi::seek_directive<Subject> >
|
||||
: unary_has_semantic_action<Subject> {};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Subject, typename Attribute, typename Context
|
||||
, typename Iterator>
|
||||
struct handles_container<repository::qi::seek_directive<Subject>, Attribute
|
||||
, Context, Iterator>
|
||||
: unary_handles_container<Subject, Attribute, Context, Iterator> {};
|
||||
}}} // namespace boost::spirit::traits
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user