diff options
Diffstat (limited to '3rdParty/Boost/src/boost/spirit/home/classic/core/impl')
3 files changed, 270 insertions, 0 deletions
diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/impl/match.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/core/impl/match.ipp new file mode 100644 index 0000000..0319dcf --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/impl/match.ipp @@ -0,0 +1,113 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + http://spirit.sourceforge.net/ + + Use, modification and distribution is subject to 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_MATCH_IPP) +#define BOOST_SPIRIT_MATCH_IPP +#include <algorithm> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + template <typename T> + inline match<T>::match() + : len(-1), val() {} + + template <typename T> + inline match<T>::match(std::size_t length_) + : len(length_), val() {} + + template <typename T> + inline match<T>::match(std::size_t length_, ctor_param_t val_) + : len(length_), val(val_) {} + + template <typename T> + inline bool + match<T>::operator!() const + { + return len < 0; + } + + template <typename T> + inline std::ptrdiff_t + match<T>::length() const + { + return len; + } + + template <typename T> + inline bool + match<T>::has_valid_attribute() const + { + return val.is_initialized(); + } + + template <typename T> + inline typename match<T>::return_t + match<T>::value() const + { + BOOST_SPIRIT_ASSERT(val.is_initialized()); + return *val; + } + + template <typename T> + inline void + match<T>::swap(match& other) + { + std::swap(len, other.len); + std::swap(val, other.val); + } + + inline match<nil_t>::match() + : len(-1) {} + + inline match<nil_t>::match(std::size_t length_) + : len(length_) {} + + inline match<nil_t>::match(std::size_t length_, nil_t) + : len(length_) {} + + inline bool + match<nil_t>::operator!() const + { + return len < 0; + } + + inline bool + match<nil_t>::has_valid_attribute() const + { + return false; + } + + inline std::ptrdiff_t + match<nil_t>::length() const + { + return len; + } + + inline nil_t + match<nil_t>::value() const + { + return nil_t(); + } + + inline void + match<nil_t>::value(nil_t) {} + + inline void + match<nil_t>::swap(match<nil_t>& other) + { + std::swap(len, other.len); + } + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit + +#endif + diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/impl/match_attr_traits.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/core/impl/match_attr_traits.ipp new file mode 100644 index 0000000..24d9a43 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/impl/match_attr_traits.ipp @@ -0,0 +1,102 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + http://spirit.sourceforge.net/ + + Use, modification and distribution is subject to 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_MATCH_ATTR_TRAITS_IPP) +#define BOOST_SPIRIT_MATCH_ATTR_TRAITS_IPP + +#include <boost/optional.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/mpl/or.hpp> +#include <boost/type_traits/is_convertible.hpp> +#include <boost/type_traits/is_same.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + +namespace impl +{ + template <typename T> + struct match_attr_traits + { + typedef typename + boost::optional<T>::reference_const_type + const_reference; + + // case where src *IS* convertible to T (dest) + template <typename T2> + static void + convert(boost::optional<T>& dest, T2 const& src, mpl::true_) + { + dest.reset(src); + } + + // case where src *IS NOT* convertible to T (dest) + template <typename T2> + static void + convert(boost::optional<T>& dest, T2 const& /*src*/, mpl::false_) + { + dest.reset(); + } + + static void + convert(boost::optional<T>& dest, nil_t/*src*/) + { + dest.reset(); + } + + template <typename T2> + static void + convert(boost::optional<T>& dest, T2 const& src) + { + convert(dest, src, is_convertible<T2, T>()); + } + + template <typename OtherMatchT> + static void + copy(boost::optional<T>& dest, OtherMatchT const& src) + { + if (src.has_valid_attribute()) + convert(dest, src.value()); + } + + template <typename OtherMatchT> + static void + assign(boost::optional<T>& dest, OtherMatchT const& src) + { + if (src.has_valid_attribute()) + convert(dest, src.value()); + else + dest.reset(); + } + + // T is not reference + template <typename ValueT> + static void + set_value(boost::optional<T>& dest, ValueT const& val, mpl::false_) + { + dest.reset(val); + } + + // T is a reference + template <typename ValueT> + static void + set_value(boost::optional<T>& dest, ValueT const& val, mpl::true_) + { + dest.get() = val; + } + }; + +} + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit::impl + +#endif + diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/impl/parser.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/core/impl/parser.ipp new file mode 100644 index 0000000..d5abe69 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/impl/parser.ipp @@ -0,0 +1,55 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + http://spirit.sourceforge.net/ + + Use, modification and distribution is subject to 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_IPP) +#define BOOST_SPIRIT_PARSER_IPP + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // Generic parse function implementation + // + /////////////////////////////////////////////////////////////////////////// + template <typename IteratorT, typename DerivedT> + inline parse_info<IteratorT> + parse( + IteratorT const& first_ + , IteratorT const& last + , parser<DerivedT> const& p) + { + IteratorT first = first_; + scanner<IteratorT, scanner_policies<> > scan(first, last); + match<nil_t> hit = p.derived().parse(scan); + return parse_info<IteratorT>( + first, hit, hit && (first == last), hit.length()); + } + + /////////////////////////////////////////////////////////////////////////// + // + // Parse function for null terminated strings implementation + // + /////////////////////////////////////////////////////////////////////////// + template <typename CharT, typename DerivedT> + inline parse_info<CharT const*> + parse(CharT const* str, parser<DerivedT> const& p) + { + CharT const* last = str; + while (*last) + last++; + return parse(str, last, p); + } + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit + +#endif + |