diff options
author | Kevin Smith <git@kismith.co.uk> | 2013-01-12 18:41:34 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2013-01-13 10:36:26 (GMT) |
commit | f3bc816af1b0d61452de973963e453bf3b3f95a2 (patch) | |
tree | e895f8afa3580e6cff6f5ad2017d45bf147a17c2 /3rdParty/Boost/src/boost/spirit/home/qi | |
parent | 188fc285c6555eadd3c9d50ab8a94adcade78d89 (diff) | |
download | swift-f3bc816af1b0d61452de973963e453bf3b3f95a2.zip swift-f3bc816af1b0d61452de973963e453bf3b3f95a2.tar.bz2 |
Adding in the spirit Boost stuff
Change-Id: I4f127ce61667243b64081b0aa309028d5077045f
Diffstat (limited to '3rdParty/Boost/src/boost/spirit/home/qi')
18 files changed, 2482 insertions, 0 deletions
diff --git a/3rdParty/Boost/src/boost/spirit/home/qi/detail/assign_to.hpp b/3rdParty/Boost/src/boost/spirit/home/qi/detail/assign_to.hpp new file mode 100644 index 0000000..38142bf --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/qi/detail/assign_to.hpp @@ -0,0 +1,392 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + Copyright (c) 2001-2011 Hartmut Kaiser + http://spirit.sourceforge.net/ + + 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_ASSIGN_TO_APR_16_2006_0812PM) +#define BOOST_SPIRIT_ASSIGN_TO_APR_16_2006_0812PM + +#if defined(_MSC_VER) +#pragma once +#endif + +#include <boost/spirit/home/qi/detail/construct.hpp> +#include <boost/spirit/home/support/unused.hpp> +#include <boost/spirit/home/qi/detail/attributes.hpp> +#include <boost/spirit/home/support/container.hpp> +#include <boost/fusion/include/copy.hpp> +#include <boost/ref.hpp> +#include <boost/range/iterator_range.hpp> + +namespace boost { namespace spirit { namespace traits +{ + /////////////////////////////////////////////////////////////////////////// + // This file contains assignment utilities. The utilities provided also + // accept spirit's unused_type; all no-ops. Compiler optimization will + // easily strip these away. + /////////////////////////////////////////////////////////////////////////// + namespace detail + { + template <typename T> + struct is_iter_range : mpl::false_ {}; + + template <typename I> + struct is_iter_range<boost::iterator_range<I> > : mpl::true_ {}; + + template <typename C> + struct is_container_of_ranges + : is_iter_range<typename C::value_type> {}; + } + + template <typename Attribute, typename Iterator, typename Enable> + struct assign_to_attribute_from_iterators + { + // Common case + static void + call(Iterator const& first, Iterator const& last, Attribute& attr, mpl::false_) + { + if (traits::is_empty(attr)) + attr = Attribute(first, last); + else { + for (Iterator i = first; i != last; ++i) + push_back(attr, *i); + } + } + + // If Attribute is a container with value_type==iterator_range<T> just push the + // iterator_range into it + static void + call(Iterator const& first, Iterator const& last, Attribute& attr, mpl::true_) + { + typename Attribute::value_type rng(first, last); + push_back(attr, rng); + } + + static void + call(Iterator const& first, Iterator const& last, Attribute& attr) + { + call(first, last, attr, detail::is_container_of_ranges<Attribute>()); + } + }; + + template <typename Attribute, typename Iterator> + struct assign_to_attribute_from_iterators< + reference_wrapper<Attribute>, Iterator> + { + static void + call(Iterator const& first, Iterator const& last + , reference_wrapper<Attribute> attr) + { + if (traits::is_empty(attr)) + attr = Attribute(first, last); + else { + for (Iterator i = first; i != last; ++i) + push_back(attr, *i); + } + } + }; + + template <typename Attribute, typename Iterator> + struct assign_to_attribute_from_iterators< + boost::optional<Attribute>, Iterator> + { + static void + call(Iterator const& first, Iterator const& last + , boost::optional<Attribute>& attr) + { + Attribute val; + assign_to(first, last, val); + attr = val; + } + }; + + template <typename Iterator> + struct assign_to_attribute_from_iterators< + iterator_range<Iterator>, Iterator> + { + static void + call(Iterator const& first, Iterator const& last + , iterator_range<Iterator>& attr) + { + attr = iterator_range<Iterator>(first, last); + } + }; + + template <typename Iterator, typename Attribute> + inline void + assign_to(Iterator const& first, Iterator const& last, Attribute& attr) + { + assign_to_attribute_from_iterators<Attribute, Iterator>:: + call(first, last, attr); + } + + template <typename Iterator> + inline void + assign_to(Iterator const&, Iterator const&, unused_type) + { + } + + /////////////////////////////////////////////////////////////////////////// + template <typename T, typename Attribute> + void assign_to(T const& val, Attribute& attr); + + template <typename Attribute, typename T, typename Enable> + struct assign_to_attribute_from_value + { + typedef typename traits::one_element_sequence<Attribute>::type + is_one_element_sequence; + + typedef typename mpl::eval_if< + is_one_element_sequence + , fusion::result_of::at_c<Attribute, 0> + , mpl::identity<Attribute&> + >::type type; + + template <typename T_> + static void + call(T_ const& val, Attribute& attr, mpl::false_) + { + attr = static_cast<Attribute>(val); + } + + // This handles the case where the attribute is a single element fusion + // sequence. We silently assign to the only element and treat it as the + // attribute to parse the results into. + template <typename T_> + static void + call(T_ const& val, Attribute& attr, mpl::true_) + { + typedef typename fusion::result_of::value_at_c<Attribute, 0>::type + element_type; + fusion::at_c<0>(attr) = static_cast<element_type>(val); + } + + static void + call(T const& val, Attribute& attr) + { + call(val, attr, is_one_element_sequence()); + } + }; + + template <typename Attribute> + struct assign_to_attribute_from_value<Attribute, Attribute> + { + static void + call(Attribute const& val, Attribute& attr) + { + attr = val; + } + }; + + template <typename Attribute, typename T> + struct assign_to_attribute_from_value<Attribute, reference_wrapper<T> + , typename disable_if<is_same<Attribute, reference_wrapper<T> > >::type> + { + static void + call(reference_wrapper<T> const& val, Attribute& attr) + { + assign_to(val.get(), attr); + } + }; + + template <typename Attribute, typename T> + struct assign_to_attribute_from_value<Attribute, boost::optional<T> + , typename disable_if<is_same<Attribute, boost::optional<T> > >::type> + { + static void + call(boost::optional<T> const& val, Attribute& attr) + { + assign_to(val.get(), attr); + } + }; + + namespace detail + { + template <typename A, typename B> + struct is_same_size_sequence + : mpl::bool_<fusion::result_of::size<A>::value + == fusion::result_of::size<B>::value> + {}; + } + + template <typename Attribute, typename T> + struct assign_to_attribute_from_value<Attribute, T, + mpl::and_< + fusion::traits::is_sequence<Attribute>, + fusion::traits::is_sequence<T>, + detail::is_same_size_sequence<Attribute, T> + > + > + { + static void + call(T const& val, Attribute& attr) + { + fusion::copy(val, attr); + } + }; + + /////////////////////////////////////////////////////////////////////////// + template <typename Attribute, typename T, typename Enable> + struct assign_to_container_from_value + { + // T is not a container and not a string + template <typename T_> + static void call(T_ const& val, Attribute& attr, mpl::false_, mpl::false_) + { + traits::push_back(attr, val); + } + + // T is a container (but not a string), and T is convertible to the + // value_type of the Attribute container + template <typename T_> + static void + append_to_container_not_string(T_ const& val, Attribute& attr, mpl::true_) + { + traits::push_back(attr, val); + } + + // T is a container (but not a string), generic overload + template <typename T_> + static void + append_to_container_not_string(T_ const& val, Attribute& attr, mpl::false_) + { + typedef typename traits::container_iterator<T_ const>::type + iterator_type; + + iterator_type end = traits::end(val); + for (iterator_type i = traits::begin(val); i != end; traits::next(i)) + traits::push_back(attr, traits::deref(i)); + } + + // T is a container (but not a string) + template <typename T_> + static void call(T_ const& val, Attribute& attr, mpl::true_, mpl::false_) + { + typedef typename container_value<Attribute>::type value_type; + typedef typename is_convertible<T, value_type>::type is_value_type; + + append_to_container_not_string(val, attr, is_value_type()); + } + + /////////////////////////////////////////////////////////////////////// + // T is a string + template <typename Iterator> + static void append_to_string(Attribute& attr, Iterator begin, Iterator end) + { + for (Iterator i = begin; i != end; ++i) + traits::push_back(attr, *i); + } + + // T is string, but not convertible to value_type of container + template <typename T_> + static void append_to_container(T_ const& val, Attribute& attr, mpl::false_) + { + typedef typename char_type_of<T_>::type char_type; + + append_to_string(attr, traits::get_begin<char_type>(val) + , traits::get_end<char_type>(val)); + } + + // T is string, and convertible to value_type of container + template <typename T_> + static void append_to_container(T_ const& val, Attribute& attr, mpl::true_) + { + traits::push_back(attr, val); + } + + template <typename T_, typename Pred> + static void call(T_ const& val, Attribute& attr, Pred, mpl::true_) + { + typedef typename container_value<Attribute>::type value_type; + typedef typename is_convertible<T, value_type>::type is_value_type; + + append_to_container(val, attr, is_value_type()); + } + + /////////////////////////////////////////////////////////////////////// + static void call(T const& val, Attribute& attr) + { + typedef typename traits::is_container<T>::type is_container; + typedef typename traits::is_string<T>::type is_string; + + call(val, attr, is_container(), is_string()); + } + }; + + template <typename Attribute> + struct assign_to_container_from_value<Attribute, Attribute> + { + static void + call(Attribute const& val, Attribute& attr) + { + attr = val; + } + }; + + template <typename Attribute, typename T> + struct assign_to_container_from_value<Attribute, boost::optional<T> + , typename disable_if<is_same<Attribute, boost::optional<T> > >::type> + { + static void + call(boost::optional<T> const& val, Attribute& attr) + { + assign_to(val.get(), attr); + } + }; + + template <typename Attribute, typename T> + struct assign_to_container_from_value<Attribute, reference_wrapper<T> + , typename disable_if<is_same<Attribute, reference_wrapper<T> > >::type> + { + static void + call(reference_wrapper<T> const& val, Attribute& attr) + { + assign_to(val.get(), attr); + } + }; + + /////////////////////////////////////////////////////////////////////////// + namespace detail + { + // overload for non-container attributes + template <typename T, typename Attribute> + inline void + assign_to(T const& val, Attribute& attr, mpl::false_) + { + assign_to_attribute_from_value<Attribute, T>::call(val, attr); + } + + // overload for containers (but not for variants or optionals + // holding containers) + template <typename T, typename Attribute> + inline void + assign_to(T const& val, Attribute& attr, mpl::true_) + { + assign_to_container_from_value<Attribute, T>::call(val, attr); + } + } + + template <typename T, typename Attribute> + inline void + assign_to(T const& val, Attribute& attr) + { + typedef typename mpl::and_< + traits::is_container<Attribute> + , traits::not_is_variant<Attribute> + , traits::not_is_optional<Attribute> + >::type is_not_wrapped_container; + + detail::assign_to(val, attr, is_not_wrapped_container()); + } + + template <typename T> + inline void + assign_to(T const&, unused_type) + { + } +}}} + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/qi/detail/attributes.hpp b/3rdParty/Boost/src/boost/spirit/home/qi/detail/attributes.hpp new file mode 100644 index 0000000..0a66a65 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/qi/detail/attributes.hpp @@ -0,0 +1,176 @@ +// Copyright (c) 2001-2011 Hartmut Kaiser +// 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(SPIRIT_QI_DETAIL_ATTRIBUTES_APR_18_2010_0458PM) +#define SPIRIT_QI_DETAIL_ATTRIBUTES_APR_18_2010_0458PM + +#include <boost/spirit/home/qi/domain.hpp> +#include <boost/spirit/home/support/attributes_fwd.hpp> +#include <boost/spirit/home/support/attributes.hpp> +#include <boost/spirit/home/support/utree/utree_traits_fwd.hpp> + +/////////////////////////////////////////////////////////////////////////////// +namespace boost { namespace spirit { namespace qi +{ + template <typename Exposed, typename Transformed> + struct default_transform_attribute + { + typedef Transformed type; + + static Transformed pre(Exposed&) { return Transformed(); } + + static void post(Exposed& val, Transformed const& attr) + { + traits::assign_to(attr, val); + } + + // fail() will be called by Qi rule's if the rhs failed parsing + static void fail(Exposed&) {} + }; + + // handle case where no transformation is required as the types are the same + template <typename Attribute> + struct default_transform_attribute<Attribute, Attribute> + { + typedef Attribute& type; + static Attribute& pre(Attribute& val) { return val; } + static void post(Attribute&, Attribute const&) {} + static void fail(Attribute&) {} + }; + + template <typename Exposed, typename Transformed> + struct proxy_transform_attribute + { + typedef Transformed type; + + static Transformed pre(Exposed& val) { return Transformed(val); } + static void post(Exposed&, Transformed const&) { /* no-op */ } + + // fail() will be called by Qi rule's if the rhs failed parsing + static void fail(Exposed&) {} + }; + + // handle case where no transformation is required as the types are the same + template <typename Attribute> + struct proxy_transform_attribute<Attribute, Attribute> + { + typedef Attribute& type; + static Attribute& pre(Attribute& val) { return val; } + static void post(Attribute&, Attribute const&) {} + static void fail(Attribute&) {} + }; + + // main specialization for Qi + template <typename Exposed, typename Transformed, typename Enable = void> + struct transform_attribute + : mpl::if_< + mpl::and_< + mpl::not_<is_const<Exposed> > + , mpl::not_<is_reference<Exposed> > + , traits::is_proxy<Transformed> > + , proxy_transform_attribute<Exposed, Transformed> + , default_transform_attribute<Exposed, Transformed> + >::type + {}; + + template <typename Exposed, typename Transformed> + struct transform_attribute<boost::optional<Exposed>, Transformed + , typename disable_if<is_same<boost::optional<Exposed>, Transformed> >::type> + { + typedef Transformed& type; + static Transformed& pre(boost::optional<Exposed>& val) + { + if (!val) + val = Transformed(); + return boost::get<Transformed>(val); + } + static void post(boost::optional<Exposed>&, Transformed const&) {} + static void fail(boost::optional<Exposed>& val) + { + val = none_t(); // leave optional uninitialized if rhs failed + } + }; + + // reference types need special handling + template <typename Attribute> + struct transform_attribute<Attribute&, Attribute> + { + typedef Attribute& type; + static Attribute& pre(Attribute& val) { return val; } + static void post(Attribute&, Attribute const&) {} + static void fail(Attribute&) {} + }; + + // unused_type needs some special handling as well + template <> + struct transform_attribute<unused_type, unused_type> + { + typedef unused_type type; + static unused_type pre(unused_type) { return unused; } + static void post(unused_type, unused_type) {} + static void fail(unused_type) {} + }; + + template <> + struct transform_attribute<unused_type const, unused_type> + : transform_attribute<unused_type, unused_type> + {}; + + template <typename Attribute> + struct transform_attribute<unused_type, Attribute> + : transform_attribute<unused_type, unused_type> + {}; + + template <typename Attribute> + struct transform_attribute<unused_type const, Attribute> + : transform_attribute<unused_type, unused_type> + {}; + + template <typename Attribute> + struct transform_attribute<Attribute, unused_type> + : transform_attribute<unused_type, unused_type> + {}; + + template <typename Attribute> + struct transform_attribute<Attribute const, unused_type> + : transform_attribute<unused_type, unused_type> + {}; +}}} + +/////////////////////////////////////////////////////////////////////////////// +namespace boost { namespace spirit { namespace traits +{ + template <typename Exposed, typename Transformed> + struct transform_attribute<Exposed, Transformed, qi::domain> + : qi::transform_attribute<Exposed, Transformed> + {}; + + template <typename Exposed, typename Transformed> + struct transform_attribute<Exposed&, Transformed, qi::domain> + : transform_attribute<Exposed, Transformed, qi::domain> + {}; + + template <typename Attribute> + struct transform_attribute<Attribute&, Attribute, qi::domain> + : qi::transform_attribute<Attribute&, Attribute> + {}; + + /////////////////////////////////////////////////////////////////////////// + template <typename Exposed, typename Transformed> + void post_transform(Exposed& dest, Transformed const& attr) + { + return transform_attribute<Exposed, Transformed, qi::domain>::post(dest, attr); + } + + /////////////////////////////////////////////////////////////////////////// + template <typename Exposed, typename Transformed> + void fail_transform(Exposed& dest, Transformed const&) + { + return transform_attribute<Exposed, Transformed, qi::domain>::fail(dest); + } +}}} + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/qi/detail/construct.hpp b/3rdParty/Boost/src/boost/spirit/home/qi/detail/construct.hpp new file mode 100644 index 0000000..5d8122f --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/qi/detail/construct.hpp @@ -0,0 +1,202 @@ +/*============================================================================= + Copyright (c) 2001-2011 Hartmut Kaiser + http://spirit.sourceforge.net/ + + 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_CONSTRUCT_MAR_24_2007_0629PM) +#define BOOST_SPIRIT_CONSTRUCT_MAR_24_2007_0629PM + +#if defined(_MSC_VER) +#pragma once +#endif + +#include <boost/config.hpp> +#include <boost/spirit/home/qi/parse.hpp> +#include <boost/spirit/home/support/common_terminals.hpp> +#include <boost/spirit/home/support/attributes_fwd.hpp> + +namespace boost { namespace spirit { namespace traits +{ + /////////////////////////////////////////////////////////////////////////// + // We provide overloads for the assign_to_attribute_from_iterators + // customization point for all built in types + /////////////////////////////////////////////////////////////////////////// + template <typename Iterator> + struct assign_to_attribute_from_iterators<char, Iterator> + { + static void + call(Iterator const& first, Iterator const&, char& attr) + { + attr = *first; + } + }; + + template <typename Iterator> + struct assign_to_attribute_from_iterators<signed char, Iterator> + { + static void + call(Iterator const& first, Iterator const&, signed char& attr) + { + attr = *first; + } + }; + + template <typename Iterator> + struct assign_to_attribute_from_iterators<unsigned char, Iterator> + { + static void + call(Iterator const& first, Iterator const&, unsigned char& attr) + { + attr = *first; + } + }; + + // wchar_t is intrinsic + template <typename Iterator> + struct assign_to_attribute_from_iterators<wchar_t, Iterator> + { + static void + call(Iterator const& first, Iterator const&, wchar_t& attr) + { + attr = *first; + } + }; + +#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) + // wchar_t is intrinsic, have separate overload for unsigned short + template <typename Iterator> + struct assign_to_attribute_from_iterators<unsigned short, Iterator> + { + static void + call(Iterator const& first, Iterator const&, unsigned short& attr) + { + attr = *first; + } + }; +#endif + + template <typename Iterator> + struct assign_to_attribute_from_iterators<bool, Iterator> + { + static void + call(Iterator const& first, Iterator const& last, bool& attr) + { + Iterator first_ = first; + qi::parse(first_, last, bool_type(), attr); + } + }; + + template <typename Iterator> + struct assign_to_attribute_from_iterators<short, Iterator> + { + static void + call(Iterator const& first, Iterator const& last, short& attr) + { + Iterator first_ = first; + qi::parse(first_, last, short_type(), attr); + } + }; + + template <typename Iterator> + struct assign_to_attribute_from_iterators<int, Iterator> + { + static void + call(Iterator const& first, Iterator const& last, int& attr) + { + Iterator first_ = first; + qi::parse(first_, last, int_type(), attr); + } + }; + template <typename Iterator> + struct assign_to_attribute_from_iterators<unsigned int, Iterator> + { + static void + call(Iterator const& first, Iterator const& last, unsigned int& attr) + { + Iterator first_ = first; + qi::parse(first_, last, uint_type(), attr); + } + }; + + template <typename Iterator> + struct assign_to_attribute_from_iterators<long, Iterator> + { + static void + call(Iterator const& first, Iterator const& last, long& attr) + { + Iterator first_ = first; + qi::parse(first_, last, long_type(), attr); + } + }; + template <typename Iterator> + struct assign_to_attribute_from_iterators<unsigned long, Iterator> + { + static void + call(Iterator const& first, Iterator const& last, unsigned long& attr) + { + Iterator first_ = first; + qi::parse(first_, last, ulong_type(), attr); + } + }; + +#ifdef BOOST_HAS_LONG_LONG + template <typename Iterator> + struct assign_to_attribute_from_iterators<long_long_type, Iterator> + { + static void + call(Iterator const& first, Iterator const& last, long_long_type& attr) + { + Iterator first_ = first; + qi::parse(first_, last, long_long_type(), attr); + } + }; + template <typename Iterator> + struct assign_to_attribute_from_iterators<ulong_long_type, Iterator> + { + static void + call(Iterator const& first, Iterator const& last, ulong_long_type& attr) + { + Iterator first_ = first; + qi::parse(first_, last, ulong_long_type(), attr); + } + }; +#endif + + template <typename Iterator> + struct assign_to_attribute_from_iterators<float, Iterator> + { + static void + call(Iterator const& first, Iterator const& last, float& attr) + { + Iterator first_ = first; + qi::parse(first_, last, float_type(), attr); + } + }; + + template <typename Iterator> + struct assign_to_attribute_from_iterators<double, Iterator> + { + static void + call(Iterator const& first, Iterator const& last, double& attr) + { + Iterator first_ = first; + qi::parse(first_, last, double_type(), attr); + } + }; + + template <typename Iterator> + struct assign_to_attribute_from_iterators<long double, Iterator> + { + static void + call(Iterator const& first, Iterator const& last, long double& attr) + { + Iterator first_ = first; + qi::parse(first_, last, long_double_type(), attr); + } + }; + +}}} + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/qi/detail/parse.hpp b/3rdParty/Boost/src/boost/spirit/home/qi/detail/parse.hpp new file mode 100644 index 0000000..b81f1e7 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/qi/detail/parse.hpp @@ -0,0 +1,97 @@ +/*============================================================================= + 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_DETAIL_PARSE_DEC_02_2009_0411PM) +#define BOOST_SPIRIT_DETAIL_PARSE_DEC_02_2009_0411PM + +#if defined(_MSC_VER) +#pragma once +#endif + +#include <boost/spirit/home/qi/meta_compiler.hpp> +#include <boost/spirit/home/qi/skip_flag.hpp> +#include <boost/spirit/home/qi/skip_over.hpp> +#include <boost/spirit/home/support/unused.hpp> +#include <boost/mpl/assert.hpp> +#include <boost/mpl/bool.hpp> + +namespace boost { namespace spirit { namespace qi { namespace detail +{ + /////////////////////////////////////////////////////////////////////////// + template <typename Expr, typename Enable = void> + struct parse_impl + { + // Report invalid expression error as early as possible. + // If you got an error_invalid_expression error message here, + // then the expression (expr) is not a valid spirit qi expression. + // Did you intend to use the auto_ facilities while forgetting to + // #include <boost/spirit/include/qi_auto.hpp>? + BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr); + }; + + template <typename Expr> + struct parse_impl<Expr + , typename enable_if<traits::matches<qi::domain, Expr> >::type> + { + template <typename Iterator> + static bool call( + Iterator& first + , Iterator last + , Expr const& expr) + { + return compile<qi::domain>(expr).parse( + first, last, unused, unused, unused); + } + }; + + /////////////////////////////////////////////////////////////////////////// + template <typename Expr, typename Enable = void> + struct phrase_parse_impl + { + // Report invalid expression error as early as possible. + // If you got an error_invalid_expression error message here, + // then the expression (expr) is not a valid spirit qi expression. + // Did you intend to use the auto_ facilities while forgetting to + // #include <boost/spirit/include/qi_auto.hpp>? + BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr); + }; + + template <typename Expr> + struct phrase_parse_impl<Expr + , typename enable_if<traits::matches<qi::domain, Expr> >::type> + { + template <typename Iterator, typename Skipper> + static bool call( + Iterator& first + , Iterator last + , Expr const& expr + , Skipper const& skipper + , BOOST_SCOPED_ENUM(skip_flag) post_skip) + { + // Report invalid expression error as early as possible. + // If you got an error_invalid_expression error message here, + // then the skipper is not a valid spirit qi expression. + BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper); + + typedef + typename result_of::compile<qi::domain, Skipper>::type + skipper_type; + skipper_type const skipper_ = compile<qi::domain>(skipper); + + if (!compile<qi::domain>(expr).parse( + first, last, unused, skipper_, unused)) + return false; + + if (post_skip == skip_flag::postskip) + qi::skip_over(first, last, skipper_); + return true; + } + }; + +}}}} + +#endif + diff --git a/3rdParty/Boost/src/boost/spirit/home/qi/detail/unused_skipper.hpp b/3rdParty/Boost/src/boost/spirit/home/qi/detail/unused_skipper.hpp new file mode 100644 index 0000000..c1405d6 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/qi/detail/unused_skipper.hpp @@ -0,0 +1,50 @@ +// 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_QI_UNUSED_SKIPPER_JUL_25_2009_0921AM) +#define BOOST_SPIRIT_QI_UNUSED_SKIPPER_JUL_25_2009_0921AM + +#if defined(_MSC_VER) +#pragma once +#endif + +#include <boost/spirit/home/support/unused.hpp> + +namespace boost { namespace spirit { namespace qi { namespace detail +{ + template <typename Skipper> + struct unused_skipper : unused_type + { + unused_skipper(Skipper const& skipper) + : skipper(skipper) {} + Skipper const& skipper; + + private: + // silence MSVC warning C4512: assignment operator could not be generated + unused_skipper& operator= (unused_skipper const&); + }; + + // If a surrounding lexeme[] directive was specified, the current + // skipper is of the type unused_skipper. In this case we + // re-activate the skipper which was active before the skip[] + // directive. + template <typename Skipper> + inline Skipper const& + get_skipper(unused_skipper<Skipper> const& u) + { + return u.skipper; + } + + // If no surrounding lexeme[] directive was specified we keep what we got. + template <typename Skipper> + inline Skipper const& + get_skipper(Skipper const& u) + { + return u; + } + +}}}} + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/qi/domain.hpp b/3rdParty/Boost/src/boost/spirit/home/qi/domain.hpp new file mode 100644 index 0000000..cc6b8c3 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/qi/domain.hpp @@ -0,0 +1,74 @@ +/*============================================================================= + 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_DOMAIN_JANUARY_29_2007_0954AM) +#define BOOST_SPIRIT_DOMAIN_JANUARY_29_2007_0954AM + +#if defined(_MSC_VER) +#pragma once +#endif + +#include <boost/spirit/home/support/unused.hpp> +#include <boost/spirit/home/support/meta_compiler.hpp> +#include <boost/spirit/home/support/info.hpp> +#include <boost/spirit/home/support/argument.hpp> +#include <boost/spirit/home/support/context.hpp> + +#include <boost/preprocessor/repeat.hpp> +#include <boost/preprocessor/cat.hpp> + +namespace boost { namespace spirit { namespace qi +{ + // qi's domain + struct domain {}; + + // bring in some of spirit parts into spirit::qi + using spirit::unused; + using spirit::unused_type; + using spirit::compile; + using spirit::info; + + // You can bring these in with the using directive + // without worrying about bringing in too much. + namespace labels + { + BOOST_PP_REPEAT(SPIRIT_ARGUMENTS_LIMIT, SPIRIT_USING_ARGUMENT, _) + BOOST_PP_REPEAT(SPIRIT_ATTRIBUTES_LIMIT, SPIRIT_USING_ATTRIBUTE, _) + + using spirit::_pass_type; + using spirit::_val_type; + using spirit::_a_type; + using spirit::_b_type; + using spirit::_c_type; + using spirit::_d_type; + using spirit::_e_type; + using spirit::_f_type; + using spirit::_g_type; + using spirit::_h_type; + using spirit::_i_type; + using spirit::_j_type; + +#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS + + using spirit::_pass; + using spirit::_val; + using spirit::_a; + using spirit::_b; + using spirit::_c; + using spirit::_d; + using spirit::_e; + using spirit::_f; + using spirit::_g; + using spirit::_h; + using spirit::_i; + using spirit::_j; + +#endif + } + +}}} + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/qi/meta_compiler.hpp b/3rdParty/Boost/src/boost/spirit/home/qi/meta_compiler.hpp new file mode 100644 index 0000000..68649c0 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/qi/meta_compiler.hpp @@ -0,0 +1,177 @@ +/*============================================================================= + 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_META_COMPILER_OCTOBER_16_2008_0347PM) +#define BOOST_SPIRIT_META_COMPILER_OCTOBER_16_2008_0347PM + +#if defined(_MSC_VER) +#pragma once +#endif + +#include <boost/spirit/home/support/meta_compiler.hpp> +#include <boost/spirit/home/qi/domain.hpp> +#include <boost/spirit/home/qi/parser.hpp> +#include <boost/spirit/home/support/string_traits.hpp> +#include <boost/type_traits/remove_reference.hpp> +#include <boost/utility/enable_if.hpp> +#include <boost/fusion/include/at.hpp> + +namespace boost { namespace spirit +{ + template <typename T> + struct use_terminal<qi::domain, T + , typename enable_if<traits::is_parser<T> >::type> // enables parsers + : mpl::true_ {}; + + namespace qi + { + template <typename T, typename Modifiers, typename Enable = void> + struct make_primitive // by default, return it as-is + { + typedef T result_type; + + template <typename T_> + T_& operator()(T_& val, unused_type) const + { + return val; + } + + template <typename T_> + T_ const& operator()(T_ const& val, unused_type) const + { + return val; + } + }; + + template <typename Tag, typename Elements + , typename Modifiers, typename Enable = void> + struct make_composite; + + template <typename Directive, typename Body + , typename Modifiers, typename Enable = void> + struct make_directive + { + typedef Body result_type; + result_type operator()(unused_type, Body const& body, unused_type) const + { + return body; // By default, a directive simply returns its subject + } + }; + } + + // Qi primitive meta-compiler + template <> + struct make_component<qi::domain, proto::tag::terminal> + { + template <typename Sig> + struct result; + + template <typename This, typename Elements, typename Modifiers> + struct result<This(Elements, Modifiers)> + { + typedef typename qi::make_primitive< + typename remove_const<typename Elements::car_type>::type, + typename remove_reference<Modifiers>::type>::result_type + type; + }; + + template <typename Elements, typename Modifiers> + typename result<make_component(Elements, Modifiers)>::type + operator()(Elements const& elements, Modifiers const& modifiers) const + { + typedef typename remove_const<typename Elements::car_type>::type term; + return qi::make_primitive<term, Modifiers>()(elements.car, modifiers); + } + }; + + // Qi composite meta-compiler + template <typename Tag> + struct make_component<qi::domain, Tag> + { + template <typename Sig> + struct result; + + template <typename This, typename Elements, typename Modifiers> + struct result<This(Elements, Modifiers)> + { + typedef typename + qi::make_composite<Tag, Elements, + typename remove_reference<Modifiers>::type>::result_type + type; + }; + + template <typename Elements, typename Modifiers> + typename result<make_component(Elements, Modifiers)>::type + operator()(Elements const& elements, Modifiers const& modifiers) const + { + return qi::make_composite<Tag, Elements, Modifiers>()( + elements, modifiers); + } + }; + + // Qi function meta-compiler + template <> + struct make_component<qi::domain, proto::tag::function> + { + template <typename Sig> + struct result; + + template <typename This, typename Elements, typename Modifiers> + struct result<This(Elements, Modifiers)> + { + typedef typename + qi::make_composite< + typename remove_const<typename Elements::car_type>::type, + typename Elements::cdr_type, + typename remove_reference<Modifiers>::type + >::result_type + type; + }; + + template <typename Elements, typename Modifiers> + typename result<make_component(Elements, Modifiers)>::type + operator()(Elements const& elements, Modifiers const& modifiers) const + { + return qi::make_composite< + typename remove_const<typename Elements::car_type>::type, + typename Elements::cdr_type, + Modifiers>()(elements.cdr, modifiers); + } + }; + + // Qi directive meta-compiler + template <> + struct make_component<qi::domain, tag::directive> + { + template <typename Sig> + struct result; + + template <typename This, typename Elements, typename Modifiers> + struct result<This(Elements, Modifiers)> + { + typedef typename + qi::make_directive< + typename remove_const<typename Elements::car_type>::type, + typename remove_const<typename Elements::cdr_type::car_type>::type, + typename remove_reference<Modifiers>::type + >::result_type + type; + }; + + template <typename Elements, typename Modifiers> + typename result<make_component(Elements, Modifiers)>::type + operator()(Elements const& elements, Modifiers const& modifiers) const + { + return qi::make_directive< + typename remove_const<typename Elements::car_type>::type, + typename remove_const<typename Elements::cdr_type::car_type>::type, + Modifiers>()(elements.car, elements.cdr.car, modifiers); + } + }; + +}} + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/qi/nonterminal/detail/fcall.hpp b/3rdParty/Boost/src/boost/spirit/home/qi/nonterminal/detail/fcall.hpp new file mode 100644 index 0000000..e4fa17f --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/qi/nonterminal/detail/fcall.hpp @@ -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) + + diff --git a/3rdParty/Boost/src/boost/spirit/home/qi/nonterminal/detail/parameterized.hpp b/3rdParty/Boost/src/boost/spirit/home/qi/nonterminal/detail/parameterized.hpp new file mode 100644 index 0000000..0300a06 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/qi/nonterminal/detail/parameterized.hpp @@ -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 diff --git a/3rdParty/Boost/src/boost/spirit/home/qi/nonterminal/detail/parser_binder.hpp b/3rdParty/Boost/src/boost/spirit/home/qi/nonterminal/detail/parser_binder.hpp new file mode 100644 index 0000000..91bceba --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/qi/nonterminal/detail/parser_binder.hpp @@ -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 diff --git a/3rdParty/Boost/src/boost/spirit/home/qi/nonterminal/grammar.hpp b/3rdParty/Boost/src/boost/spirit/home/qi/nonterminal/grammar.hpp new file mode 100644 index 0000000..982e49b --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/qi/nonterminal/grammar.hpp @@ -0,0 +1,132 @@ +/*============================================================================= + 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_GRAMMAR_FEBRUARY_19_2007_0236PM) +#define BOOST_SPIRIT_GRAMMAR_FEBRUARY_19_2007_0236PM + +#if defined(_MSC_VER) +#pragma once +#endif + +#include <boost/spirit/home/support/unused.hpp> +#include <boost/spirit/home/support/info.hpp> +#include <boost/spirit/home/support/assert_msg.hpp> +#include <boost/spirit/home/qi/domain.hpp> +#include <boost/spirit/home/qi/nonterminal/rule.hpp> +#include <boost/spirit/home/qi/nonterminal/nonterminal_fwd.hpp> +#include <boost/spirit/home/qi/reference.hpp> +#include <boost/noncopyable.hpp> +#include <boost/type_traits/is_same.hpp> + +namespace boost { namespace spirit { namespace qi +{ + template < + typename Iterator, typename T1, typename T2, typename T3 + , typename T4> + struct grammar + : proto::extends< + typename proto::terminal< + reference<rule<Iterator, T1, T2, T3, T4> const> + >::type + , grammar<Iterator, T1, T2, T3, T4> + > + , parser<grammar<Iterator, T1, T2, T3, T4> > + , noncopyable + { + typedef Iterator iterator_type; + typedef rule<Iterator, T1, T2, T3, T4> start_type; + typedef typename start_type::sig_type sig_type; + typedef typename start_type::locals_type locals_type; + typedef typename start_type::skipper_type skipper_type; + typedef typename start_type::encoding_type encoding_type; + typedef grammar<Iterator, T1, T2, T3, T4> base_type; + typedef reference<start_type const> reference_; + typedef typename proto::terminal<reference_>::type terminal; + + static size_t const params_size = start_type::params_size; + + template <typename Context, typename Iterator_> + struct attribute + { + typedef typename start_type::attr_type type; + }; + + grammar( + start_type const& start + , std::string const& name_ = "unnamed-grammar") + : proto::extends<terminal, base_type>(terminal::make(reference_(start))) + , name_(name_) + {} + + // This constructor is used to catch if the start rule is not + // compatible with the grammar. + template <typename Iterator_, + typename T1_, typename T2_, typename T3_, typename T4_> + grammar( + rule<Iterator_, T1_, T2_, T3_, T4_> const& + , std::string const& = "unnamed-grammar") + { + // If you see the assertion below failing then the start rule + // passed to the constructor of the grammar is not compatible with + // the grammar (i.e. it uses different template parameters). + BOOST_SPIRIT_ASSERT_MSG( + (is_same<start_type, rule<Iterator_, T1_, T2_, T3_, T4_> >::value) + , incompatible_start_rule, (rule<Iterator_, T1_, T2_, T3_, T4_>)); + } + + std::string name() const + { + return name_; + } + + void name(std::string const& str) + { + name_ = str; + } + + template <typename Context, typename Skipper, typename Attribute> + bool parse(Iterator& first, Iterator const& last + , Context& context, Skipper const& skipper + , Attribute& attr) const + { + return this->proto_base().child0.parse( + first, last, context, skipper, attr); + } + + template <typename Context> + info what(Context&) const + { + return info(name_); + } + + // bring in the operator() overloads + start_type const& get_parameterized_subject() const + { return this->proto_base().child0.ref.get(); } + typedef start_type parameterized_subject_type; + #include <boost/spirit/home/qi/nonterminal/detail/fcall.hpp> + + std::string name_; + + }; +}}} + +namespace boost { namespace spirit { namespace traits +{ + /////////////////////////////////////////////////////////////////////////// + template < + typename IteratorA, typename IteratorB, typename Attribute + , typename Context, typename T1, typename T2, typename T3, typename T4> + struct handles_container< + qi::grammar<IteratorA, T1, T2, T3, T4>, Attribute, Context, IteratorB> + : traits::is_container< + typename attribute_of< + qi::grammar<IteratorA, T1, T2, T3, T4>, Context, IteratorB + >::type + > + {}; +}}} + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/qi/nonterminal/nonterminal_fwd.hpp b/3rdParty/Boost/src/boost/spirit/home/qi/nonterminal/nonterminal_fwd.hpp new file mode 100644 index 0000000..9e39345 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/qi/nonterminal/nonterminal_fwd.hpp @@ -0,0 +1,31 @@ +// 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_QI_NONTERMINAL_FWD_DEC_24_2010_1105PM) +#define BOOST_SPIRIT_QI_NONTERMINAL_FWD_DEC_24_2010_1105PM + +#if defined(_MSC_VER) +#pragma once +#endif + +#include <boost/spirit/home/support/unused.hpp> + +namespace boost { namespace spirit { namespace qi +{ + // forward declaration only + template < + typename Iterator, typename T1 = unused_type + , typename T2 = unused_type, typename T3 = unused_type + , typename T4 = unused_type> + struct rule; + + template < + typename Iterator, typename T1 = unused_type + , typename T2 = unused_type, typename T3 = unused_type + , typename T4 = unused_type> + struct grammar; +}}} + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/qi/nonterminal/rule.hpp b/3rdParty/Boost/src/boost/spirit/home/qi/nonterminal/rule.hpp new file mode 100644 index 0000000..23d2559 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/qi/nonterminal/rule.hpp @@ -0,0 +1,439 @@ +/*============================================================================= + 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_RULE_FEBRUARY_12_2007_1020AM) +#define BOOST_SPIRIT_RULE_FEBRUARY_12_2007_1020AM + +#if defined(_MSC_VER) +#pragma once +#endif + +#include <boost/assert.hpp> +#include <boost/config.hpp> +#include <boost/function.hpp> +#include <boost/mpl/vector.hpp> +#include <boost/type_traits/add_reference.hpp> +#include <boost/type_traits/is_same.hpp> + +#include <boost/fusion/include/vector.hpp> +#include <boost/fusion/include/size.hpp> +#include <boost/fusion/include/make_vector.hpp> +#include <boost/fusion/include/cons.hpp> +#include <boost/fusion/include/as_list.hpp> +#include <boost/fusion/include/as_vector.hpp> + +#include <boost/spirit/home/support/unused.hpp> +#include <boost/spirit/home/support/argument.hpp> +#include <boost/spirit/home/support/context.hpp> +#include <boost/spirit/home/support/info.hpp> +#include <boost/spirit/home/qi/detail/attributes.hpp> +#include <boost/spirit/home/support/nonterminal/extract_param.hpp> +#include <boost/spirit/home/support/nonterminal/locals.hpp> +#include <boost/spirit/home/qi/reference.hpp> +#include <boost/spirit/home/qi/nonterminal/detail/parameterized.hpp> +#include <boost/spirit/home/qi/nonterminal/detail/parser_binder.hpp> +#include <boost/spirit/home/qi/nonterminal/nonterminal_fwd.hpp> +#include <boost/spirit/home/qi/skip_over.hpp> + +#if defined(BOOST_MSVC) +# pragma warning(push) +# pragma warning(disable: 4355) // 'this' : used in base member initializer list warning +#endif + +namespace boost { namespace spirit { namespace qi +{ + BOOST_PP_REPEAT(SPIRIT_ATTRIBUTES_LIMIT, SPIRIT_USING_ATTRIBUTE, _) + + using spirit::_pass_type; + using spirit::_val_type; + using spirit::_a_type; + using spirit::_b_type; + using spirit::_c_type; + using spirit::_d_type; + using spirit::_e_type; + using spirit::_f_type; + using spirit::_g_type; + using spirit::_h_type; + using spirit::_i_type; + using spirit::_j_type; + +#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS + + using spirit::_pass; + using spirit::_val; + using spirit::_a; + using spirit::_b; + using spirit::_c; + using spirit::_d; + using spirit::_e; + using spirit::_f; + using spirit::_g; + using spirit::_h; + using spirit::_i; + using spirit::_j; + +#endif + + using spirit::info; + using spirit::locals; + + template < + typename Iterator, typename T1, typename T2, typename T3 + , typename T4> + struct rule + : proto::extends< + typename proto::terminal< + reference<rule<Iterator, T1, T2, T3, T4> const> + >::type + , rule<Iterator, T1, T2, T3, T4> + > + , parser<rule<Iterator, T1, T2, T3, T4> > + { + typedef Iterator iterator_type; + typedef rule<Iterator, T1, T2, T3, T4> this_type; + typedef reference<this_type const> reference_; + typedef typename proto::terminal<reference_>::type terminal; + typedef proto::extends<terminal, this_type> base_type; + typedef mpl::vector<T1, T2, T3, T4> template_params; + + // The rule's locals_type: a sequence of types to be used as local variables + typedef typename + spirit::detail::extract_locals<template_params>::type + locals_type; + + // The rule's skip-parser type + typedef typename + spirit::detail::extract_component< + qi::domain, template_params>::type + skipper_type; + + // The rule's signature + typedef typename + spirit::detail::extract_sig<template_params>::type + sig_type; + + // The rule's encoding type + typedef typename + spirit::detail::extract_encoding<template_params>::type + encoding_type; + + // This is the rule's attribute type + typedef typename + spirit::detail::attr_from_sig<sig_type>::type + attr_type; + typedef typename add_reference<attr_type>::type attr_reference_type; + + // parameter_types is a sequence of types passed as parameters to the rule + typedef typename + spirit::detail::params_from_sig<sig_type>::type + parameter_types; + + static size_t const params_size = + fusion::result_of::size<parameter_types>::type::value; + + typedef context< + fusion::cons<attr_reference_type, parameter_types> + , locals_type> + context_type; + + typedef function< + bool(Iterator& first, Iterator const& last + , context_type& context + , skipper_type const& skipper + )> + function_type; + + typedef typename + mpl::if_< + is_same<encoding_type, unused_type> + , unused_type + , tag::char_code<tag::encoding, encoding_type> + >::type + encoding_modifier_type; + + explicit rule(std::string const& name_ = "unnamed-rule") + : base_type(terminal::make(reference_(*this))) + , name_(name_) + { + } + + rule(rule const& rhs) + : base_type(terminal::make(reference_(*this))) + , name_(rhs.name_) + , f(rhs.f) + { + } + + template <typename Auto, typename Expr> + static void define(rule& lhs, Expr const& expr, mpl::false_) + { + // Report invalid expression error as early as possible. + // If you got an error_invalid_expression error message here, + // then the expression (expr) is not a valid spirit qi expression. + BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr); + } + + template <typename Auto, typename Expr> + static void define(rule& lhs, Expr const& expr, mpl::true_) + { + lhs.f = detail::bind_parser<Auto>( + compile<qi::domain>(expr, encoding_modifier_type())); + } + + template <typename Expr> + rule(Expr const& expr, std::string const& name_ = "unnamed-rule") + : base_type(terminal::make(reference_(*this))) + , name_(name_) + { + define<mpl::false_>(*this, expr, traits::matches<qi::domain, Expr>()); + } + + rule& operator=(rule const& rhs) + { + // The following assertion fires when you try to initialize a rule + // from an uninitialized one. Did you mean to refer to the right + // hand side rule instead of assigning from it? In this case you + // should write lhs = rhs.alias(); + BOOST_ASSERT(rhs.f && "Did you mean rhs.alias() instead of rhs?"); + + f = rhs.f; + name_ = rhs.name_; + return *this; + } + + std::string const& name() const + { + return name_; + } + + void name(std::string const& str) + { + name_ = str; + } + + template <typename Expr> + rule& operator=(Expr const& expr) + { + define<mpl::false_>(*this, expr, traits::matches<qi::domain, Expr>()); + return *this; + } + +// VC7.1 has problems to resolve 'rule' without explicit template parameters +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400) + // g++ 3.3 barfs if this is a member function :( + template <typename Expr> + friend rule& operator%=(rule& r, Expr const& expr) + { + define<mpl::true_>(r, expr, traits::matches<qi::domain, Expr>()); + return r; + } + +#if defined(BOOST_NO_RVALUE_REFERENCES) + // non-const version needed to suppress proto's %= kicking in + template <typename Expr> + friend rule& operator%=(rule& r, Expr& expr) + { + return r %= static_cast<Expr const&>(expr); + } +#else + // for rvalue references + template <typename Expr> + friend rule& operator%=(rule& r, Expr&& expr) + { + define<mpl::true_>(r, expr, traits::matches<qi::domain, Expr>()); + return r; + } +#endif + +#else + // both friend functions have to be defined out of class as VC7.1 + // will complain otherwise + template <typename OutputIterator_, typename T1_, typename T2_ + , typename T3_, typename T4_, typename Expr> + friend rule<OutputIterator_, T1_, T2_, T3_, T4_>& operator%=( + rule<OutputIterator_, T1_, T2_, T3_, T4_>& r, Expr const& expr); + + // non-const version needed to suppress proto's %= kicking in + template <typename OutputIterator_, typename T1_, typename T2_ + , typename T3_, typename T4_, typename Expr> + friend rule<OutputIterator_, T1_, T2_, T3_, T4_>& operator%=( + rule<OutputIterator_, T1_, T2_, T3_, T4_>& r, Expr& expr); +#endif + + template <typename Context, typename Iterator_> + struct attribute + { + typedef attr_type type; + }; + + template <typename Context, typename Skipper, typename Attribute> + bool parse(Iterator& first, Iterator const& last + , Context& /*context*/, Skipper const& skipper + , Attribute& attr) const + { + if (f) + { + // do a preskip if this is an implied lexeme + if (is_same<skipper_type, unused_type>::value) + qi::skip_over(first, last, skipper); + + typedef traits::make_attribute<attr_type, Attribute> make_attribute; + + // do down-stream transformation, provides attribute for + // rhs parser + typedef traits::transform_attribute< + typename make_attribute::type, attr_type, domain> + transform; + + typename make_attribute::type made_attr = make_attribute::call(attr); + typename transform::type attr_ = transform::pre(made_attr); + + // If you are seeing a compilation error here, you are probably + // trying to use a rule or a grammar which has inherited + // attributes, without passing values for them. + context_type context(attr_); + + // If you are seeing a compilation error here stating that the + // fourth parameter can't be converted to a required target type + // then you are probably trying to use a rule or a grammar with + // an incompatible skipper type. + if (f(first, last, context, skipper)) + { + // do up-stream transformation, this integrates the results + // back into the original attribute value, if appropriate + traits::post_transform(attr, attr_); + return true; + } + + // inform attribute transformation of failed rhs + traits::fail_transform(attr, attr_); + } + return false; + } + + template <typename Context, typename Skipper + , typename Attribute, typename Params> + bool parse(Iterator& first, Iterator const& last + , Context& caller_context, Skipper const& skipper + , Attribute& attr, Params const& params) const + { + if (f) + { + // do a preskip if this is an implied lexeme + if (is_same<skipper_type, unused_type>::value) + qi::skip_over(first, last, skipper); + + typedef traits::make_attribute<attr_type, Attribute> make_attribute; + + // do down-stream transformation, provides attribute for + // rhs parser + typedef traits::transform_attribute< + typename make_attribute::type, attr_type, domain> + transform; + + typename make_attribute::type made_attr = make_attribute::call(attr); + typename transform::type attr_ = transform::pre(made_attr); + + // If you are seeing a compilation error here, you are probably + // trying to use a rule or a grammar which has inherited + // attributes, passing values of incompatible types for them. + context_type context(attr_, params, caller_context); + + // If you are seeing a compilation error here stating that the + // fourth parameter can't be converted to a required target type + // then you are probably trying to use a rule or a grammar with + // an incompatible skipper type. + if (f(first, last, context, skipper)) + { + // do up-stream transformation, this integrates the results + // back into the original attribute value, if appropriate + traits::post_transform(attr, attr_); + return true; + } + + // inform attribute transformation of failed rhs + traits::fail_transform(attr, attr_); + } + return false; + } + + template <typename Context> + info what(Context& /*context*/) const + { + return info(name_); + } + + reference_ alias() const + { + return reference_(*this); + } + + typename proto::terminal<this_type>::type copy() const + { + typename proto::terminal<this_type>::type result = {*this}; + return result; + } + + // bring in the operator() overloads + rule const& get_parameterized_subject() const { return *this; } + typedef rule parameterized_subject_type; + #include <boost/spirit/home/qi/nonterminal/detail/fcall.hpp> + + std::string name_; + function_type f; + }; + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1400) + template <typename OutputIterator_, typename T1_, typename T2_ + , typename T3_, typename T4_, typename Expr> + rule<OutputIterator_, T1_, T2_, T3_, T4_>& operator%=( + rule<OutputIterator_, T1_, T2_, T3_, T4_>& r, Expr const& expr) + { + // Report invalid expression error as early as possible. + // If you got an error_invalid_expression error message here, + // then the expression (expr) is not a valid spirit qi expression. + BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr); + + typedef typename + rule<OutputIterator_, T1_, T2_, T3_, T4_>::encoding_modifier_type + encoding_modifier_type; + + r.f = detail::bind_parser<mpl::true_>( + compile<qi::domain>(expr, encoding_modifier_type())); + return r; + } + + template <typename Iterator_, typename T1_, typename T2_ + , typename T3_, typename T4_, typename Expr> + rule<Iterator_, T1_, T2_, T3_, T4_>& operator%=( + rule<Iterator_, T1_, T2_, T3_, T4_>& r, Expr& expr) + { + return r %= static_cast<Expr const&>(expr); + } +#endif +}}} + +namespace boost { namespace spirit { namespace traits +{ + /////////////////////////////////////////////////////////////////////////// + template < + typename IteratorA, typename IteratorB, typename Attribute + , typename Context, typename T1, typename T2, typename T3, typename T4> + struct handles_container< + qi::rule<IteratorA, T1, T2, T3, T4>, Attribute, Context, IteratorB> + : traits::is_container< + typename attribute_of< + qi::rule<IteratorA, T1, T2, T3, T4>, Context, IteratorB + >::type + > + {}; +}}} + +#if defined(BOOST_MSVC) +# pragma warning(pop) +#endif + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/qi/parse.hpp b/3rdParty/Boost/src/boost/spirit/home/qi/parse.hpp new file mode 100644 index 0000000..261df75 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/qi/parse.hpp @@ -0,0 +1,215 @@ +/*============================================================================= + 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_PARSE_APRIL_16_2006_0442PM) +#define BOOST_SPIRIT_PARSE_APRIL_16_2006_0442PM + +#if defined(_MSC_VER) +#pragma once +#endif + +#include <boost/spirit/home/support/context.hpp> +#include <boost/spirit/home/support/nonterminal/locals.hpp> +#include <boost/spirit/home/qi/detail/parse.hpp> +#include <boost/concept_check.hpp> + +namespace boost { namespace spirit { namespace qi +{ + /////////////////////////////////////////////////////////////////////////// + template <typename Iterator, typename Expr> + inline bool + parse( + Iterator& first + , Iterator last + , Expr const& expr) + { + // Make sure the iterator is at least a forward_iterator. If you got a + // compilation error here, then you are using an input_iterator while + // calling this function, you need to supply at least a + // forward_iterator instead. + BOOST_CONCEPT_ASSERT((ForwardIterator<Iterator>)); + + return detail::parse_impl<Expr>::call(first, last, expr); + } + + template <typename Iterator, typename Expr> + inline bool + parse( + Iterator const& first_ + , Iterator last + , Expr const& expr) + { + Iterator first = first_; + return qi::parse(first, last, expr); + } + + /////////////////////////////////////////////////////////////////////////// + namespace detail + { + template <typename T> + struct make_context + { + typedef context<fusion::cons<T&>, locals<> > type; + }; + + template <> + struct make_context<unused_type> + { + typedef unused_type type; + }; + } + + template <typename Iterator, typename Expr, typename Attr> + inline bool + parse( + Iterator& first + , Iterator last + , Expr const& expr + , Attr& attr) + { + // Make sure the iterator is at least a forward_iterator. If you got a + // compilation error here, then you are using an input_iterator while + // calling this function, you need to supply at least a + // forward_iterator instead. + BOOST_CONCEPT_ASSERT((ForwardIterator<Iterator>)); + + // Report invalid expression error as early as possible. + // If you got an error_invalid_expression error message here, + // then the expression (expr) is not a valid spirit qi expression. + BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr); + + typename detail::make_context<Attr>::type context(attr); + return compile<qi::domain>(expr).parse(first, last, context, unused, attr); + } + + template <typename Iterator, typename Expr, typename Attr> + inline bool + parse( + Iterator const& first_ + , Iterator last + , Expr const& expr + , Attr& attr) + { + Iterator first = first_; + return qi::parse(first, last, expr, attr); + } + + /////////////////////////////////////////////////////////////////////////// + template <typename Iterator, typename Expr, typename Skipper> + inline bool + phrase_parse( + Iterator& first + , Iterator last + , Expr const& expr + , Skipper const& skipper + , BOOST_SCOPED_ENUM(skip_flag) post_skip = skip_flag::postskip) + { + // Make sure the iterator is at least a forward_iterator. If you got a + // compilation error here, then you are using an input_iterator while + // calling this function, you need to supply at least a + // forward_iterator instead. + BOOST_CONCEPT_ASSERT((ForwardIterator<Iterator>)); + + return detail::phrase_parse_impl<Expr>::call( + first, last, expr, skipper, post_skip); + } + + template <typename Iterator, typename Expr, typename Skipper> + inline bool + phrase_parse( + Iterator const& first_ + , Iterator last + , Expr const& expr + , Skipper const& skipper + , BOOST_SCOPED_ENUM(skip_flag) post_skip = skip_flag::postskip) + { + Iterator first = first_; + return qi::phrase_parse(first, last, expr, skipper, post_skip); + } + + /////////////////////////////////////////////////////////////////////////// + template <typename Iterator, typename Expr, typename Skipper, typename Attr> + inline bool + phrase_parse( + Iterator& first + , Iterator last + , Expr const& expr + , Skipper const& skipper + , BOOST_SCOPED_ENUM(skip_flag) post_skip + , Attr& attr) + { + // Make sure the iterator is at least a forward_iterator. If you got a + // compilation error here, then you are using an input_iterator while + // calling this function, you need to supply at least a + // forward_iterator instead. + BOOST_CONCEPT_ASSERT((ForwardIterator<Iterator>)); + + // Report invalid expression error as early as possible. + // If you got an error_invalid_expression error message here, + // then either the expression (expr) or skipper is not a valid + // spirit qi expression. + BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr); + BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper); + + typedef + typename result_of::compile<qi::domain, Skipper>::type + skipper_type; + skipper_type const skipper_ = compile<qi::domain>(skipper); + + typename detail::make_context<Attr>::type context(attr); + if (!compile<qi::domain>(expr).parse( + first, last, context, skipper_, attr)) + return false; + + if (post_skip == skip_flag::postskip) + qi::skip_over(first, last, skipper_); + return true; + } + + template <typename Iterator, typename Expr, typename Skipper, typename Attr> + inline bool + phrase_parse( + Iterator const& first_ + , Iterator last + , Expr const& expr + , Skipper const& skipper + , BOOST_SCOPED_ENUM(skip_flag) post_skip + , Attr& attr) + { + Iterator first = first_; + return qi::phrase_parse(first, last, expr, skipper, post_skip, attr); + } + + /////////////////////////////////////////////////////////////////////////// + template <typename Iterator, typename Expr, typename Skipper, typename Attr> + inline bool + phrase_parse( + Iterator& first + , Iterator last + , Expr const& expr + , Skipper const& skipper + , Attr& attr) + { + return qi::phrase_parse(first, last, expr, skipper, skip_flag::postskip, attr); + } + + template <typename Iterator, typename Expr, typename Skipper, typename Attr> + inline bool + phrase_parse( + Iterator const& first_ + , Iterator last + , Expr const& expr + , Skipper const& skipper + , Attr& attr) + { + Iterator first = first_; + return qi::phrase_parse(first, last, expr, skipper, skip_flag::postskip, attr); + } +}}} + +#endif + diff --git a/3rdParty/Boost/src/boost/spirit/home/qi/parser.hpp b/3rdParty/Boost/src/boost/spirit/home/qi/parser.hpp new file mode 100644 index 0000000..ffd8bc9 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/qi/parser.hpp @@ -0,0 +1,140 @@ +/*============================================================================= + 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_OCTOBER_16_2008_0254PM) +#define BOOST_SPIRIT_PARSER_OCTOBER_16_2008_0254PM + +#if defined(_MSC_VER) +#pragma once +#endif + +#include <boost/mpl/has_xxx.hpp> +#include <boost/spirit/home/qi/domain.hpp> + +namespace boost { namespace spirit { namespace qi +{ + + //[parser_base_parser + template <typename Derived> + struct parser + { + struct parser_id; + typedef Derived derived_type; + typedef qi::domain domain; + + // Requirement: p.parse(f, l, context, skip, attr) -> bool + // + // p: a parser + // f, l: first/last iterator pair + // context: enclosing rule context (can be unused_type) + // skip: skipper (can be unused_type) + // attr: attribute (can be unused_type) + + // Requirement: p.what(context) -> info + // + // p: a parser + // context: enclosing rule context (can be unused_type) + + // Requirement: P::template attribute<Ctx, Iter>::type + // + // P: a parser type + // Ctx: A context type (can be unused_type) + // Iter: An iterator type (can be unused_type) + + Derived const& derived() const + { + return *static_cast<Derived const*>(this); + } + }; + //] + + template <typename Derived> + struct primitive_parser : parser<Derived> + { + struct primitive_parser_id; + }; + + template <typename Derived> + struct nary_parser : parser<Derived> + { + struct nary_parser_id; + + // Requirement: p.elements -> fusion sequence + // + // p: a composite parser + + // Requirement: P::elements_type -> fusion sequence + // + // P: a composite parser type + }; + + template <typename Derived> + struct unary_parser : parser<Derived> + { + struct unary_parser_id; + + // Requirement: p.subject -> subject parser + // + // p: a unary parser + + // Requirement: P::subject_type -> subject parser type + // + // P: a unary parser type + }; + + template <typename Derived> + struct binary_parser : parser<Derived> + { + struct binary_parser_id; + + // Requirement: p.left -> left parser + // + // p: a binary parser + + // Requirement: P::left_type -> left parser type + // + // P: a binary parser type + + // Requirement: p.right -> right parser + // + // p: a binary parser + + // Requirement: P::right_type -> right parser type + // + // P: a binary parser type + }; +}}} + +namespace boost { namespace spirit { namespace traits // classification +{ + namespace detail + { + BOOST_MPL_HAS_XXX_TRAIT_DEF(parser_id) + BOOST_MPL_HAS_XXX_TRAIT_DEF(primitive_parser_id) + BOOST_MPL_HAS_XXX_TRAIT_DEF(nary_parser_id) + BOOST_MPL_HAS_XXX_TRAIT_DEF(unary_parser_id) + BOOST_MPL_HAS_XXX_TRAIT_DEF(binary_parser_id) + } + + // parser type identification + template <typename T> + struct is_parser : detail::has_parser_id<T> {}; + + template <typename T> + struct is_primitive_parser : detail::has_primitive_parser_id<T> {}; + + template <typename T> + struct is_nary_parser : detail::has_nary_parser_id<T> {}; + + template <typename T> + struct is_unary_parser : detail::has_unary_parser_id<T> {}; + + template <typename T> + struct is_binary_parser : detail::has_binary_parser_id<T> {}; + +}}} + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/qi/reference.hpp b/3rdParty/Boost/src/boost/spirit/home/qi/reference.hpp new file mode 100644 index 0000000..f6fcabc --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/qi/reference.hpp @@ -0,0 +1,69 @@ +/*============================================================================= + 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_REFERENCE_OCTOBER_31_2008_1218AM) +#define BOOST_SPIRIT_REFERENCE_OCTOBER_31_2008_1218AM + +#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/support/info.hpp> +#include <boost/spirit/home/support/handles_container.hpp> +#include <boost/type_traits/remove_const.hpp> +#include <boost/ref.hpp> + +namespace boost { namespace spirit { namespace qi +{ + /////////////////////////////////////////////////////////////////////////// + // reference is a parser that references another parser (its Subject) + /////////////////////////////////////////////////////////////////////////// + template <typename Subject> + struct reference : parser<reference<Subject> > + { + typedef Subject subject_type; + + reference(Subject& subject) + : ref(subject) {} + + template <typename Context, typename Iterator> + struct attribute : 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 + { + return ref.get().parse(first, last, context, skipper, attr); + } + + template <typename Context> + info what(Context& context) const + { + // the reference is transparent (does not add any info) + return ref.get().what(context); + } + + boost::reference_wrapper<Subject> ref; + }; +}}} + +namespace boost { namespace spirit { namespace traits +{ + /////////////////////////////////////////////////////////////////////////// + template <typename Subject, typename Attribute, typename Context + , typename Iterator> + struct handles_container<qi::reference<Subject>, Attribute, Context + , Iterator> + : handles_container<typename remove_const<Subject>::type + , Attribute, Context, Iterator> + {}; +}}} + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/qi/skip_flag.hpp b/3rdParty/Boost/src/boost/spirit/home/qi/skip_flag.hpp new file mode 100644 index 0000000..28fd856 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/qi/skip_flag.hpp @@ -0,0 +1,29 @@ +/*============================================================================= + 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_SKIP_FLAG_DEC_02_2009_0412PM) +#define BOOST_SPIRIT_SKIP_FLAG_DEC_02_2009_0412PM + +#if defined(_MSC_VER) +#pragma once +#endif + +#include <boost/spirit/home/support/detail/scoped_enum_emulation.hpp> + +namespace boost { namespace spirit { namespace qi +{ + /////////////////////////////////////////////////////////////////////////// + BOOST_SCOPED_ENUM_START(skip_flag) + { + postskip, // force post-skipping in phrase_parse() + dont_postskip // inhibit post-skipping in phrase_parse() + }; + BOOST_SCOPED_ENUM_END + +}}} + +#endif + diff --git a/3rdParty/Boost/src/boost/spirit/home/qi/skip_over.hpp b/3rdParty/Boost/src/boost/spirit/home/qi/skip_over.hpp new file mode 100644 index 0000000..f46b304 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/qi/skip_over.hpp @@ -0,0 +1,44 @@ +/*============================================================================= + 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_SKIP_APRIL_16_2006_0625PM) +#define BOOST_SPIRIT_SKIP_APRIL_16_2006_0625PM + +#if defined(_MSC_VER) +#pragma once +#endif + +#include <boost/spirit/home/support/unused.hpp> +#include <boost/spirit/home/qi/detail/unused_skipper.hpp> + +namespace boost { namespace spirit { namespace qi +{ + /////////////////////////////////////////////////////////////////////////// + // Move the /first/ iterator to the first non-matching position + // given a skip-parser. The function is a no-op if unused_type is + // passed as the skip-parser. + /////////////////////////////////////////////////////////////////////////// + template <typename Iterator, typename T> + inline void skip_over(Iterator& first, Iterator const& last, T const& skipper) + { + while (first != last && skipper.parse(first, last, unused, unused, unused)) + /***/; + } + + template <typename Iterator> + inline void skip_over(Iterator&, Iterator const&, unused_type) + { + } + + template <typename Iterator, typename Skipper> + inline void skip_over(Iterator&, Iterator const& + , detail::unused_skipper<Skipper> const&) + { + } + +}}} + +#endif |