diff options
author | Kevin Smith <git@kismith.co.uk> | 2013-01-04 19:42:37 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2013-04-06 13:36:54 (GMT) |
commit | 3333ab69d62d1be7ae7dd7a4e56cc4bb608d3add (patch) | |
tree | 5ee630b666ae21dd4c4202703c158383de1faf91 /3rdParty/Boost/src/boost/spirit | |
parent | b9ef4566d31219d66a615b1eae042a01828c8b7d (diff) | |
download | swift-3333ab69d62d1be7ae7dd7a4e56cc4bb608d3add.zip swift-3333ab69d62d1be7ae7dd7a4e56cc4bb608d3add.tar.bz2 |
Add boost serialization library
We'll need it before too long
Change-Id: Ia34c7f26e1aedbc13a2fc10c980994cbcb7cb348
Diffstat (limited to '3rdParty/Boost/src/boost/spirit')
69 files changed, 11080 insertions, 0 deletions
diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/assert.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/assert.hpp new file mode 100644 index 0000000..47b1b39 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/assert.hpp @@ -0,0 +1,38 @@ +/*============================================================================= + Copyright (c) 2001-2003 Joel de Guzman + Copyright (c) 2002-2003 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_ASSERT_HPP) +#define BOOST_SPIRIT_ASSERT_HPP + +#include <boost/config.hpp> +#include <boost/throw_exception.hpp> + +/////////////////////////////////////////////////////////////////////////////// +// +// BOOST_SPIRIT_ASSERT is used throughout the framework. It can be +// overridden by the user. If BOOST_SPIRIT_ASSERT_EXCEPTION is defined, +// then that will be thrown, otherwise, BOOST_SPIRIT_ASSERT simply turns +// into a plain BOOST_ASSERT() +// +/////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_SPIRIT_ASSERT) +#if defined(NDEBUG) + #define BOOST_SPIRIT_ASSERT(x) +#elif defined (BOOST_SPIRIT_ASSERT_EXCEPTION) + #define BOOST_SPIRIT_ASSERT_AUX(f, l, x) BOOST_SPIRIT_ASSERT_AUX2(f, l, x) + #define BOOST_SPIRIT_ASSERT_AUX2(f, l, x) \ + do{ if (!(x)) boost::throw_exception( \ + BOOST_SPIRIT_ASSERT_EXCEPTION(f "(" #l "): " #x)); } while(0) + #define BOOST_SPIRIT_ASSERT(x) BOOST_SPIRIT_ASSERT_AUX(__FILE__, __LINE__, x) +#else + #include <boost/assert.hpp> + #define BOOST_SPIRIT_ASSERT(x) BOOST_ASSERT(x) +#endif +#endif // !defined(BOOST_SPIRIT_ASSERT) + +#endif // BOOST_SPIRIT_ASSERT_HPP diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/actions.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/actions.hpp new file mode 100644 index 0000000..864211f --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/actions.hpp @@ -0,0 +1,136 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + 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) +=============================================================================*/ +#ifndef BOOST_SPIRIT_ACTIONS_HPP +#define BOOST_SPIRIT_ACTIONS_HPP + +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/parser.hpp> +#include <boost/spirit/home/classic/core/composite/composite.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(push) +#pragma warning(disable:4512) //assignment operator could not be generated +#endif + + /////////////////////////////////////////////////////////////////////////// + // + // action class + // + // The action class binds a parser with a user defined semantic + // action. Instances of action are never created manually. Instead, + // action objects are typically created indirectly through + // expression templates of the form: + // + // p[f] + // + // where p is a parser and f is a function or functor. The semantic + // action may be a function or a functor. When the parser is + // successful, the actor calls the scanner's action_policy policy + // (see scanner.hpp): + // + // scan.do_action(actor, attribute, first, last); + // + // passing in these information: + // + // actor: The action's function or functor + // attribute: The match (returned by the parser) object's + // attribute (see match.hpp) + // first: Iterator pointing to the start of the matching + // portion of the input + // last: Iterator pointing to one past the end of the + // matching portion of the input + // + // It is the responsibility of the scanner's action_policy policy to + // dispatch the function or functor as it sees fit. The expected + // function or functor signature depends on the parser being + // wrapped. In general, if the attribute type of the parser being + // wrapped is a nil_t, the function or functor expect the signature: + // + // void func(Iterator first, Iterator last); // functions + // + // struct ftor // functors + // { + // void func(Iterator first, Iterator last) const; + // }; + // + // where Iterator is the type of the iterator that is being used and + // first and last are the iterators pointing to the matching portion + // of the input. + // + // If the attribute type of the parser being wrapped is not a nil_t, + // the function or functor usually expect the signature: + // + // void func(T val); // functions + // + // struct ftor // functors + // { + // void func(T val) const; + // }; + // + // where T is the attribute type and val is the attribute value + // returned by the parser being wrapped. + // + /////////////////////////////////////////////////////////////////////////// + template <typename ParserT, typename ActionT> + class action : public unary<ParserT, parser<action<ParserT, ActionT> > > + { + public: + + typedef action<ParserT, ActionT> self_t; + typedef action_parser_category parser_category_t; + typedef unary<ParserT, parser<self_t> > base_t; + typedef ActionT predicate_t; + + template <typename ScannerT> + struct result + { + typedef typename parser_result<ParserT, ScannerT>::type type; + }; + + action(ParserT const& p, ActionT const& a) + : base_t(p) + , actor(a) {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef typename ScannerT::iterator_t iterator_t; + typedef typename parser_result<self_t, ScannerT>::type result_t; + + scan.at_end(); // allow skipper to take effect + iterator_t save = scan.first; + result_t hit = this->subject().parse(scan); + if (hit) + { + typename result_t::return_t val = hit.value(); + scan.do_action(actor, val, save, scan.first); + } + return hit; + } + + ActionT const& predicate() const { return actor; } + + private: + + ActionT actor; + }; + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(pop) +#endif + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/alternative.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/alternative.hpp new file mode 100644 index 0000000..5e472a9 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/alternative.hpp @@ -0,0 +1,147 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 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_ALTERNATIVE_HPP) +#define BOOST_SPIRIT_ALTERNATIVE_HPP + +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/parser.hpp> +#include <boost/spirit/home/classic/core/primitives/primitives.hpp> +#include <boost/spirit/home/classic/core/composite/composite.hpp> +#include <boost/spirit/home/classic/meta/as_parser.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // alternative class + // + // Handles expressions of the form: + // + // a | b + // + // where a and b are parsers. The expression returns a composite + // parser that matches a or b. One (not both) of the operands may + // be a literal char, wchar_t or a primitive string char const*, + // wchar_t const*. + // + // The expression is short circuit evaluated. b is never touched + // when a is returns a successful match. + // + /////////////////////////////////////////////////////////////////////////// + struct alternative_parser_gen; + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(push) +#pragma warning(disable:4512) //assignment operator could not be generated +#endif + + template <typename A, typename B> + struct alternative + : public binary<A, B, parser<alternative<A, B> > > + { + typedef alternative<A, B> self_t; + typedef binary_parser_category parser_category_t; + typedef alternative_parser_gen parser_generator_t; + typedef binary<A, B, parser<self_t> > base_t; + + alternative(A const& a, B const& b) + : base_t(a, b) {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef typename parser_result<self_t, ScannerT>::type result_t; + typedef typename ScannerT::iterator_t iterator_t; + { // scope for save + iterator_t save = scan.first; + if (result_t hit = this->left().parse(scan)) + return hit; + scan.first = save; + } + return this->right().parse(scan); + } + }; + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(pop) +#endif + + struct alternative_parser_gen + { + template <typename A, typename B> + struct result + { + typedef + alternative< + typename as_parser<A>::type + , typename as_parser<B>::type + > + type; + }; + + template <typename A, typename B> + static alternative< + typename as_parser<A>::type + , typename as_parser<B>::type + > + generate(A const& a, B const& b) + { + return alternative<BOOST_DEDUCED_TYPENAME as_parser<A>::type, + BOOST_DEDUCED_TYPENAME as_parser<B>::type> + (as_parser<A>::convert(a), as_parser<B>::convert(b)); + } + }; + + template <typename A, typename B> + alternative<A, B> + operator|(parser<A> const& a, parser<B> const& b); + + template <typename A> + alternative<A, chlit<char> > + operator|(parser<A> const& a, char b); + + template <typename B> + alternative<chlit<char>, B> + operator|(char a, parser<B> const& b); + + template <typename A> + alternative<A, strlit<char const*> > + operator|(parser<A> const& a, char const* b); + + template <typename B> + alternative<strlit<char const*>, B> + operator|(char const* a, parser<B> const& b); + + template <typename A> + alternative<A, chlit<wchar_t> > + operator|(parser<A> const& a, wchar_t b); + + template <typename B> + alternative<chlit<wchar_t>, B> + operator|(wchar_t a, parser<B> const& b); + + template <typename A> + alternative<A, strlit<wchar_t const*> > + operator|(parser<A> const& a, wchar_t const* b); + + template <typename B> + alternative<strlit<wchar_t const*>, B> + operator|(wchar_t const* a, parser<B> const& b); + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif + +#include <boost/spirit/home/classic/core/composite/impl/alternative.ipp> diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/composite.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/composite.hpp new file mode 100644 index 0000000..b156cab --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/composite.hpp @@ -0,0 +1,151 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + 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_COMPOSITE_HPP) +#define BOOST_SPIRIT_COMPOSITE_HPP + +/////////////////////////////////////////////////////////////////////////////// +#include <boost/compressed_pair.hpp> +#include <boost/spirit/home/classic/namespace.hpp> + +/////////////////////////////////////////////////////////////////////////////// +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(push) +#pragma warning(disable:4512) //assignment operator could not be generated +#endif + + /////////////////////////////////////////////////////////////////////////// + // + // unary class. + // + // Composite class composed of a single subject. This template class + // is parameterized by the subject type S and a base class to + // inherit from, BaseT. The unary class is meant to be a base class + // to inherit from. The inheritance structure, given the BaseT + // template parameter places the unary class in the middle of a + // linear, single parent hierarchy. For instance, given a class S + // and a base class B, a class D can derive from unary: + // + // struct D : public unary<S, B> {...}; + // + // The inheritance structure is thus: + // + // B + // | + // unary (has S) + // | + // D + // + // The subject can be accessed from the derived class D as: + // this->subject(); + // + // Typically, the subject S is specified as typename S::embed_t. + // embed_t specifies how the subject is embedded in the composite + // (See parser.hpp for details). + // + /////////////////////////////////////////////////////////////////////////// + template <typename S, typename BaseT> + class unary : public BaseT + { + public: + + typedef BaseT base_t; + typedef typename boost::call_traits<S>::param_type param_t; + typedef typename boost::call_traits<S>::const_reference return_t; + typedef S subject_t; + typedef typename S::embed_t subject_embed_t; + + unary(param_t subj_) + : base_t(), subj(subj_) {} + + unary(BaseT const& base, param_t subj_) + : base_t(base), subj(subj_) {} + + return_t + subject() const + { return subj; } + + private: + + subject_embed_t subj; + }; + + /////////////////////////////////////////////////////////////////////////// + // + // binary class. + // + // Composite class composed of a pair (left and right). This + // template class is parameterized by the left and right subject + // types A and B and a base class to inherit from, BaseT. The binary + // class is meant to be a base class to inherit from. The + // inheritance structure, given the BaseT template parameter places + // the binary class in the middle of a linear, single parent + // hierarchy. For instance, given classes X and Y and a base class + // B, a class D can derive from binary: + // + // struct D : public binary<X, Y, B> {...}; + // + // The inheritance structure is thus: + // + // B + // | + // binary (has X and Y) + // | + // D + // + // The left and right subjects can be accessed from the derived + // class D as: this->left(); and this->right(); + // + // Typically, the pairs X and Y are specified as typename X::embed_t + // and typename Y::embed_t. embed_t specifies how the subject is + // embedded in the composite (See parser.hpp for details). + // + /////////////////////////////////////////////////////////////////////////////// + template <typename A, typename B, typename BaseT> + class binary : public BaseT + { + public: + + typedef BaseT base_t; + typedef typename boost::call_traits<A>::param_type left_param_t; + typedef typename boost::call_traits<A>::const_reference left_return_t; + typedef typename boost::call_traits<B>::param_type right_param_t; + typedef typename boost::call_traits<B>::const_reference right_return_t; + typedef A left_t; + typedef typename A::embed_t left_embed_t; + typedef B right_t; + typedef typename B::embed_t right_embed_t; + + binary(left_param_t a, right_param_t b) + : base_t(), subj(a, b) {} + + left_return_t + left() const + { return subj.first(); } + + right_return_t + right() const + { return subj.second(); } + + private: + + boost::compressed_pair<left_embed_t, right_embed_t> subj; + }; + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(pop) +#endif + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/difference.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/difference.hpp new file mode 100644 index 0000000..7d1cb14 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/difference.hpp @@ -0,0 +1,150 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 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_DIFFERENCE_HPP) +#define BOOST_SPIRIT_DIFFERENCE_HPP + +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/parser.hpp> +#include <boost/spirit/home/classic/core/primitives/primitives.hpp> +#include <boost/spirit/home/classic/core/composite/composite.hpp> +#include <boost/spirit/home/classic/meta/as_parser.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // difference: a - b; Matches a but not b + // + // Handles expressions of the form: + // + // a - b + // + // where a and b are parsers. The expression returns a composite + // parser that matches a but not b. One (not both) of the operands + // may be a literal char, wchar_t or a primitive string char const*, + // wchar_t const*. + // + /////////////////////////////////////////////////////////////////////////// + struct difference_parser_gen; + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(push) +#pragma warning(disable:4512) //assignment operator could not be generated +#endif + + template <typename A, typename B> + struct difference + : public binary<A, B, parser<difference<A, B> > > + { + typedef difference<A, B> self_t; + typedef binary_parser_category parser_category_t; + typedef difference_parser_gen parser_generator_t; + typedef binary<A, B, parser<self_t> > base_t; + + difference(A const& a, B const& b) + : base_t(a, b) {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef typename parser_result<self_t, ScannerT>::type result_t; + typedef typename ScannerT::iterator_t iterator_t; + iterator_t save = scan.first; + if (result_t hl = this->left().parse(scan)) + { + std::swap(save, scan.first); + result_t hr = this->right().parse(scan); + if (!hr || (hr.length() < hl.length())) + { + scan.first = save; + return hl; + } + } + + return scan.no_match(); + } + }; + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(pop) +#endif + + struct difference_parser_gen + { + template <typename A, typename B> + struct result + { + typedef + difference< + typename as_parser<A>::type + , typename as_parser<B>::type + > + type; + }; + + template <typename A, typename B> + static difference< + typename as_parser<A>::type + , typename as_parser<B>::type + > + generate(A const& a, B const& b) + { + return difference<BOOST_DEDUCED_TYPENAME as_parser<A>::type, + BOOST_DEDUCED_TYPENAME as_parser<B>::type> + (as_parser<A>::convert(a), as_parser<B>::convert(b)); + } + }; + + template <typename A, typename B> + difference<A, B> + operator-(parser<A> const& a, parser<B> const& b); + + template <typename A> + difference<A, chlit<char> > + operator-(parser<A> const& a, char b); + + template <typename B> + difference<chlit<char>, B> + operator-(char a, parser<B> const& b); + + template <typename A> + difference<A, strlit<char const*> > + operator-(parser<A> const& a, char const* b); + + template <typename B> + difference<strlit<char const*>, B> + operator-(char const* a, parser<B> const& b); + + template <typename A> + difference<A, chlit<wchar_t> > + operator-(parser<A> const& a, wchar_t b); + + template <typename B> + difference<chlit<wchar_t>, B> + operator-(wchar_t a, parser<B> const& b); + + template <typename A> + difference<A, strlit<wchar_t const*> > + operator-(parser<A> const& a, wchar_t const* b); + + template <typename B> + difference<strlit<wchar_t const*>, B> + operator-(wchar_t const* a, parser<B> const& b); + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif + +#include <boost/spirit/home/classic/core/composite/impl/difference.ipp> diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/directives.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/directives.hpp new file mode 100644 index 0000000..a66efa2 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/directives.hpp @@ -0,0 +1,607 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + 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_DIRECTIVES_HPP) +#define BOOST_SPIRIT_DIRECTIVES_HPP + +/////////////////////////////////////////////////////////////////////////////// +#include <algorithm> + +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/parser.hpp> +#include <boost/spirit/home/classic/core/scanner/skipper.hpp> +#include <boost/spirit/home/classic/core/primitives/primitives.hpp> +#include <boost/spirit/home/classic/core/composite/composite.hpp> +#include <boost/spirit/home/classic/core/composite/impl/directives.ipp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // contiguous class + // + /////////////////////////////////////////////////////////////////////////// + struct lexeme_parser_gen; + + template <typename ParserT> + struct contiguous + : public unary<ParserT, parser<contiguous<ParserT> > > + { + typedef contiguous<ParserT> self_t; + typedef unary_parser_category parser_category_t; + typedef lexeme_parser_gen parser_generator_t; + typedef unary<ParserT, parser<self_t> > base_t; + + template <typename ScannerT> + struct result + { + typedef typename parser_result<ParserT, ScannerT>::type type; + }; + + contiguous(ParserT const& p) + : base_t(p) {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef typename parser_result<self_t, ScannerT>::type result_t; + return impl::contiguous_parser_parse<result_t> + (this->subject(), scan, scan); + } + }; + + struct lexeme_parser_gen + { + template <typename ParserT> + struct result { + + typedef contiguous<ParserT> type; + }; + + template <typename ParserT> + static contiguous<ParserT> + generate(parser<ParserT> const& subject) + { + return contiguous<ParserT>(subject.derived()); + } + + template <typename ParserT> + contiguous<ParserT> + operator[](parser<ParserT> const& subject) const + { + return contiguous<ParserT>(subject.derived()); + } + }; + + ////////////////////////////////// + const lexeme_parser_gen lexeme_d = lexeme_parser_gen(); + + /////////////////////////////////////////////////////////////////////////// + // + // lexeme_scanner + // + // Given a Scanner, return the correct scanner type that + // the lexeme_d uses. Scanner is assumed to be a phrase + // level scanner (see skipper.hpp) + // + /////////////////////////////////////////////////////////////////////////// + template <typename ScannerT> + struct lexeme_scanner + { + typedef scanner_policies< + no_skipper_iteration_policy< + typename ScannerT::iteration_policy_t>, + typename ScannerT::match_policy_t, + typename ScannerT::action_policy_t + > policies_t; + + typedef typename + rebind_scanner_policies<ScannerT, policies_t>::type type; + }; + + /////////////////////////////////////////////////////////////////////////// + // + // inhibit_case_iteration_policy class + // + /////////////////////////////////////////////////////////////////////////// + template <typename BaseT> + struct inhibit_case_iteration_policy : public BaseT + { + typedef BaseT base_t; + + inhibit_case_iteration_policy() + : BaseT() {} + + template <typename PolicyT> + inhibit_case_iteration_policy(PolicyT const& other) + : BaseT(other) {} + + template <typename CharT> + CharT filter(CharT ch) const + { return impl::tolower_(ch); } + }; + + /////////////////////////////////////////////////////////////////////////// + // + // inhibit_case class + // + /////////////////////////////////////////////////////////////////////////// + struct inhibit_case_parser_gen; + + template <typename ParserT> + struct inhibit_case + : public unary<ParserT, parser<inhibit_case<ParserT> > > + { + typedef inhibit_case<ParserT> self_t; + typedef unary_parser_category parser_category_t; + typedef inhibit_case_parser_gen parser_generator_t; + typedef unary<ParserT, parser<self_t> > base_t; + + template <typename ScannerT> + struct result + { + typedef typename parser_result<ParserT, ScannerT>::type type; + }; + + inhibit_case(ParserT const& p) + : base_t(p) {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef typename parser_result<self_t, ScannerT>::type result_t; + return impl::inhibit_case_parser_parse<result_t> + (this->subject(), scan, scan); + } + }; + + template <int N> + struct inhibit_case_parser_gen_base + { + // This hack is needed to make borland happy. + // If these member operators were defined in the + // inhibit_case_parser_gen class, or if this class + // is non-templated, borland ICEs. + + static inhibit_case<strlit<char const*> > + generate(char const* str) + { return inhibit_case<strlit<char const*> >(str); } + + static inhibit_case<strlit<wchar_t const*> > + generate(wchar_t const* str) + { return inhibit_case<strlit<wchar_t const*> >(str); } + + static inhibit_case<chlit<char> > + generate(char ch) + { return inhibit_case<chlit<char> >(ch); } + + static inhibit_case<chlit<wchar_t> > + generate(wchar_t ch) + { return inhibit_case<chlit<wchar_t> >(ch); } + + template <typename ParserT> + static inhibit_case<ParserT> + generate(parser<ParserT> const& subject) + { return inhibit_case<ParserT>(subject.derived()); } + + inhibit_case<strlit<char const*> > + operator[](char const* str) const + { return inhibit_case<strlit<char const*> >(str); } + + inhibit_case<strlit<wchar_t const*> > + operator[](wchar_t const* str) const + { return inhibit_case<strlit<wchar_t const*> >(str); } + + inhibit_case<chlit<char> > + operator[](char ch) const + { return inhibit_case<chlit<char> >(ch); } + + inhibit_case<chlit<wchar_t> > + operator[](wchar_t ch) const + { return inhibit_case<chlit<wchar_t> >(ch); } + + template <typename ParserT> + inhibit_case<ParserT> + operator[](parser<ParserT> const& subject) const + { return inhibit_case<ParserT>(subject.derived()); } + }; + + ////////////////////////////////// + struct inhibit_case_parser_gen : public inhibit_case_parser_gen_base<0> + { + inhibit_case_parser_gen() {} + }; + + ////////////////////////////////// + // Depracated + const inhibit_case_parser_gen nocase_d = inhibit_case_parser_gen(); + + // Preferred syntax + const inhibit_case_parser_gen as_lower_d = inhibit_case_parser_gen(); + + /////////////////////////////////////////////////////////////////////////// + // + // as_lower_scanner + // + // Given a Scanner, return the correct scanner type that + // the as_lower_d uses. Scanner is assumed to be a scanner + // with an inhibit_case_iteration_policy. + // + /////////////////////////////////////////////////////////////////////////// + template <typename ScannerT> + struct as_lower_scanner + { + typedef scanner_policies< + inhibit_case_iteration_policy< + typename ScannerT::iteration_policy_t>, + typename ScannerT::match_policy_t, + typename ScannerT::action_policy_t + > policies_t; + + typedef typename + rebind_scanner_policies<ScannerT, policies_t>::type type; + }; + + /////////////////////////////////////////////////////////////////////////// + // + // longest_alternative class + // + /////////////////////////////////////////////////////////////////////////// + struct longest_parser_gen; + + template <typename A, typename B> + struct longest_alternative + : public binary<A, B, parser<longest_alternative<A, B> > > + { + typedef longest_alternative<A, B> self_t; + typedef binary_parser_category parser_category_t; + typedef longest_parser_gen parser_generator_t; + typedef binary<A, B, parser<self_t> > base_t; + + longest_alternative(A const& a, B const& b) + : base_t(a, b) {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef typename parser_result<self_t, ScannerT>::type result_t; + typename ScannerT::iterator_t save = scan.first; + result_t l = this->left().parse(scan); + std::swap(scan.first, save); + result_t r = this->right().parse(scan); + + if (l || r) + { + if (l.length() > r.length()) + { + scan.first = save; + return l; + } + return r; + } + + return scan.no_match(); + } + }; + + struct longest_parser_gen + { + template <typename A, typename B> + struct result { + + typedef typename + impl::to_longest_alternative<alternative<A, B> >::result_t + type; + }; + + template <typename A, typename B> + static typename + impl::to_longest_alternative<alternative<A, B> >::result_t + generate(alternative<A, B> const& alt) + { + return impl::to_longest_alternative<alternative<A, B> >:: + convert(alt); + } + + //'generate' for binary composite + template <typename A, typename B> + static + longest_alternative<A, B> + generate(A const &left, B const &right) + { + return longest_alternative<A, B>(left, right); + } + + template <typename A, typename B> + typename impl::to_longest_alternative<alternative<A, B> >::result_t + operator[](alternative<A, B> const& alt) const + { + return impl::to_longest_alternative<alternative<A, B> >:: + convert(alt); + } + }; + + const longest_parser_gen longest_d = longest_parser_gen(); + + /////////////////////////////////////////////////////////////////////////// + // + // shortest_alternative class + // + /////////////////////////////////////////////////////////////////////////// + struct shortest_parser_gen; + + template <typename A, typename B> + struct shortest_alternative + : public binary<A, B, parser<shortest_alternative<A, B> > > + { + typedef shortest_alternative<A, B> self_t; + typedef binary_parser_category parser_category_t; + typedef shortest_parser_gen parser_generator_t; + typedef binary<A, B, parser<self_t> > base_t; + + shortest_alternative(A const& a, B const& b) + : base_t(a, b) {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef typename parser_result<self_t, ScannerT>::type result_t; + typename ScannerT::iterator_t save = scan.first; + result_t l = this->left().parse(scan); + std::swap(scan.first, save); + result_t r = this->right().parse(scan); + + if (l || r) + { + if ((l.length() < r.length() && l) || !r) + { + scan.first = save; + return l; + } + return r; + } + + return scan.no_match(); + } + }; + + struct shortest_parser_gen + { + template <typename A, typename B> + struct result { + + typedef typename + impl::to_shortest_alternative<alternative<A, B> >::result_t + type; + }; + + template <typename A, typename B> + static typename + impl::to_shortest_alternative<alternative<A, B> >::result_t + generate(alternative<A, B> const& alt) + { + return impl::to_shortest_alternative<alternative<A, B> >:: + convert(alt); + } + + //'generate' for binary composite + template <typename A, typename B> + static + shortest_alternative<A, B> + generate(A const &left, B const &right) + { + return shortest_alternative<A, B>(left, right); + } + + template <typename A, typename B> + typename impl::to_shortest_alternative<alternative<A, B> >::result_t + operator[](alternative<A, B> const& alt) const + { + return impl::to_shortest_alternative<alternative<A, B> >:: + convert(alt); + } + }; + + const shortest_parser_gen shortest_d = shortest_parser_gen(); + + /////////////////////////////////////////////////////////////////////////// + // + // min_bounded class + // + /////////////////////////////////////////////////////////////////////////// + template <typename BoundsT> + struct min_bounded_gen; + + template <typename ParserT, typename BoundsT> + struct min_bounded + : public unary<ParserT, parser<min_bounded<ParserT, BoundsT> > > + { + typedef min_bounded<ParserT, BoundsT> self_t; + typedef unary_parser_category parser_category_t; + typedef min_bounded_gen<BoundsT> parser_generator_t; + typedef unary<ParserT, parser<self_t> > base_t; + + template <typename ScannerT> + struct result + { + typedef typename parser_result<ParserT, ScannerT>::type type; + }; + + min_bounded(ParserT const& p, BoundsT const& min__) + : base_t(p) + , min_(min__) {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef typename parser_result<self_t, ScannerT>::type result_t; + result_t hit = this->subject().parse(scan); + if (hit.has_valid_attribute() && hit.value() < min_) + return scan.no_match(); + return hit; + } + + BoundsT min_; + }; + + template <typename BoundsT> + struct min_bounded_gen + { + min_bounded_gen(BoundsT const& min__) + : min_(min__) {} + + template <typename DerivedT> + min_bounded<DerivedT, BoundsT> + operator[](parser<DerivedT> const& p) const + { return min_bounded<DerivedT, BoundsT>(p.derived(), min_); } + + BoundsT min_; + }; + + template <typename BoundsT> + inline min_bounded_gen<BoundsT> + min_limit_d(BoundsT const& min_) + { return min_bounded_gen<BoundsT>(min_); } + + /////////////////////////////////////////////////////////////////////////// + // + // max_bounded class + // + /////////////////////////////////////////////////////////////////////////// + template <typename BoundsT> + struct max_bounded_gen; + + template <typename ParserT, typename BoundsT> + struct max_bounded + : public unary<ParserT, parser<max_bounded<ParserT, BoundsT> > > + { + typedef max_bounded<ParserT, BoundsT> self_t; + typedef unary_parser_category parser_category_t; + typedef max_bounded_gen<BoundsT> parser_generator_t; + typedef unary<ParserT, parser<self_t> > base_t; + + template <typename ScannerT> + struct result + { + typedef typename parser_result<ParserT, ScannerT>::type type; + }; + + max_bounded(ParserT const& p, BoundsT const& max__) + : base_t(p) + , max_(max__) {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef typename parser_result<self_t, ScannerT>::type result_t; + result_t hit = this->subject().parse(scan); + if (hit.has_valid_attribute() && hit.value() > max_) + return scan.no_match(); + return hit; + } + + BoundsT max_; + }; + + template <typename BoundsT> + struct max_bounded_gen + { + max_bounded_gen(BoundsT const& max__) + : max_(max__) {} + + template <typename DerivedT> + max_bounded<DerivedT, BoundsT> + operator[](parser<DerivedT> const& p) const + { return max_bounded<DerivedT, BoundsT>(p.derived(), max_); } + + BoundsT max_; + }; + + ////////////////////////////////// + template <typename BoundsT> + inline max_bounded_gen<BoundsT> + max_limit_d(BoundsT const& max_) + { return max_bounded_gen<BoundsT>(max_); } + + /////////////////////////////////////////////////////////////////////////// + // + // bounded class + // + /////////////////////////////////////////////////////////////////////////// + template <typename BoundsT> + struct bounded_gen; + + template <typename ParserT, typename BoundsT> + struct bounded + : public unary<ParserT, parser<bounded<ParserT, BoundsT> > > + { + typedef bounded<ParserT, BoundsT> self_t; + typedef unary_parser_category parser_category_t; + typedef bounded_gen<BoundsT> parser_generator_t; + typedef unary<ParserT, parser<self_t> > base_t; + + template <typename ScannerT> + struct result + { + typedef typename parser_result<ParserT, ScannerT>::type type; + }; + + bounded(ParserT const& p, BoundsT const& min__, BoundsT const& max__) + : base_t(p) + , min_(min__) + , max_(max__) {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef typename parser_result<self_t, ScannerT>::type result_t; + result_t hit = this->subject().parse(scan); + if (hit.has_valid_attribute() && + (hit.value() < min_ || hit.value() > max_)) + return scan.no_match(); + return hit; + } + + BoundsT min_, max_; + }; + + template <typename BoundsT> + struct bounded_gen + { + bounded_gen(BoundsT const& min__, BoundsT const& max__) + : min_(min__) + , max_(max__) {} + + template <typename DerivedT> + bounded<DerivedT, BoundsT> + operator[](parser<DerivedT> const& p) const + { return bounded<DerivedT, BoundsT>(p.derived(), min_, max_); } + + BoundsT min_, max_; + }; + + template <typename BoundsT> + inline bounded_gen<BoundsT> + limit_d(BoundsT const& min_, BoundsT const& max_) + { return bounded_gen<BoundsT>(min_, max_); } + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif + diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/exclusive_or.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/exclusive_or.hpp new file mode 100644 index 0000000..69d4859 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/exclusive_or.hpp @@ -0,0 +1,142 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 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_EXCLUSIVE_OR_HPP) +#define BOOST_SPIRIT_EXCLUSIVE_OR_HPP + +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/parser.hpp> +#include <boost/spirit/home/classic/core/primitives/primitives.hpp> +#include <boost/spirit/home/classic/core/composite/composite.hpp> +#include <boost/spirit/home/classic/meta/as_parser.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // exclusive_or class + // + // Handles expressions of the form: + // + // a ^ b + // + // where a and b are parsers. The expression returns a composite + // parser that matches a or b but not both. One (not both) of the + // operands may be a literal char, wchar_t or a primitive string + // char const*, wchar_t const*. + // + /////////////////////////////////////////////////////////////////////////// + struct exclusive_or_parser_gen; + + template <typename A, typename B> + struct exclusive_or + : public binary<A, B, parser<exclusive_or<A, B> > > + { + typedef exclusive_or<A, B> self_t; + typedef binary_parser_category parser_category_t; + typedef exclusive_or_parser_gen parser_generator_t; + typedef binary<A, B, parser<self_t> > base_t; + + exclusive_or(A const& a, B const& b) + : base_t(a, b) {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef typename parser_result<self_t, ScannerT>::type result_t; + typedef typename ScannerT::iterator_t iterator_t; + + iterator_t save = scan.first; + result_t l = this->left().parse(scan); + std::swap(save, scan.first); + result_t r = this->right().parse(scan); + + if (l ? !bool(r) : bool(r)) + { + if (l) + scan.first = save; + return l ? l : r; + } + + return scan.no_match(); + } + }; + + struct exclusive_or_parser_gen + { + template <typename A, typename B> + struct result + { + typedef + exclusive_or< + typename as_parser<A>::type + , typename as_parser<B>::type + > + type; + }; + + template <typename A, typename B> + static exclusive_or< + typename as_parser<A>::type + , typename as_parser<B>::type + > + generate(A const& a, B const& b) + { + return exclusive_or<BOOST_DEDUCED_TYPENAME as_parser<A>::type, + BOOST_DEDUCED_TYPENAME as_parser<B>::type> + (as_parser<A>::convert(a), as_parser<B>::convert(b)); + } + }; + + template <typename A, typename B> + exclusive_or<A, B> + operator^(parser<A> const& a, parser<B> const& b); + + template <typename A> + exclusive_or<A, chlit<char> > + operator^(parser<A> const& a, char b); + + template <typename B> + exclusive_or<chlit<char>, B> + operator^(char a, parser<B> const& b); + + template <typename A> + exclusive_or<A, strlit<char const*> > + operator^(parser<A> const& a, char const* b); + + template <typename B> + exclusive_or<strlit<char const*>, B> + operator^(char const* a, parser<B> const& b); + + template <typename A> + exclusive_or<A, chlit<wchar_t> > + operator^(parser<A> const& a, wchar_t b); + + template <typename B> + exclusive_or<chlit<wchar_t>, B> + operator^(wchar_t a, parser<B> const& b); + + template <typename A> + exclusive_or<A, strlit<wchar_t const*> > + operator^(parser<A> const& a, wchar_t const* b); + + template <typename B> + exclusive_or<strlit<wchar_t const*>, B> + operator^(wchar_t const* a, parser<B> const& b); + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif + +#include <boost/spirit/home/classic/core/composite/impl/exclusive_or.ipp> diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/alternative.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/alternative.ipp new file mode 100644 index 0000000..7a7599b --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/alternative.ipp @@ -0,0 +1,90 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 Hartmut Kaiser + 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_ALTERNATIVE_IPP) +#define BOOST_SPIRIT_ALTERNATIVE_IPP + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // alternative class implementation + // + /////////////////////////////////////////////////////////////////////////// + template <typename A, typename B> + inline alternative<A, B> + operator|(parser<A> const& a, parser<B> const& b) + { + return alternative<A, B>(a.derived(), b.derived()); + } + + template <typename A> + inline alternative<A, chlit<char> > + operator|(parser<A> const& a, char b) + { + return alternative<A, chlit<char> >(a.derived(), b); + } + + template <typename B> + inline alternative<chlit<char>, B> + operator|(char a, parser<B> const& b) + { + return alternative<chlit<char>, B>(a, b.derived()); + } + + template <typename A> + inline alternative<A, strlit<char const*> > + operator|(parser<A> const& a, char const* b) + { + return alternative<A, strlit<char const*> >(a.derived(), b); + } + + template <typename B> + inline alternative<strlit<char const*>, B> + operator|(char const* a, parser<B> const& b) + { + return alternative<strlit<char const*>, B>(a, b.derived()); + } + + template <typename A> + inline alternative<A, chlit<wchar_t> > + operator|(parser<A> const& a, wchar_t b) + { + return alternative<A, chlit<wchar_t> >(a.derived(), b); + } + + template <typename B> + inline alternative<chlit<wchar_t>, B> + operator|(wchar_t a, parser<B> const& b) + { + return alternative<chlit<wchar_t>, B>(a, b.derived()); + } + + template <typename A> + inline alternative<A, strlit<wchar_t const*> > + operator|(parser<A> const& a, wchar_t const* b) + { + return alternative<A, strlit<wchar_t const*> >(a.derived(), b); + } + + template <typename B> + inline alternative<strlit<wchar_t const*>, B> + operator|(wchar_t const* a, parser<B> const& b) + { + return alternative<strlit<wchar_t const*>, B>(a, b.derived()); + } + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/difference.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/difference.ipp new file mode 100644 index 0000000..f5df8c7 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/difference.ipp @@ -0,0 +1,90 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 Hartmut Kaiser + 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_DIFFERENCE_IPP) +#define BOOST_SPIRIT_DIFFERENCE_IPP + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // difference class implementation + // + /////////////////////////////////////////////////////////////////////////// + template <typename A, typename B> + inline difference<A, B> + operator-(parser<A> const& a, parser<B> const& b) + { + return difference<A, B>(a.derived(), b.derived()); + } + + template <typename A> + inline difference<A, chlit<char> > + operator-(parser<A> const& a, char b) + { + return difference<A, chlit<char> >(a.derived(), b); + } + + template <typename B> + inline difference<chlit<char>, B> + operator-(char a, parser<B> const& b) + { + return difference<chlit<char>, B>(a, b.derived()); + } + + template <typename A> + inline difference<A, strlit<char const*> > + operator-(parser<A> const& a, char const* b) + { + return difference<A, strlit<char const*> >(a.derived(), b); + } + + template <typename B> + inline difference<strlit<char const*>, B> + operator-(char const* a, parser<B> const& b) + { + return difference<strlit<char const*>, B>(a, b.derived()); + } + + template <typename A> + inline difference<A, chlit<wchar_t> > + operator-(parser<A> const& a, wchar_t b) + { + return difference<A, chlit<wchar_t> >(a.derived(), b); + } + + template <typename B> + inline difference<chlit<wchar_t>, B> + operator-(wchar_t a, parser<B> const& b) + { + return difference<chlit<wchar_t>, B>(a, b.derived()); + } + + template <typename A> + inline difference<A, strlit<wchar_t const*> > + operator-(parser<A> const& a, wchar_t const* b) + { + return difference<A, strlit<wchar_t const*> >(a.derived(), b); + } + + template <typename B> + inline difference<strlit<wchar_t const*>, B> + operator-(wchar_t const* a, parser<B> const& b) + { + return difference<strlit<wchar_t const*>, B>(a, b.derived()); + } + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/directives.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/directives.ipp new file mode 100644 index 0000000..b25b25f --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/directives.ipp @@ -0,0 +1,374 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2001 Bruce Florman + Copyright (c) 2002 Raghavendra Satish + 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_DIRECTIVES_IPP) +#define BOOST_SPIRIT_DIRECTIVES_IPP + +/////////////////////////////////////////////////////////////////////////////// +#include <boost/spirit/home/classic/core/scanner/skipper.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + template <typename BaseT> + struct no_skipper_iteration_policy; + + template <typename BaseT> + struct inhibit_case_iteration_policy; + + template <typename A, typename B> + struct alternative; + + template <typename A, typename B> + struct longest_alternative; + + template <typename A, typename B> + struct shortest_alternative; + + namespace impl + { + template <typename RT, typename ST, typename ScannerT, typename BaseT> + inline RT + contiguous_parser_parse( + ST const& s, + ScannerT const& scan, + skipper_iteration_policy<BaseT> const&) + { + typedef scanner_policies< + no_skipper_iteration_policy< + BOOST_DEDUCED_TYPENAME ScannerT::iteration_policy_t>, + BOOST_DEDUCED_TYPENAME ScannerT::match_policy_t, + BOOST_DEDUCED_TYPENAME ScannerT::action_policy_t + > policies_t; + + scan.skip(scan); + RT hit = s.parse(scan.change_policies(policies_t(scan))); + // We will not do a post skip!!! + return hit; + } + + template <typename RT, typename ST, typename ScannerT, typename BaseT> + inline RT + contiguous_parser_parse( + ST const& s, + ScannerT const& scan, + no_skipper_iteration_policy<BaseT> const&) + { + return s.parse(scan); + } + + template <typename RT, typename ST, typename ScannerT> + inline RT + contiguous_parser_parse( + ST const& s, + ScannerT const& scan, + iteration_policy const&) + { + return s.parse(scan); + } + + template < + typename RT, + typename ParserT, + typename ScannerT, + typename BaseT> + inline RT + implicit_lexeme_parse( + ParserT const& p, + ScannerT const& scan, + skipper_iteration_policy<BaseT> const&) + { + typedef scanner_policies< + no_skipper_iteration_policy< + BOOST_DEDUCED_TYPENAME ScannerT::iteration_policy_t>, + BOOST_DEDUCED_TYPENAME ScannerT::match_policy_t, + BOOST_DEDUCED_TYPENAME ScannerT::action_policy_t + > policies_t; + + scan.skip(scan); + RT hit = p.parse_main(scan.change_policies(policies_t(scan))); + // We will not do a post skip!!! + return hit; + } + + template < + typename RT, + typename ParserT, + typename ScannerT, + typename BaseT> + inline RT + implicit_lexeme_parse( + ParserT const& p, + ScannerT const& scan, + no_skipper_iteration_policy<BaseT> const&) + { + return p.parse_main(scan); + } + + template <typename RT, typename ParserT, typename ScannerT> + inline RT + implicit_lexeme_parse( + ParserT const& p, + ScannerT const& scan, + iteration_policy const&) + { + return p.parse_main(scan); + } + + template <typename RT, typename ST, typename ScannerT> + inline RT + inhibit_case_parser_parse( + ST const& s, + ScannerT const& scan, + iteration_policy const&) + { + typedef scanner_policies< + inhibit_case_iteration_policy< + BOOST_DEDUCED_TYPENAME ScannerT::iteration_policy_t>, + BOOST_DEDUCED_TYPENAME ScannerT::match_policy_t, + BOOST_DEDUCED_TYPENAME ScannerT::action_policy_t + > policies_t; + + return s.parse(scan.change_policies(policies_t(scan))); + } + + template <typename RT, typename ST, typename ScannerT, typename BaseT> + inline RT + inhibit_case_parser_parse( + ST const& s, + ScannerT const& scan, + inhibit_case_iteration_policy<BaseT> const&) + { + return s.parse(scan); + } + +#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + + /////////////////////////////////////////////////////////////////////// + // + // from spirit 1.1 (copyright (c) 2001 Bruce Florman) + // various workarounds to support longest and shortest directives + // + /////////////////////////////////////////////////////////////////////// + template <typename T> + struct is_alternative + { + // Determine at compile time (without partial specialization) + // whether a given type is an instance of the alternative<A,B> + + static T t(); + template <typename A, typename B> + static char test_(alternative<A, B> const&); // no implementation + static int test_(...); // no implementation + enum { r = sizeof(char) == sizeof(test_(t())) }; + typedef mpl::bool_<r> value; + }; + + template <typename T> struct select_to_longest; + + template <typename T> + struct to_longest_alternative + { + typedef typename select_to_longest<T>::result_t result_t; + typedef typename select_to_longest<T>::plain_t plain_t; + typedef typename select_to_longest<T>::choose_t choose_t; + static result_t convert(T const& a); + }; + + template <typename T> + struct to_longest_generic + { + typedef T const& result_t; + typedef T plain_t; + typedef mpl::false_ choose_t; + }; + + template <typename T> + inline T const& + to_longest_convert(T const& a, mpl::false_) + { return a; } + + template <typename T> + struct to_longest_recursive + { + typedef typename to_longest_alternative< + typename T::left_t>::plain_t a_t; + typedef typename to_longest_alternative< + typename T::right_t>::plain_t b_t; + + typedef longest_alternative<a_t, b_t> result_t; + + typedef result_t plain_t; + typedef mpl::true_ choose_t; + }; + + template <typename A, typename B> + inline typename to_longest_alternative<alternative<A, B> >::result_t + to_longest_convert(alternative<A, B> const& alt, mpl::true_) + { + typedef typename to_longest_alternative< + alternative<A, B> >::result_t result_t; + return result_t( + to_longest_alternative<A>::convert(alt.left()), + to_longest_alternative<B>::convert(alt.right())); + } + + template <typename T> + inline typename to_longest_alternative<T>::result_t + to_longest_alternative<T>::convert(T const& a) + { + return to_longest_convert( + a, to_longest_alternative<T>::choose_t()); + } + + template <typename T> + struct select_to_longest + { + typedef typename mpl::if_< + is_alternative<T> // IF + , to_longest_recursive<T> // THEN + , to_longest_generic<T> // ELSE + >::type type; + + typedef typename select_to_longest::type::result_t result_t; + typedef typename select_to_longest::type::plain_t plain_t; + typedef typename select_to_longest::type::choose_t choose_t; + }; + + template <typename T> struct select_to_shortest; + + template <typename T> + struct to_shortest_alternative + { + typedef typename select_to_shortest<T>::result_t result_t; + typedef typename select_to_shortest<T>::plain_t plain_t; + typedef typename select_to_shortest<T>::choose_t choose_t; + static result_t convert(T const& a); + }; + + template <typename T> + struct to_shortest_generic + { + typedef T const& result_t; + typedef T plain_t; + typedef mpl::false_ choose_t; + }; + + template <typename T> + inline T const& + to_shortest_convert(T const& a, mpl::false_) { return a; } + + template <typename T> + struct to_shortest_recursive + { + typedef typename to_shortest_alternative< + typename T::left_t>::plain_t a_t; + typedef typename to_shortest_alternative< + typename T::right_t>::plain_t b_t; + + typedef shortest_alternative<a_t, b_t> result_t; + + typedef result_t plain_t; + typedef mpl::true_ choose_t; + }; + + template <typename A, typename B> + inline typename to_shortest_alternative<alternative<A, B> >::result_t + to_shortest_convert(alternative<A, B> const& alt, mpl::true_) + { + typedef typename to_shortest_alternative< + alternative<A, B> >::result_t result_t; + return result_t( + to_shortest_alternative<A>::convert(alt.left()), + to_shortest_alternative<B>::convert(alt.right())); + } + + template <typename T> + inline typename to_shortest_alternative<T>::result_t + to_shortest_alternative<T>::convert(T const& a) + { + return to_shortest_convert( + a, to_shortest_alternative<T>::choose_t()); + } + + template <typename T> + struct select_to_shortest + { + typedef typename mpl::if_< + is_alternative<T> // IF + , to_shortest_recursive<T> // THEN + , to_shortest_generic<T> // ELSE + >::type type; + + typedef typename select_to_shortest::type::result_t result_t; + typedef typename select_to_shortest::type::plain_t plain_t; + typedef typename select_to_shortest::type::choose_t choose_t; + }; +#else + template <typename T> + struct to_longest_alternative + { + typedef T result_t; + static result_t const& + convert(T const& a) // Special (end) case + { return a; } + }; + + template <typename A, typename B> + struct to_longest_alternative<alternative<A, B> > + { + typedef typename to_longest_alternative<A>::result_t a_t; + typedef typename to_longest_alternative<B>::result_t b_t; + typedef longest_alternative<a_t, b_t> result_t; + + static result_t + convert(alternative<A, B> const& alt) // Recursive case + { + return result_t( + to_longest_alternative<A>::convert(alt.left()), + to_longest_alternative<B>::convert(alt.right())); + } + }; + + template <typename T> + struct to_shortest_alternative + { + typedef T result_t; + static result_t const& + convert(T const& a) // Special (end) case + { return a; } + }; + + template <typename A, typename B> + struct to_shortest_alternative<alternative<A, B> > + { + typedef typename to_shortest_alternative<A>::result_t a_t; + typedef typename to_shortest_alternative<B>::result_t b_t; + typedef shortest_alternative<a_t, b_t> result_t; + + static result_t + convert(alternative<A, B> const& alt) // Recursive case + { + return result_t( + to_shortest_alternative<A>::convert(alt.left()), + to_shortest_alternative<B>::convert(alt.right())); + } + }; +#endif + } + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit + +#endif + diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/exclusive_or.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/exclusive_or.ipp new file mode 100644 index 0000000..34831a7 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/exclusive_or.ipp @@ -0,0 +1,90 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 Hartmut Kaiser + 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_EXCLUSIVE_OR_IPP) +#define BOOST_SPIRIT_EXCLUSIVE_OR_IPP + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // exclusive_or class implementation + // + /////////////////////////////////////////////////////////////////////////// + template <typename A, typename B> + inline exclusive_or<A, B> + operator^(parser<A> const& a, parser<B> const& b) + { + return exclusive_or<A, B>(a.derived(), b.derived()); + } + + template <typename A> + inline exclusive_or<A, chlit<char> > + operator^(parser<A> const& a, char b) + { + return exclusive_or<A, chlit<char> >(a.derived(), b); + } + + template <typename B> + inline exclusive_or<chlit<char>, B> + operator^(char a, parser<B> const& b) + { + return exclusive_or<chlit<char>, B>(a, b.derived()); + } + + template <typename A> + inline exclusive_or<A, strlit<char const*> > + operator^(parser<A> const& a, char const* b) + { + return exclusive_or<A, strlit<char const*> >(a.derived(), b); + } + + template <typename B> + inline exclusive_or<strlit<char const*>, B> + operator^(char const* a, parser<B> const& b) + { + return exclusive_or<strlit<char const*>, B>(a, b.derived()); + } + + template <typename A> + inline exclusive_or<A, chlit<wchar_t> > + operator^(parser<A> const& a, wchar_t b) + { + return exclusive_or<A, chlit<wchar_t> >(a.derived(), b); + } + + template <typename B> + inline exclusive_or<chlit<wchar_t>, B> + operator^(wchar_t a, parser<B> const& b) + { + return exclusive_or<chlit<wchar_t>, B>(a, b.derived()); + } + + template <typename A> + inline exclusive_or<A, strlit<wchar_t const*> > + operator^(parser<A> const& a, wchar_t const* b) + { + return exclusive_or<A, strlit<wchar_t const*> >(a.derived(), b); + } + + template <typename B> + inline exclusive_or<strlit<wchar_t const*>, B> + operator^(wchar_t const* a, parser<B> const& b) + { + return exclusive_or<strlit<wchar_t const*>, B>(a, b.derived()); + } + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/intersection.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/intersection.ipp new file mode 100644 index 0000000..2810586 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/intersection.ipp @@ -0,0 +1,90 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 Hartmut Kaiser + 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_INTERSECTION_IPP) +#define BOOST_SPIRIT_INTERSECTION_IPP + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // intersection class implementation + // + /////////////////////////////////////////////////////////////////////////// + template <typename A, typename B> + inline intersection<A, B> + operator&(parser<A> const& a, parser<B> const& b) + { + return intersection<A, B>(a.derived(), b.derived()); + } + + template <typename A> + inline intersection<A, chlit<char> > + operator&(parser<A> const& a, char b) + { + return intersection<A, chlit<char> >(a.derived(), b); + } + + template <typename B> + inline intersection<chlit<char>, B> + operator&(char a, parser<B> const& b) + { + return intersection<chlit<char>, B>(a, b.derived()); + } + + template <typename A> + inline intersection<A, strlit<char const*> > + operator&(parser<A> const& a, char const* b) + { + return intersection<A, strlit<char const*> >(a.derived(), b); + } + + template <typename B> + inline intersection<strlit<char const*>, B> + operator&(char const* a, parser<B> const& b) + { + return intersection<strlit<char const*>, B>(a, b.derived()); + } + + template <typename A> + inline intersection<A, chlit<wchar_t> > + operator&(parser<A> const& a, wchar_t b) + { + return intersection<A, chlit<wchar_t> >(a.derived(), b); + } + + template <typename B> + inline intersection<chlit<wchar_t>, B> + operator&(wchar_t a, parser<B> const& b) + { + return intersection<chlit<wchar_t>, B>(a, b.derived()); + } + + template <typename A> + inline intersection<A, strlit<wchar_t const*> > + operator&(parser<A> const& a, wchar_t const* b) + { + return intersection<A, strlit<wchar_t const*> >(a.derived(), b); + } + + template <typename B> + inline intersection<strlit<wchar_t const*>, B> + operator&(wchar_t const* a, parser<B> const& b) + { + return intersection<strlit<wchar_t const*>, B>(a, b.derived()); + } + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/kleene_star.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/kleene_star.ipp new file mode 100644 index 0000000..8c4f513 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/kleene_star.ipp @@ -0,0 +1,34 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 Hartmut Kaiser + 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_KLEENE_STAR_IPP) +#define BOOST_SPIRIT_KLEENE_STAR_IPP + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // kleene_star class implementation + // + /////////////////////////////////////////////////////////////////////////// + template <typename S> + inline kleene_star<S> + operator*(parser<S> const& a) + { + return kleene_star<S>(a.derived()); + } + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/list.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/list.ipp new file mode 100644 index 0000000..cd7965a --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/list.ipp @@ -0,0 +1,93 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 Hartmut Kaiser + 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_LIST_IPP) +#define BOOST_SPIRIT_LIST_IPP + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // operator% is defined as: + // a % b ---> a >> *(b >> a) + // + /////////////////////////////////////////////////////////////////////////// + template <typename A, typename B> + inline sequence<A, kleene_star<sequence<B, A> > > + operator%(parser<A> const& a, parser<B> const& b) + { + return a.derived() >> *(b.derived() >> a.derived()); + } + + template <typename A> + inline sequence<A, kleene_star<sequence<chlit<char>, A> > > + operator%(parser<A> const& a, char b) + { + return a.derived() >> *(b >> a.derived()); + } + + template <typename B> + inline sequence<chlit<char>, kleene_star<sequence<B, chlit<char> > > > + operator%(char a, parser<B> const& b) + { + return a >> *(b.derived() >> a); + } + + template <typename A> + inline sequence<A, kleene_star<sequence<strlit<char const*>, A> > > + operator%(parser<A> const& a, char const* b) + { + return a.derived() >> *(b >> a.derived()); + } + + template <typename B> + inline sequence<strlit<char const*>, + kleene_star<sequence<B, strlit<char const*> > > > + operator%(char const* a, parser<B> const& b) + { + return a >> *(b.derived() >> a); + } + + template <typename A> + inline sequence<A, kleene_star<sequence<chlit<wchar_t>, A> > > + operator%(parser<A> const& a, wchar_t b) + { + return a.derived() >> *(b >> a.derived()); + } + + template <typename B> + inline sequence<chlit<wchar_t>, kleene_star<sequence<B, chlit<wchar_t> > > > + operator%(wchar_t a, parser<B> const& b) + { + return a >> *(b.derived() >> a); + } + + template <typename A> + inline sequence<A, kleene_star<sequence<strlit<wchar_t const*>, A> > > + operator%(parser<A> const& a, wchar_t const* b) + { + return a.derived() >> *(b >> a.derived()); + } + + template <typename B> + inline sequence<strlit<wchar_t const*>, + kleene_star<sequence<B, strlit<wchar_t const*> > > > + operator%(wchar_t const* a, parser<B> const& b) + { + return a >> *(b.derived() >> a); + } + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/optional.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/optional.ipp new file mode 100644 index 0000000..629eac8 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/optional.ipp @@ -0,0 +1,34 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 Hartmut Kaiser + 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_OPTIONAL_IPP) +#define BOOST_SPIRIT_OPTIONAL_IPP + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // optional class implementation + // + /////////////////////////////////////////////////////////////////////////// + template <typename S> + optional<S> + operator!(parser<S> const& a) + { + return optional<S>(a.derived()); + } + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/positive.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/positive.ipp new file mode 100644 index 0000000..9698e69 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/positive.ipp @@ -0,0 +1,34 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 Hartmut Kaiser + 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_POSITIVE_IPP) +#define BOOST_SPIRIT_POSITIVE_IPP + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // positive class implementation + // + /////////////////////////////////////////////////////////////////////////// + template <typename S> + inline positive<S> + operator+(parser<S> const& a) + { + return positive<S>(a.derived()); + } + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/sequence.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/sequence.ipp new file mode 100644 index 0000000..283d420 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/sequence.ipp @@ -0,0 +1,90 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 Hartmut Kaiser + 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_SEQUENCE_IPP) +#define BOOST_SPIRIT_SEQUENCE_IPP + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // sequence class implementation + // + /////////////////////////////////////////////////////////////////////////// + template <typename A, typename B> + inline sequence<A, B> + operator>>(parser<A> const& a, parser<B> const& b) + { + return sequence<A, B>(a.derived(), b.derived()); + } + + template <typename A> + inline sequence<A, chlit<char> > + operator>>(parser<A> const& a, char b) + { + return sequence<A, chlit<char> >(a.derived(), b); + } + + template <typename B> + inline sequence<chlit<char>, B> + operator>>(char a, parser<B> const& b) + { + return sequence<chlit<char>, B>(a, b.derived()); + } + + template <typename A> + inline sequence<A, strlit<char const*> > + operator>>(parser<A> const& a, char const* b) + { + return sequence<A, strlit<char const*> >(a.derived(), b); + } + + template <typename B> + inline sequence<strlit<char const*>, B> + operator>>(char const* a, parser<B> const& b) + { + return sequence<strlit<char const*>, B>(a, b.derived()); + } + + template <typename A> + inline sequence<A, chlit<wchar_t> > + operator>>(parser<A> const& a, wchar_t b) + { + return sequence<A, chlit<wchar_t> >(a.derived(), b); + } + + template <typename B> + inline sequence<chlit<wchar_t>, B> + operator>>(wchar_t a, parser<B> const& b) + { + return sequence<chlit<wchar_t>, B>(a, b.derived()); + } + + template <typename A> + inline sequence<A, strlit<wchar_t const*> > + operator>>(parser<A> const& a, wchar_t const* b) + { + return sequence<A, strlit<wchar_t const*> >(a.derived(), b); + } + + template <typename B> + inline sequence<strlit<wchar_t const*>, B> + operator>>(wchar_t const* a, parser<B> const& b) + { + return sequence<strlit<wchar_t const*>, B>(a, b.derived()); + } + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/sequential_and.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/sequential_and.ipp new file mode 100644 index 0000000..9f577a4 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/sequential_and.ipp @@ -0,0 +1,90 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 Hartmut Kaiser + 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_SEQUENTIAL_AND_IPP) +#define BOOST_SPIRIT_SEQUENTIAL_AND_IPP + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // sequential-and operators implementation + // + /////////////////////////////////////////////////////////////////////////// + template <typename A, typename B> + inline sequence<A, B> + operator&&(parser<A> const& a, parser<B> const& b) + { + return sequence<A, B>(a.derived(), b.derived()); + } + + template <typename A> + inline sequence<A, chlit<char> > + operator&&(parser<A> const& a, char b) + { + return sequence<A, chlit<char> >(a.derived(), b); + } + + template <typename B> + inline sequence<chlit<char>, B> + operator&&(char a, parser<B> const& b) + { + return sequence<chlit<char>, B>(a, b.derived()); + } + + template <typename A> + inline sequence<A, strlit<char const*> > + operator&&(parser<A> const& a, char const* b) + { + return sequence<A, strlit<char const*> >(a.derived(), b); + } + + template <typename B> + inline sequence<strlit<char const*>, B> + operator&&(char const* a, parser<B> const& b) + { + return sequence<strlit<char const*>, B>(a, b.derived()); + } + + template <typename A> + inline sequence<A, chlit<wchar_t> > + operator&&(parser<A> const& a, wchar_t b) + { + return sequence<A, chlit<wchar_t> >(a.derived(), b); + } + + template <typename B> + inline sequence<chlit<wchar_t>, B> + operator&&(wchar_t a, parser<B> const& b) + { + return sequence<chlit<wchar_t>, B>(a, b.derived()); + } + + template <typename A> + inline sequence<A, strlit<wchar_t const*> > + operator&&(parser<A> const& a, wchar_t const* b) + { + return sequence<A, strlit<wchar_t const*> >(a.derived(), b); + } + + template <typename B> + inline sequence<strlit<wchar_t const*>, B> + operator&&(wchar_t const* a, parser<B> const& b) + { + return sequence<strlit<wchar_t const*>, B>(a, b.derived()); + } + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/sequential_or.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/sequential_or.ipp new file mode 100644 index 0000000..521faf6 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/impl/sequential_or.ipp @@ -0,0 +1,90 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 Hartmut Kaiser + 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_SEQUENTIAL_OR_IPP) +#define BOOST_SPIRIT_SEQUENTIAL_OR_IPP + +namespace boost { namespace spirit { + + BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // sequential-or class implementation + // + /////////////////////////////////////////////////////////////////////////// + template <typename A, typename B> + inline sequential_or<A, B> + operator||(parser<A> const& a, parser<B> const& b) + { + return sequential_or<A, B>(a.derived(), b.derived()); + } + + template <typename A> + inline sequential_or<A, chlit<char> > + operator||(parser<A> const& a, char b) + { + return sequential_or<A, chlit<char> >(a.derived(), b); + } + + template <typename B> + inline sequential_or<chlit<char>, B> + operator||(char a, parser<B> const& b) + { + return sequential_or<chlit<char>, B>(a, b.derived()); + } + + template <typename A> + inline sequential_or<A, strlit<char const*> > + operator||(parser<A> const& a, char const* b) + { + return sequential_or<A, strlit<char const*> >(a.derived(), b); + } + + template <typename B> + inline sequential_or<strlit<char const*>, B> + operator||(char const* a, parser<B> const& b) + { + return sequential_or<strlit<char const*>, B>(a, b.derived()); + } + + template <typename A> + inline sequential_or<A, chlit<wchar_t> > + operator||(parser<A> const& a, wchar_t b) + { + return sequential_or<A, chlit<wchar_t> >(a.derived(), b); + } + + template <typename B> + inline sequential_or<chlit<wchar_t>, B> + operator||(wchar_t a, parser<B> const& b) + { + return sequential_or<chlit<wchar_t>, B>(a, b.derived()); + } + + template <typename A> + inline sequential_or<A, strlit<wchar_t const*> > + operator||(parser<A> const& a, wchar_t const* b) + { + return sequential_or<A, strlit<wchar_t const*> >(a.derived(), b); + } + + template <typename B> + inline sequential_or<strlit<wchar_t const*>, B> + operator||(wchar_t const* a, parser<B> const& b) + { + return sequential_or<strlit<wchar_t const*>, B>(a, b.derived()); + } + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/intersection.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/intersection.hpp new file mode 100644 index 0000000..867c20f --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/intersection.hpp @@ -0,0 +1,142 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 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_INTERSECTION_HPP) +#define BOOST_SPIRIT_INTERSECTION_HPP + +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/parser.hpp> +#include <boost/spirit/home/classic/core/primitives/primitives.hpp> +#include <boost/spirit/home/classic/core/composite/composite.hpp> +#include <boost/spirit/home/classic/meta/as_parser.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // intersection class + // + // Handles expressions of the form: + // + // a & b + // + // where a and b are parsers. The expression returns a composite + // parser that matches a and b. One (not both) of the operands may + // be a literal char, wchar_t or a primitive string char const*, + // wchar_t const*. + // + // The expression is short circuit evaluated. b is never touched + // when a is returns a no-match. + // + /////////////////////////////////////////////////////////////////////////// + struct intersection_parser_gen; + + template <typename A, typename B> + struct intersection + : public binary<A, B, parser<intersection<A, B> > > + { + typedef intersection<A, B> self_t; + typedef binary_parser_category parser_category_t; + typedef intersection_parser_gen parser_generator_t; + typedef binary<A, B, parser<self_t> > base_t; + + intersection(A const& a, B const& b) + : base_t(a, b) {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef typename parser_result<self_t, ScannerT>::type result_t; + typedef typename ScannerT::iterator_t iterator_t; + iterator_t save = scan.first; + if (result_t hl = this->left().parse(scan)) + { + ScannerT bscan(scan.first, scan.first, scan); + scan.first = save; + result_t hr = this->right().parse(bscan); + if (hl.length() == hr.length()) + return hl; + } + + return scan.no_match(); + } + }; + + struct intersection_parser_gen + { + template <typename A, typename B> + struct result + { + typedef + intersection< + typename as_parser<A>::type + , typename as_parser<B>::type + > + type; + }; + + template <typename A, typename B> + static intersection< + typename as_parser<A>::type + , typename as_parser<B>::type + > + generate(A const& a, B const& b) + { + return intersection<BOOST_DEDUCED_TYPENAME as_parser<A>::type, + BOOST_DEDUCED_TYPENAME as_parser<B>::type> + (as_parser<A>::convert(a), as_parser<B>::convert(b)); + } + }; + + template <typename A, typename B> + intersection<A, B> + operator&(parser<A> const& a, parser<B> const& b); + + template <typename A> + intersection<A, chlit<char> > + operator&(parser<A> const& a, char b); + + template <typename B> + intersection<chlit<char>, B> + operator&(char a, parser<B> const& b); + + template <typename A> + intersection<A, strlit<char const*> > + operator&(parser<A> const& a, char const* b); + + template <typename B> + intersection<strlit<char const*>, B> + operator&(char const* a, parser<B> const& b); + + template <typename A> + intersection<A, chlit<wchar_t> > + operator&(parser<A> const& a, wchar_t b); + + template <typename B> + intersection<chlit<wchar_t>, B> + operator&(wchar_t a, parser<B> const& b); + + template <typename A> + intersection<A, strlit<wchar_t const*> > + operator&(parser<A> const& a, wchar_t const* b); + + template <typename B> + intersection<strlit<wchar_t const*>, B> + operator&(wchar_t const* a, parser<B> const& b); + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif + +#include <boost/spirit/home/classic/core/composite/impl/intersection.ipp> diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/kleene_star.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/kleene_star.hpp new file mode 100644 index 0000000..9b6c73a --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/kleene_star.hpp @@ -0,0 +1,109 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 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_KLEENE_STAR_HPP) +#define BOOST_SPIRIT_KLEENE_STAR_HPP + +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/parser.hpp> +#include <boost/spirit/home/classic/core/primitives/primitives.hpp> +#include <boost/spirit/home/classic/core/composite/composite.hpp> +#include <boost/spirit/home/classic/meta/as_parser.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // kleene_star class + // + // Handles expressions of the form: + // + // *a + // + // where a is a parser. The expression returns a composite + // parser that matches its subject zero (0) or more times. + // + /////////////////////////////////////////////////////////////////////////// + struct kleene_star_parser_gen; + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(push) +#pragma warning(disable:4512) //assignment operator could not be generated +#endif + + template <typename S> + struct kleene_star + : public unary<S, parser<kleene_star<S> > > + { + typedef kleene_star<S> self_t; + typedef unary_parser_category parser_category_t; + typedef kleene_star_parser_gen parser_generator_t; + typedef unary<S, parser<self_t> > base_t; + + kleene_star(S const& a) + : base_t(a) {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef typename parser_result<self_t, ScannerT>::type result_t; + typedef typename ScannerT::iterator_t iterator_t; + result_t hit = scan.empty_match(); + + for (;;) + { + iterator_t save = scan.first; + if (result_t next = this->subject().parse(scan)) + { + scan.concat_match(hit, next); + } + else + { + scan.first = save; + return hit; + } + } + } + }; + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(pop) +#endif + + struct kleene_star_parser_gen + { + template <typename S> + struct result + { + typedef kleene_star<S> type; + }; + + template <typename S> + static kleene_star<S> + generate(parser<S> const& a) + { + return kleene_star<S>(a.derived()); + } + }; + + ////////////////////////////////// + template <typename S> + kleene_star<S> + operator*(parser<S> const& a); + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif + +#include <boost/spirit/home/classic/core/composite/impl/kleene_star.ipp> diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/list.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/list.hpp new file mode 100644 index 0000000..cdb879e --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/list.hpp @@ -0,0 +1,73 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 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_LIST_HPP) +#define BOOST_SPIRIT_LIST_HPP + +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/parser.hpp> +#include <boost/spirit/home/classic/core/primitives/primitives.hpp> +#include <boost/spirit/home/classic/core/composite/composite.hpp> +#include <boost/spirit/home/classic/meta/as_parser.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // operator% is defined as: + // a % b ---> a >> *(b >> a) + // + /////////////////////////////////////////////////////////////////////////// + template <typename A, typename B> + sequence<A, kleene_star<sequence<B, A> > > + operator%(parser<A> const& a, parser<B> const& b); + + template <typename A> + sequence<A, kleene_star<sequence<chlit<char>, A> > > + operator%(parser<A> const& a, char b); + + template <typename B> + sequence<chlit<char>, kleene_star<sequence<B, chlit<char> > > > + operator%(char a, parser<B> const& b); + + template <typename A> + sequence<A, kleene_star<sequence<strlit<char const*>, A> > > + operator%(parser<A> const& a, char const* b); + + template <typename B> + sequence<strlit<char const*>, + kleene_star<sequence<B, strlit<char const*> > > > + operator%(char const* a, parser<B> const& b); + + template <typename A> + sequence<A, kleene_star<sequence<chlit<wchar_t>, A> > > + operator%(parser<A> const& a, wchar_t b); + + template <typename B> + sequence<chlit<wchar_t>, kleene_star<sequence<B, chlit<wchar_t> > > > + operator%(wchar_t a, parser<B> const& b); + + template <typename A> + sequence<A, kleene_star<sequence<strlit<wchar_t const*>, A> > > + operator%(parser<A> const& a, wchar_t const* b); + + template <typename B> + sequence<strlit<wchar_t const*>, + kleene_star<sequence<B, strlit<wchar_t const*> > > > + operator%(wchar_t const* a, parser<B> const& b); + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif + +#include <boost/spirit/home/classic/core/composite/impl/list.ipp> diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/operators.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/operators.hpp new file mode 100644 index 0000000..5732ef9 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/operators.hpp @@ -0,0 +1,25 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 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_OPERATORS_HPP) +#define BOOST_SPIRIT_OPERATORS_HPP + +#include <boost/spirit/home/classic/core/composite/sequence.hpp> +#include <boost/spirit/home/classic/core/composite/sequential_and.hpp> +#include <boost/spirit/home/classic/core/composite/sequential_or.hpp> +#include <boost/spirit/home/classic/core/composite/alternative.hpp> +#include <boost/spirit/home/classic/core/composite/difference.hpp> +#include <boost/spirit/home/classic/core/composite/intersection.hpp> +#include <boost/spirit/home/classic/core/composite/exclusive_or.hpp> +#include <boost/spirit/home/classic/core/composite/kleene_star.hpp> +#include <boost/spirit/home/classic/core/composite/positive.hpp> +#include <boost/spirit/home/classic/core/composite/optional.hpp> +#include <boost/spirit/home/classic/core/composite/list.hpp> + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/optional.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/optional.hpp new file mode 100644 index 0000000..69e49f9 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/optional.hpp @@ -0,0 +1,94 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 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_OPTIONAL_HPP) +#define BOOST_SPIRIT_OPTIONAL_HPP + +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/parser.hpp> +#include <boost/spirit/home/classic/core/primitives/primitives.hpp> +#include <boost/spirit/home/classic/core/composite/composite.hpp> +#include <boost/spirit/home/classic/meta/as_parser.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // optional class + // + // Handles expressions of the form: + // + // !a + // + // where a is a parser. The expression returns a composite + // parser that matches its subject zero (0) or one (1) time. + // + /////////////////////////////////////////////////////////////////////////// + struct optional_parser_gen; + + template <typename S> + struct optional + : public unary<S, parser<optional<S> > > + { + typedef optional<S> self_t; + typedef unary_parser_category parser_category_t; + typedef optional_parser_gen parser_generator_t; + typedef unary<S, parser<self_t> > base_t; + + optional(S const& a) + : base_t(a) {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef typename parser_result<self_t, ScannerT>::type result_t; + typedef typename ScannerT::iterator_t iterator_t; + iterator_t save = scan.first; + if (result_t r = this->subject().parse(scan)) + { + return r; + } + else + { + scan.first = save; + return scan.empty_match(); + } + } + }; + + struct optional_parser_gen + { + template <typename S> + struct result + { + typedef optional<S> type; + }; + + template <typename S> + static optional<S> + generate(parser<S> const& a) + { + return optional<S>(a.derived()); + } + }; + + template <typename S> + optional<S> + operator!(parser<S> const& a); + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif + +#include <boost/spirit/home/classic/core/composite/impl/optional.ipp> diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/positive.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/positive.hpp new file mode 100644 index 0000000..7b494b4 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/positive.hpp @@ -0,0 +1,112 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 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_POSITIVE_HPP) +#define BOOST_SPIRIT_POSITIVE_HPP + +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/parser.hpp> +#include <boost/spirit/home/classic/core/primitives/primitives.hpp> +#include <boost/spirit/home/classic/core/composite/composite.hpp> +#include <boost/spirit/home/classic/meta/as_parser.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // positive class + // + // Handles expressions of the form: + // + // +a + // + // where a is a parser. The expression returns a composite + // parser that matches its subject one (1) or more times. + // + /////////////////////////////////////////////////////////////////////////// + struct positive_parser_gen; + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(push) +#pragma warning(disable:4512) //assignment operator could not be generated +#endif + + template <typename S> + struct positive + : public unary<S, parser<positive<S> > > + { + typedef positive<S> self_t; + typedef unary_parser_category parser_category_t; + typedef positive_parser_gen parser_generator_t; + typedef unary<S, parser<self_t> > base_t; + + positive(S const& a) + : base_t(a) {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef typename parser_result<self_t, ScannerT>::type result_t; + typedef typename ScannerT::iterator_t iterator_t; + result_t hit = this->subject().parse(scan); + + if (hit) + { + for (;;) + { + iterator_t save = scan.first; + if (result_t next = this->subject().parse(scan)) + { + scan.concat_match(hit, next); + } + else + { + scan.first = save; + break; + } + } + } + return hit; + } + }; + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(pop) +#endif + + struct positive_parser_gen + { + template <typename S> + struct result + { + typedef positive<S> type; + }; + + template <typename S> + static positive<S> + generate(parser<S> const& a) + { + return positive<S>(a.derived()); + } + }; + + template <typename S> + inline positive<S> + operator+(parser<S> const& a); + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif + +#include <boost/spirit/home/classic/core/composite/impl/positive.ipp> diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/sequence.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/sequence.hpp new file mode 100644 index 0000000..3ccd9ea --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/sequence.hpp @@ -0,0 +1,142 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 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_SEQUENCE_HPP) +#define BOOST_SPIRIT_SEQUENCE_HPP + +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/parser.hpp> +#include <boost/spirit/home/classic/core/primitives/primitives.hpp> +#include <boost/spirit/home/classic/core/composite/composite.hpp> +#include <boost/spirit/home/classic/meta/as_parser.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // sequence class + // + // Handles expressions of the form: + // + // a >> b + // + // where a and b are parsers. The expression returns a composite + // parser that matches a and b in sequence. One (not both) of the + // operands may be a literal char, wchar_t or a primitive string + // char const*, wchar_t const*. + // + ////////////////////////////////////////////////////////////////////////// + struct sequence_parser_gen; + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(push) +#pragma warning(disable:4512) //assignment operator could not be generated +#endif + + template <typename A, typename B> + struct sequence : public binary<A, B, parser<sequence<A, B> > > + { + typedef sequence<A, B> self_t; + typedef binary_parser_category parser_category_t; + typedef sequence_parser_gen parser_generator_t; + typedef binary<A, B, parser<self_t> > base_t; + + sequence(A const& a, B const& b) + : base_t(a, b) {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef typename parser_result<self_t, ScannerT>::type result_t; + if (result_t ma = this->left().parse(scan)) + if (result_t mb = this->right().parse(scan)) + { + scan.concat_match(ma, mb); + return ma; + } + return scan.no_match(); + } + }; + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(pop) +#endif + + struct sequence_parser_gen + { + template <typename A, typename B> + struct result + { + typedef + sequence< + typename as_parser<A>::type + , typename as_parser<B>::type + > + type; + }; + + template <typename A, typename B> + static sequence< + typename as_parser<A>::type + , typename as_parser<B>::type + > + generate(A const& a, B const& b) + { + return sequence<BOOST_DEDUCED_TYPENAME as_parser<A>::type, + BOOST_DEDUCED_TYPENAME as_parser<B>::type> + (as_parser<A>::convert(a), as_parser<B>::convert(b)); + } + }; + + template <typename A, typename B> + sequence<A, B> + operator>>(parser<A> const& a, parser<B> const& b); + + template <typename A> + sequence<A, chlit<char> > + operator>>(parser<A> const& a, char b); + + template <typename B> + sequence<chlit<char>, B> + operator>>(char a, parser<B> const& b); + + template <typename A> + sequence<A, strlit<char const*> > + operator>>(parser<A> const& a, char const* b); + + template <typename B> + sequence<strlit<char const*>, B> + operator>>(char const* a, parser<B> const& b); + + template <typename A> + sequence<A, chlit<wchar_t> > + operator>>(parser<A> const& a, wchar_t b); + + template <typename B> + sequence<chlit<wchar_t>, B> + operator>>(wchar_t a, parser<B> const& b); + + template <typename A> + sequence<A, strlit<wchar_t const*> > + operator>>(parser<A> const& a, wchar_t const* b); + + template <typename B> + sequence<strlit<wchar_t const*>, B> + operator>>(wchar_t const* a, parser<B> const& b); + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif + +#include <boost/spirit/home/classic/core/composite/impl/sequence.ipp> diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/sequential_and.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/sequential_and.hpp new file mode 100644 index 0000000..da11f87 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/sequential_and.hpp @@ -0,0 +1,76 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 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_SEQUENTIAL_AND_HPP) +#define BOOST_SPIRIT_SEQUENTIAL_AND_HPP + +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/parser.hpp> +#include <boost/spirit/home/classic/core/primitives/primitives.hpp> +#include <boost/spirit/home/classic/core/composite/composite.hpp> +#include <boost/spirit/home/classic/meta/as_parser.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // sequential-and operators + // + // Handles expressions of the form: + // + // a && b + // + // Same as a >> b. + // + /////////////////////////////////////////////////////////////////////////// + template <typename A, typename B> + sequence<A, B> + operator&&(parser<A> const& a, parser<B> const& b); + + template <typename A> + sequence<A, chlit<char> > + operator&&(parser<A> const& a, char b); + + template <typename B> + sequence<chlit<char>, B> + operator&&(char a, parser<B> const& b); + + template <typename A> + sequence<A, strlit<char const*> > + operator&&(parser<A> const& a, char const* b); + + template <typename B> + sequence<strlit<char const*>, B> + operator&&(char const* a, parser<B> const& b); + + template <typename A> + sequence<A, chlit<wchar_t> > + operator&&(parser<A> const& a, wchar_t b); + + template <typename B> + sequence<chlit<wchar_t>, B> + operator&&(wchar_t a, parser<B> const& b); + + template <typename A> + sequence<A, strlit<wchar_t const*> > + operator&&(parser<A> const& a, wchar_t const* b); + + template <typename B> + sequence<strlit<wchar_t const*>, B> + operator&&(wchar_t const* a, parser<B> const& b); + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif + +#include <boost/spirit/home/classic/core/composite/impl/sequential_and.ipp> diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/sequential_or.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/sequential_or.hpp new file mode 100644 index 0000000..b276f6c --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/composite/sequential_or.hpp @@ -0,0 +1,154 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + Copyright (c) 2002 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_SEQUENTIAL_OR_HPP) +#define BOOST_SPIRIT_SEQUENTIAL_OR_HPP + +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/parser.hpp> +#include <boost/spirit/home/classic/core/primitives/primitives.hpp> +#include <boost/spirit/home/classic/core/composite/composite.hpp> +#include <boost/spirit/home/classic/meta/as_parser.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // sequential-or class + // + // Handles expressions of the form: + // + // a || b + // + // Equivalent to + // + // a | b | a >> b; + // + // where a and b are parsers. The expression returns a composite + // parser that matches matches a or b in sequence. One (not both) of + // the operands may be a literal char, wchar_t or a primitive string + // char const*, wchar_t const*. + // + /////////////////////////////////////////////////////////////////////////// + struct sequential_or_parser_gen; + + template <typename A, typename B> + struct sequential_or : public binary<A, B, parser<sequential_or<A, B> > > + { + typedef sequential_or<A, B> self_t; + typedef binary_parser_category parser_category_t; + typedef sequential_or_parser_gen parser_generator_t; + typedef binary<A, B, parser<self_t> > base_t; + + sequential_or(A const& a, B const& b) + : base_t(a, b) {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef typename parser_result<self_t, ScannerT>::type result_t; + typedef typename ScannerT::iterator_t iterator_t; + { // scope for save + iterator_t save = scan.first; + if (result_t ma = this->left().parse(scan)) + { + save = scan.first; + if (result_t mb = this->right().parse(scan)) + { + // matched a b + scan.concat_match(ma, mb); + return ma; + } + else + { + // matched a + scan.first = save; + return ma; + } + } + scan.first = save; + } + + // matched b + return this->right().parse(scan); + } + }; + + struct sequential_or_parser_gen + { + template <typename A, typename B> + struct result + { + typedef + sequential_or< + typename as_parser<A>::type + , typename as_parser<B>::type + > + type; + }; + + template <typename A, typename B> + static sequential_or< + typename as_parser<A>::type + , typename as_parser<B>::type + > + generate(A const& a, B const& b) + { + return sequential_or<BOOST_DEDUCED_TYPENAME as_parser<A>::type, + BOOST_DEDUCED_TYPENAME as_parser<B>::type> + (as_parser<A>::convert(a), as_parser<B>::convert(b)); + } + }; + + template <typename A, typename B> + sequential_or<A, B> + operator||(parser<A> const& a, parser<B> const& b); + + template <typename A> + sequential_or<A, chlit<char> > + operator||(parser<A> const& a, char b); + + template <typename B> + sequential_or<chlit<char>, B> + operator||(char a, parser<B> const& b); + + template <typename A> + sequential_or<A, strlit<char const*> > + operator||(parser<A> const& a, char const* b); + + template <typename B> + sequential_or<strlit<char const*>, B> + operator||(char const* a, parser<B> const& b); + + template <typename A> + sequential_or<A, chlit<wchar_t> > + operator||(parser<A> const& a, wchar_t b); + + template <typename B> + sequential_or<chlit<wchar_t>, B> + operator||(wchar_t a, parser<B> const& b); + + template <typename A> + sequential_or<A, strlit<wchar_t const*> > + operator||(parser<A> const& a, wchar_t const* b); + + template <typename B> + sequential_or<strlit<wchar_t const*>, B> + operator||(wchar_t const* a, parser<B> const& b); + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif + +#include <boost/spirit/home/classic/core/composite/impl/sequential_or.ipp> diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/config.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/config.hpp new file mode 100644 index 0000000..57eca7f --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/config.hpp @@ -0,0 +1,62 @@ +/*============================================================================= + Copyright (c) 2001-2003 Joel de Guzman + 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_CONFIG_HPP) +#define BOOST_SPIRIT_CONFIG_HPP + +#include <boost/config.hpp> + +/////////////////////////////////////////////////////////////////////////////// +// +// Compiler check: +// +// Historically, Spirit supported a lot of compilers, including (to some +// extent) poorly conforming compilers such as VC6. Spirit v1.6.x will be +// the last release that will support older poorly conforming compilers. +// Starting from Spirit v1.8.0, ill conforming compilers will not be +// supported. If you are still using one of these older compilers, you can +// still use Spirit v1.6.x. +// +// The reason why Spirit v1.6.x worked on old non-conforming compilers is +// that the authors laboriously took the trouble of searching for +// workarounds to make these compilers happy. The process takes a lot of +// time and energy, especially when one encounters the dreaded ICE or +// "Internal Compiler Error". Sometimes searching for a single workaround +// takes days or even weeks. Sometimes, there are no known workarounds. This +// stifles progress a lot. And, as the library gets more progressive and +// takes on more advanced C++ techniques, the difficulty is escalated to +// even new heights. +// +// Spirit v1.6.x will still be supported. Maintenance and bug fixes will +// still be applied. There will still be active development for the back- +// porting of new features introduced in Spirit v1.8.0 (and Spirit 1.9.0) +// to lesser able compilers; hopefully, fueled by contributions from the +// community. For instance, there is already a working AST tree back-port +// for VC6 and VC7 by Peder Holt. +// +// If you got here somehow, your compiler is known to be poorly conforming +// WRT ANSI/ISO C++ standard. Library implementers get a bad reputation when +// someone attempts to compile the code on a non-conforming compiler. She'll +// be confronted with tons of compiler errors when she tries to compile the +// library. Such errors will somehow make less informed users conclude that +// the code is poorly written. It's better for the user to see a message +// "sorry, this code has not been ported to your compiler yet", than to see +// pages and pages of compiler error messages. +// +///////////////////////////////////////////////////////////////////////////////// +#if (defined(BOOST_MSVC) && (BOOST_MSVC < 1310)) \ + || (defined(__BORLANDC__) && (__BORLANDC__ <= 0x570)) \ + || (defined(__GNUC__) && (__GNUC__ < 3)) \ + || (defined(__GNUC__) && (__GNUC__ == 3) && (__GNUC_MINOR__ < 1)) +# error "Compiler not supported. See note in <boost/spirit/core/config.hpp>" +#else +// Pass... Compiler supported. +#endif + +#endif + + 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 + diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/match.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/match.hpp new file mode 100644 index 0000000..6f1822e --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/match.hpp @@ -0,0 +1,185 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + 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_MATCH_HPP) +#define BOOST_SPIRIT_MATCH_HPP + +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/config.hpp> +#include <boost/spirit/home/classic/core/nil.hpp> +#include <boost/call_traits.hpp> +#include <boost/optional.hpp> +#include <boost/spirit/home/classic/core/assert.hpp> +#include <boost/spirit/home/classic/core/safe_bool.hpp> +#include <boost/spirit/home/classic/core/impl/match_attr_traits.ipp> +#include <boost/type_traits/add_const.hpp> +#include <boost/type_traits/is_reference.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // match class + // + // The match holds the result of a parser. A match object evaluates + // to true when a successful match is found, otherwise false. The + // length of the match is the number of characters (or tokens) that + // is successfully matched. This can be queried through its length() + // member function. A negative value means that the match is + // unsucessful. + // + // Each parser may have an associated attribute. This attribute is + // also returned back to the client on a successful parse through + // the match object. The match's value() member function returns the + // match's attribute. + // + // A match attribute is valid: + // + // * on a successful match + // * when its value is set through the value(val) member function + // * if it is assigned or copied from a compatible match object + // (e.g. match<double> from match<int>) with a valid attribute. + // + // The match attribute is undefined: + // + // * on an unsuccessful match + // * when an attempt to copy or assign from another match object + // with an incompatible attribute type (e.g. match<std::string> + // from match<int>). + // + // The member function has_valid_attribute() can be queried to know if + // it is safe to get the match's attribute. The attribute may be set + // through the member function value(v) where v is the new attribute + // value. + // + /////////////////////////////////////////////////////////////////////////// + template <typename T = nil_t> + class match : public safe_bool<match<T> > + { + + public: + + typedef typename boost::optional<T> optional_type; + typedef typename optional_type::argument_type ctor_param_t; + typedef typename optional_type::reference_const_type return_t; + typedef T attr_t; + + match(); + explicit match(std::size_t length); + match(std::size_t length, ctor_param_t val); + + bool operator!() const; + std::ptrdiff_t length() const; + bool has_valid_attribute() const; + return_t value() const; + void swap(match& other); + + template <typename T2> + match(match<T2> const& other) + : len(other.length()), val() + { + impl::match_attr_traits<T>::copy(val, other); + } + + template <typename T2> + match& + operator=(match<T2> const& other) + { + impl::match_attr_traits<T>::assign(val, other); + len = other.length(); + return *this; + } + + template <typename MatchT> + void + concat(MatchT const& other) + { + BOOST_SPIRIT_ASSERT(*this && other); + len += other.length(); + } + + template <typename ValueT> + void + value(ValueT const& val_) + { + impl::match_attr_traits<T>::set_value(val, val_, is_reference<T>()); + } + + bool operator_bool() const + { + return len >= 0; + } + + private: + + std::ptrdiff_t len; + optional_type val; + }; + + /////////////////////////////////////////////////////////////////////////// + // + // match class specialization for nil_t values + // + /////////////////////////////////////////////////////////////////////////// + template <> + class match<nil_t> : public safe_bool<match<nil_t> > + { + public: + + typedef nil_t attr_t; + typedef nil_t return_t; + + match(); + explicit match(std::size_t length); + match(std::size_t length, nil_t); + + bool operator!() const; + bool has_valid_attribute() const; + std::ptrdiff_t length() const; + nil_t value() const; + void value(nil_t); + void swap(match& other); + + template <typename T> + match(match<T> const& other) + : len(other.length()) {} + + template <typename T> + match<>& + operator=(match<T> const& other) + { + len = other.length(); + return *this; + } + + template <typename T> + void + concat(match<T> const& other) + { + BOOST_SPIRIT_ASSERT(*this && other); + len += other.length(); + } + + bool operator_bool() const + { + return len >= 0; + } + + private: + + std::ptrdiff_t len; + }; + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif +#include <boost/spirit/home/classic/core/impl/match.ipp> + diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/nil.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/nil.hpp new file mode 100644 index 0000000..c94c064 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/nil.hpp @@ -0,0 +1,25 @@ +/*============================================================================= + Copyright (c) 2001-2003 Joel de Guzman + 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_NIL_HPP) +#define BOOST_SPIRIT_NIL_HPP + +#include <boost/spirit/home/classic/namespace.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + struct nil_t {}; + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} + +#endif + + diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/non_terminal/impl/rule.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/core/non_terminal/impl/rule.ipp new file mode 100644 index 0000000..9f10306 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/non_terminal/impl/rule.ipp @@ -0,0 +1,420 @@ +/*============================================================================= + 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_RULE_IPP) +#define BOOST_SPIRIT_RULE_IPP + +#if BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT > 1 +#include <boost/preprocessor/repeat.hpp> +#include <boost/preprocessor/repeat_from_to.hpp> +#include <boost/preprocessor/enum_params.hpp> +#include <boost/preprocessor/enum_params_with_defaults.hpp> +#include <boost/preprocessor/facilities/intercept.hpp> +#include <boost/preprocessor/inc.hpp> +#include <boost/preprocessor/cat.hpp> +#endif + +#include <boost/spirit/home/classic/core/parser.hpp> +#include <boost/spirit/home/classic/core/scanner/scanner.hpp> +#include <boost/spirit/home/classic/core/non_terminal/parser_context.hpp> +#include <boost/spirit/home/classic/core/non_terminal/parser_id.hpp> +#include <boost/type_traits/is_base_and_derived.hpp> + +/////////////////////////////////////////////////////////////////////////////// +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + +#if BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT > 1 + + template < + BOOST_PP_ENUM_BINARY_PARAMS( + BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT, + typename ScannerT, = mpl::void_ BOOST_PP_INTERCEPT + ) + > + struct scanner_list; + +#endif // BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT > 1 + + /////////////////////////////////////////////////////////////////////////// + namespace impl + { + template <typename BaseT, typename DefaultT + , typename T0, typename T1, typename T2> + struct get_param + { + typedef typename mpl::if_< + is_base_and_derived<BaseT, T0> + , T0 + , typename mpl::if_< + is_base_and_derived<BaseT, T1> + , T1 + , typename mpl::if_< + is_base_and_derived<BaseT, T2> + , T2 + , DefaultT + >::type + >::type + >::type type; + }; + + template <typename T0, typename T1, typename T2> + struct get_context + { + typedef typename get_param< + parser_context_base, parser_context<>, T0, T1, T2>::type + type; + }; + + template <typename T0, typename T1, typename T2> + struct get_tag + { + typedef typename get_param< + parser_tag_base, parser_address_tag, T0, T1, T2>::type + type; + }; + + template <typename T0, typename T1, typename T2> + struct get_scanner + { + typedef typename get_param< + scanner_base, scanner<>, T0, T1, T2>::type + type; + }; + + /////////////////////////////////////////////////////////////////////// + // + // rule_base class + // + // The rule_base class implements the basic plumbing for rules + // minus the storage mechanism. It is up to the derived class + // to actually store the definition somewhere. The rule_base + // class assumes that the derived class provides a get() function + // that will return a pointer to a parser. The get() function + // may return NULL. See rule below for details. + // + // <<< For framework use only. Not for public consumption. >>> + // + /////////////////////////////////////////////////////////////////////// + template < + typename DerivedT // derived class + , typename EmbedT // how derived class is embedded + , typename T0 = nil_t // see rule class + , typename T1 = nil_t // see rule class + , typename T2 = nil_t // see rule class + > + class rule_base; // forward declaration + + class rule_base_access + { +#if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) + public: // YUCK! +#else + template < + typename DerivedT + , typename EmbedT + , typename T0 + , typename T1 + , typename T2 + > + friend class rule_base; +#endif + template <typename RuleT> + static typename RuleT::abstract_parser_t* + get(RuleT const& r) + { + return r.get(); + } + }; + + template < + typename DerivedT // derived class + , typename EmbedT // how derived class is embedded + , typename T0 // see rule class + , typename T1 // see rule class + , typename T2 // see rule class + > + class rule_base + : public parser<DerivedT> + , public impl::get_context<T0, T1, T2>::type::base_t + , public context_aux< + typename impl::get_context<T0, T1, T2>::type, DerivedT> + , public impl::get_tag<T0, T1, T2>::type + { + public: + + typedef typename impl::get_scanner<T0, T1, T2>::type scanner_t; + typedef typename impl::get_context<T0, T1, T2>::type context_t; + typedef typename impl::get_tag<T0, T1, T2>::type tag_t; + + typedef EmbedT embed_t; + typedef typename context_t::context_linker_t linked_context_t; + typedef typename linked_context_t::attr_t attr_t; + + template <typename ScannerT> + struct result + { + typedef typename match_result<ScannerT, attr_t>::type type; + }; + + template <typename ScannerT> + typename parser_result<DerivedT, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef parser_scanner_linker<ScannerT> linked_scanner_t; + typedef typename parser_result<DerivedT, ScannerT>::type result_t; + BOOST_SPIRIT_CONTEXT_PARSE( + scan, *this, linked_scanner_t, linked_context_t, result_t); + } + + template <typename ScannerT> + typename parser_result<DerivedT, ScannerT>::type + parse_main(ScannerT const& scan) const + { + typename parser_result<DerivedT, ScannerT>::type hit; + + // MWCW 8.3 needs this cast to be done through a pointer, + // not a reference. Otherwise, it will silently construct + // a temporary, causing an infinite runtime recursion. + DerivedT const* derived_this = static_cast<DerivedT const*>(this); + + if (rule_base_access::get(*derived_this)) + { + typename ScannerT::iterator_t s(scan.first); + hit = rule_base_access::get(*derived_this) + ->do_parse_virtual(scan); + scan.group_match(hit, this->id(), s, scan.first); + } + else + { + hit = scan.no_match(); + } + return hit; + } + }; + + /////////////////////////////////////////////////////////////////////// + // + // abstract_parser class + // + /////////////////////////////////////////////////////////////////////// + template <typename ScannerT, typename AttrT> + struct abstract_parser + { + abstract_parser() {} + virtual ~abstract_parser() {} + + virtual typename match_result<ScannerT, AttrT>::type + do_parse_virtual(ScannerT const& scan) const = 0; + + virtual abstract_parser* + clone() const = 0; + }; + + /////////////////////////////////////////////////////////////////////// + // + // concrete_parser class + // + /////////////////////////////////////////////////////////////////////// +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(push) +#pragma warning(disable:4512) //assignment operator could not be generated +#endif + + template <typename ParserT, typename ScannerT, typename AttrT> + struct concrete_parser : abstract_parser<ScannerT, AttrT> + { + concrete_parser(ParserT const& p_) : p(p_) {} + virtual ~concrete_parser() {} + + virtual typename match_result<ScannerT, AttrT>::type + do_parse_virtual(ScannerT const& scan) const + { + return p.parse(scan); + } + + virtual abstract_parser<ScannerT, AttrT>* + clone() const + { + return new concrete_parser(p); + } + + typename ParserT::embed_t p; + }; + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(pop) +#endif + +#if BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT > 1 + + /////////////////////////////////////////////////////////////////////// + // + // This generates partial specializations for the class + // + // abstract_parser + // + // with an increasing number of different ScannerT template parameters + // and corresponding do_parse_virtual function declarations for each + // of the different required scanner types: + // + // template <typename ScannerT0, ..., typename AttrT> + // struct abstract_parser<scanner_list<ScannerT0, ...>, AttrT> + // { + // abstract_parser() {} + // virtual ~abstract_parser() {} + // + // virtual typename match_result<ScannerT0, AttrT>::type + // do_parse_virtual(ScannerT0 const &scan) const = 0; + // + // virtual abstract_parser* + // clone() const = 0; + // + // ... + // }; + // + /////////////////////////////////////////////////////////////////////// + #define BOOST_SPIRIT_RULE_ENUM_DOPARSE_A(z, N, _) \ + virtual typename match_result< \ + BOOST_PP_CAT(ScannerT, N), AttrT \ + >::type \ + do_parse_virtual( \ + BOOST_PP_CAT(ScannerT, N) const& scan) const = 0; \ + + #define BOOST_SPIRIT_ENUM_ABSTRACT_PARSERS(z, N, _) \ + template < \ + BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_INC(N), typename ScannerT), \ + typename AttrT \ + > \ + struct abstract_parser< \ + scanner_list< \ + BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_INC(N), ScannerT) \ + >, \ + AttrT \ + > \ + { \ + abstract_parser() {} \ + virtual ~abstract_parser() {} \ + \ + BOOST_PP_REPEAT_ ## z( \ + BOOST_PP_INC(N), BOOST_SPIRIT_RULE_ENUM_DOPARSE_A, _) \ + \ + virtual abstract_parser* \ + clone() const = 0; \ + }; \ + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT, + BOOST_SPIRIT_ENUM_ABSTRACT_PARSERS, _) + + #undef BOOST_SPIRIT_RULE_ENUM_DOPARSE_A + #undef BOOST_SPIRIT_ENUM_ABSTRACT_PARSERS + /////////////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////////// + // + // This generates partial specializations for the class + // + // concrete_parser + // + // with an increasing number of different ScannerT template parameters + // and corresponding do_parse_virtual function declarations for each + // of the different required scanner types: + // + // template < + // typename ParserT, typename ScannerT0, ..., typename AttrT + // > + // struct concrete_parser< + // ParserT, scanner_list<ScannerT0, ...>, AttrT + // > + // : public abstract_parser<scanner_list<ScannerT0, ...>, AttrT> + // { + // concrete_parser(ParserT const& p_) : p(p_) {} + // virtual ~concrete_parser() {} + // + // virtual typename match_result<ScannerT0, AttrT>::type + // do_parse_virtual(ScannerT0 const &scan) const + // { return p.parse(scan); } + // + // virtual abstract_parser<scanner_list<ScannerT0, ...>, AttrT>* + // clone() const + // { + // return new concrete_parser(p); + // } + // + // ... + // + // typename ParserT::embed_t p; + // }; + // + /////////////////////////////////////////////////////////////////////// + #define BOOST_SPIRIT_RULE_ENUM_DOPARSE_C(z, N, _) \ + virtual typename match_result< \ + BOOST_PP_CAT(ScannerT, N), AttrT \ + >::type \ + do_parse_virtual( \ + BOOST_PP_CAT(ScannerT, N) const& scan) const \ + { return p.parse(scan); } \ + + #define BOOST_SPIRIT_ENUM_CONCRETE_PARSERS(z, N, _) \ + template < \ + typename ParserT, \ + BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_INC(N), typename ScannerT), \ + typename AttrT \ + > \ + struct concrete_parser< \ + ParserT, \ + scanner_list< \ + BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_INC(N), ScannerT) \ + >, \ + AttrT \ + > \ + : abstract_parser< \ + scanner_list< \ + BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_INC(N), ScannerT) \ + >, \ + AttrT \ + > \ + { \ + concrete_parser(ParserT const& p_) : p(p_) {} \ + virtual ~concrete_parser() {} \ + \ + BOOST_PP_REPEAT_ ## z( \ + BOOST_PP_INC(N), BOOST_SPIRIT_RULE_ENUM_DOPARSE_C, _) \ + \ + virtual abstract_parser< \ + scanner_list< \ + BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_INC(N), ScannerT) \ + >, \ + AttrT \ + >* \ + clone() const \ + { \ + return new concrete_parser(p); \ + } \ + \ + typename ParserT::embed_t p; \ + }; \ + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT, + BOOST_SPIRIT_ENUM_CONCRETE_PARSERS, _) + + #undef BOOST_SPIRIT_ENUM_CONCRETE_PARSERS + #undef BOOST_SPIRIT_RULE_ENUM_DOPARSE_C + /////////////////////////////////////////////////////////////////////// + +#endif // BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT > 1 + + } // namespace impl + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/non_terminal/parser_context.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/non_terminal/parser_context.hpp new file mode 100644 index 0000000..2f7dd23 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/non_terminal/parser_context.hpp @@ -0,0 +1,150 @@ +/*============================================================================= + Copyright (c) 2002-2003 Joel de Guzman + Copyright (c) 2002-2003 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_PARSER_CONTEXT_HPP) +#define BOOST_SPIRIT_PARSER_CONTEXT_HPP + +/////////////////////////////////////////////////////////////////////////////// +namespace boost +{ + namespace spirit + { + BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + + /////////////////////////////////////////////////////////////////////////// + // + // default_parser_context_base class { default context base } + // + /////////////////////////////////////////////////////////////////////////// + struct default_parser_context_base + { + template <typename DerivedT> + struct aux {}; + }; + + /////////////////////////////////////////////////////////////////////////// + // + // parser_context_base class { base class of all context classes } + // + /////////////////////////////////////////////////////////////////////////// + struct parser_context_base {}; + + /////////////////////////////////////////////////////////////////////////// + // + // parser_context class { default context } + // + /////////////////////////////////////////////////////////////////////////// + struct nil_t; + template<typename ContextT> struct parser_context_linker; + + template<typename AttrT = nil_t> + struct parser_context : parser_context_base + { + typedef AttrT attr_t; + typedef default_parser_context_base base_t; + typedef parser_context_linker<parser_context<AttrT> > context_linker_t; + + template <typename ParserT> + parser_context(ParserT const&) {} + + template <typename ParserT, typename ScannerT> + void + pre_parse(ParserT const&, ScannerT const&) {} + + template <typename ResultT, typename ParserT, typename ScannerT> + ResultT& + post_parse(ResultT& hit, ParserT const&, ScannerT const&) + { return hit; } + }; + + /////////////////////////////////////////////////////////////////////////// + // + // context_aux class + // + // context_aux<ContextT, DerivedT> is a class derived from the + // ContextT's nested base_t::base<DerivedT> template class. (see + // default_parser_context_base::aux for an example). + // + // Basically, this class provides ContextT dependent optional + // functionality to the derived class DerivedT through the CRTP + // idiom (Curiously recurring template pattern). + // + /////////////////////////////////////////////////////////////////////////// + template <typename ContextT, typename DerivedT> + struct context_aux : public ContextT::base_t::template aux<DerivedT> {}; + + /////////////////////////////////////////////////////////////////////////// + // + // parser_scanner_linker and parser_scanner_linker classes + // { helper templates for the rule extensibility } + // + // This classes can be 'overloaded' (defined elsewhere), to plug + // in additional functionality into the non-terminal parsing process. + // + /////////////////////////////////////////////////////////////////////////// + #if !defined(BOOST_SPIRIT_PARSER_SCANNER_LINKER_DEFINED) + #define BOOST_SPIRIT_PARSER_SCANNER_LINKER_DEFINED + + template<typename ScannerT> + struct parser_scanner_linker : public ScannerT + { + parser_scanner_linker(ScannerT const scan_) : ScannerT(scan_) {} + }; + + #endif // !defined(BOOST_SPIRIT_PARSER_SCANNER_LINKER_DEFINED) + + ////////////////////////////////// + #if !defined(BOOST_SPIRIT_PARSER_CONTEXT_LINKER_DEFINED) + #define BOOST_SPIRIT_PARSER_CONTEXT_LINKER_DEFINED + + template<typename ContextT> + struct parser_context_linker : public ContextT + { + template <typename ParserT> + parser_context_linker(ParserT const& p) + : ContextT(p) {} + + template <typename ParserT, typename ScannerT> + void pre_parse(ParserT const& p, ScannerT const& scan) + { ContextT::pre_parse(p, scan); } + + template <typename ResultT, typename ParserT, typename ScannerT> + ResultT& + post_parse(ResultT& hit, ParserT const& p, ScannerT const& scan) + { return ContextT::post_parse(hit, p, scan); } + }; + + #endif // !defined(BOOST_SPIRIT_PARSER_CONTEXT_LINKER_DEFINED) + + /////////////////////////////////////////////////////////////////////////// + // + // BOOST_SPIRIT_CONTEXT_PARSE helper macro + // + // The original implementation uses a template class. However, we + // need to lessen the template instantiation depth to help inferior + // compilers that sometimes choke on deep template instantiations. + // The objective is to avoid code redundancy. A macro, in this case + // is an obvious solution. Sigh! + // + // WARNING: INTERNAL USE ONLY. NOT FOR PUBLIC CONSUMPTION. + // + /////////////////////////////////////////////////////////////////////////// + #define BOOST_SPIRIT_CONTEXT_PARSE(scan, this_, scanner_t, context_t, result_t) \ + scanner_t scan_wrap(scan); \ + context_t context_wrap(this_); \ + context_wrap.pre_parse(this_, scan_wrap); \ + result_t hit = parse_main(scan); \ + return context_wrap.post_parse(hit, this_, scan_wrap); + + BOOST_SPIRIT_CLASSIC_NAMESPACE_END + + } // namespace spirit +} // namespace boost + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/non_terminal/parser_id.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/non_terminal/parser_id.hpp new file mode 100644 index 0000000..bc465dc --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/non_terminal/parser_id.hpp @@ -0,0 +1,122 @@ +/*============================================================================= + Copyright (c) 2001-2003 Joel de Guzman + Copyright (c) 2001 Daniel Nuffer + 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_PARSER_ID_HPP) +#define BOOST_SPIRIT_PARSER_ID_HPP + +#if defined(BOOST_SPIRIT_DEBUG) +# include <ostream> +#endif +#include <boost/spirit/home/classic/namespace.hpp> + +/////////////////////////////////////////////////////////////////////////////// +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // parser_id class + // + /////////////////////////////////////////////////////////////////////////// + class parser_id + { + public: + parser_id() : p(0) {} + explicit parser_id(void const* prule) : p(prule) {} + parser_id(std::size_t l_) : l(l_) {} + + bool operator==(parser_id const& x) const { return p == x.p; } + bool operator!=(parser_id const& x) const { return !(*this == x); } + bool operator<(parser_id const& x) const { return p < x.p; } + std::size_t to_long() const { return l; } + + private: + + union + { + void const* p; + std::size_t l; + }; + }; + + #if defined(BOOST_SPIRIT_DEBUG) + inline std::ostream& + operator<<(std::ostream& out, parser_id const& rid) + { + out << (unsigned int)rid.to_long(); + return out; + } + #endif + + /////////////////////////////////////////////////////////////////////////// + // + // parser_tag_base class: base class of all parser tags + // + /////////////////////////////////////////////////////////////////////////// + struct parser_tag_base {}; + + /////////////////////////////////////////////////////////////////////////// + // + // parser_address_tag class: tags a parser with its address + // + /////////////////////////////////////////////////////////////////////////// + struct parser_address_tag : parser_tag_base + { + parser_id id() const + { return parser_id(reinterpret_cast<std::size_t>(this)); } + }; + + /////////////////////////////////////////////////////////////////////////// + // + // parser_tag class: tags a parser with an integer ID + // + /////////////////////////////////////////////////////////////////////////// + template <int N> + struct parser_tag : parser_tag_base + { + static parser_id id() + { return parser_id(std::size_t(N)); } + }; + + /////////////////////////////////////////////////////////////////////////// + // + // dynamic_parser_tag class: tags a parser with a dynamically changeable + // integer ID + // + /////////////////////////////////////////////////////////////////////////// + class dynamic_parser_tag : public parser_tag_base + { + public: + + dynamic_parser_tag() + : tag(std::size_t(0)) {} + + parser_id + id() const + { + return + tag.to_long() + ? tag + : parser_id(reinterpret_cast<std::size_t>(this)); + } + + void set_id(parser_id id_) { tag = id_; } + + private: + + parser_id tag; + }; + +/////////////////////////////////////////////////////////////////////////////// +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif + diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/non_terminal/rule.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/non_terminal/rule.hpp new file mode 100644 index 0000000..e905689 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/non_terminal/rule.hpp @@ -0,0 +1,175 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + 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_RULE_HPP) +#define BOOST_SPIRIT_RULE_HPP + +#include <boost/static_assert.hpp> + +/////////////////////////////////////////////////////////////////////////////// +// +// Spirit predefined maximum number of simultaneously usable different +// scanner types. +// +// This limit defines the maximum number of of possible different scanner +// types for which a specific rule<> may be used. If this isn't defined, a +// rule<> may be used with one scanner type only (multiple scanner support +// is disabled). +// +/////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT) +# define BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT 1 +#endif + +// Ensure a meaningful maximum number of simultaneously usable scanner types +BOOST_STATIC_ASSERT(BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT > 0); + +#include <boost/scoped_ptr.hpp> +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/non_terminal/impl/rule.ipp> + +#if BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT > 1 +# include <boost/preprocessor/enum_params.hpp> +#endif + +/////////////////////////////////////////////////////////////////////////////// +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + +#if BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT > 1 + + /////////////////////////////////////////////////////////////////////////// + // + // scanner_list (a fake scanner) + // + // Typically, rules are tied to a specific scanner type and + // a particular rule cannot be used with anything else. Sometimes + // there's a need for rules that can accept more than one scanner + // type. The scanner_list<S0, ...SN> can be used as a template + // parameter to the rule class to specify up to the number of + // scanner types defined by the BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT + // constant. Example: + // + // rule<scanner_list<ScannerT0, ScannerT1> > r; + // + // *** This feature is available only to compilers that support + // partial template specialization. *** + // + /////////////////////////////////////////////////////////////////////////// + template < + BOOST_PP_ENUM_PARAMS( + BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT, + typename ScannerT + ) + > + struct scanner_list : scanner_base {}; + +#endif + + /////////////////////////////////////////////////////////////////////////// + // + // rule class + // + // The rule is a polymorphic parser that acts as a named place- + // holder capturing the behavior of an EBNF expression assigned to + // it. + // + // The rule is a template class parameterized by: + // + // 1) scanner (scanner_t, see scanner.hpp), + // 2) the rule's context (context_t, see parser_context.hpp) + // 3) an arbitrary tag (tag_t, see parser_id.hpp) that allows + // a rule to be tagged for identification. + // + // These template parameters may be specified in any order. The + // scanner will default to scanner<> when it is not specified. + // The context will default to parser_context when not specified. + // The tag will default to parser_address_tag when not specified. + // + // The definition of the rule (its right hand side, RHS) held by + // the rule through a scoped_ptr. When a rule is seen in the RHS + // of an assignment or copy construction EBNF expression, the rule + // is held by the LHS rule by reference. + // + /////////////////////////////////////////////////////////////////////////// + template < + typename T0 = nil_t + , typename T1 = nil_t + , typename T2 = nil_t + > + class rule + : public impl::rule_base< + rule<T0, T1, T2> + , rule<T0, T1, T2> const& + , T0, T1, T2> + { + public: + + typedef rule<T0, T1, T2> self_t; + typedef impl::rule_base< + self_t + , self_t const& + , T0, T1, T2> + base_t; + + typedef typename base_t::scanner_t scanner_t; + typedef typename base_t::attr_t attr_t; + typedef impl::abstract_parser<scanner_t, attr_t> abstract_parser_t; + + rule() : ptr() {} + ~rule() {} + + rule(rule const& r) + : ptr(new impl::concrete_parser<rule, scanner_t, attr_t>(r)) {} + + template <typename ParserT> + rule(ParserT const& p) + : ptr(new impl::concrete_parser<ParserT, scanner_t, attr_t>(p)) {} + + template <typename ParserT> + rule& operator=(ParserT const& p) + { + ptr.reset(new impl::concrete_parser<ParserT, scanner_t, attr_t>(p)); + return *this; + } + + rule& operator=(rule const& r) + { + ptr.reset(new impl::concrete_parser<rule, scanner_t, attr_t>(r)); + return *this; + } + + rule<T0, T1, T2> + copy() const + { + return rule<T0, T1, T2>(ptr.get() ? ptr->clone() : 0); + } + + private: + friend class impl::rule_base_access; + + abstract_parser_t* + get() const + { + return ptr.get(); + } + + rule(abstract_parser_t* ptr_) + : ptr(ptr_) {} + + rule(abstract_parser_t const* ptr_) + : ptr(ptr_) {} + + scoped_ptr<abstract_parser_t> ptr; + }; + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/parser.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/parser.hpp new file mode 100644 index 0000000..8f6bc6a --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/parser.hpp @@ -0,0 +1,223 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + 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_PARSER_HPP) +#define BOOST_SPIRIT_PARSER_HPP + +#include <boost/config.hpp> +#include <boost/type_traits/remove_reference.hpp> +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/scanner/scanner.hpp> +#include <boost/spirit/home/classic/core/nil.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + template <typename ParserT, typename ActionT> + class action; // forward declaration + + /////////////////////////////////////////////////////////////////////////// + // + // Parser categories + // + // Helper template classes to distinguish different types of + // parsers. The following categories are the most generic. More + // specific types may inherit from these. Each parser has a typedef + // parser_category_t that defines its category. By default, if one + // is not specified, it will inherit from the base parser class + // which typedefs its parser_category_t as plain_parser_category. + // + // - plain parser has nothing special + // - binary parser has subject a and b (e.g. alternative) + // - unary parser has single subject (e.g. kleene star) + // - action parser has an attached action parser + // + /////////////////////////////////////////////////////////////////////////// + struct plain_parser_category {}; + struct binary_parser_category : plain_parser_category {}; + struct unary_parser_category : plain_parser_category {}; + struct action_parser_category : unary_parser_category {}; + + /////////////////////////////////////////////////////////////////////////// + // + // parser_result metafunction + // + // Given a scanner type ScannerT and a parser type ParserT, the + // parser_result metafunction provides the actual result of the + // parser. + // + // Usage: + // + // typename parser_result<ParserT, ScannerT>::type + // + /////////////////////////////////////////////////////////////////////////// + template <typename ParserT, typename ScannerT> + struct parser_result + { + typedef typename boost::remove_reference<ParserT>::type parser_type; + typedef typename parser_type::template result<ScannerT>::type type; + }; + + /////////////////////////////////////////////////////////////////////////// + // + // parser class + // + // This class is a protocol base class for all parsers. This is + // essentially an interface contract. The parser class does not + // really know how to parse anything but instead relies on the + // template parameter DerivedT (which obviously is assumed to be a + // subclass) to do the actual parsing. + // + // Concrete sub-classes inheriting from parser must have a + // corresponding member function parse(...) compatible with the + // conceptual Interface: + // + // template <typename ScannerT> + // RT parse(ScannerT const& scan) const; + // + // where RT is the desired return type of the parser and ScannerT + // scan is the scanner (see scanner.hpp). + // + // Concrete sub-classes inheriting from parser in most cases need to + // have a nested meta-function result that returns the result type + // of the parser's parse member function, given a scanner type. The + // meta-function has the form: + // + // template <typename ScannerT> + // struct result + // { + // typedef RT type; + // }; + // + // where RT is the desired return type of the parser. This is + // usually, but not always, dependent on the template parameter + // ScannerT. If a parser does not supply a result metafunction, a + // default is provided by the base parser class. + // + // The parser's derived() member function returns a reference to the + // parser as its derived object. + // + // An operator[] is provided. The operator returns a semantic action + // handler (see actions.hpp). + // + // Each parser has a typedef embed_t. This typedef specifies how a + // parser is embedded in a composite (see composite.hpp). By + // default, if one is not specified, the parser will be embedded by + // value. That is, a copy of the parser is placed as a member + // variable of the composite. Most parsers are embedded by value. In + // certain situations however, this is not desirable or possible. + // + /////////////////////////////////////////////////////////////////////////// + template <typename DerivedT> + struct parser + { + typedef DerivedT embed_t; + typedef DerivedT derived_t; + typedef plain_parser_category parser_category_t; + + template <typename ScannerT> + struct result + { + typedef typename match_result<ScannerT, nil_t>::type type; + }; + + DerivedT& derived() + { + return *static_cast<DerivedT*>(this); + } + + DerivedT const& derived() const + { + return *static_cast<DerivedT const*>(this); + } + + template <typename ActionT> + action<DerivedT, ActionT> + operator[](ActionT const& actor) const + { + return action<DerivedT, ActionT>(derived(), actor); + } + }; + + /////////////////////////////////////////////////////////////////////////// + // + // parse_info + // + // Results returned by the free parse functions: + // + // stop: points to the final parse position (i.e parsing + // processed the input up to this point). + // + // hit: true if parsing is successful. This may be full: + // the parser consumed all the input, or partial: + // the parser consumed only a portion of the input. + // + // full: true when we have a full hit (i.e the parser + // consumed all the input. + // + // length: The number of characters consumed by the parser. + // This is valid only if we have a successful hit + // (either partial or full). + // + /////////////////////////////////////////////////////////////////////////// + template <typename IteratorT = char const*> + struct parse_info + { + IteratorT stop; + bool hit; + bool full; + std::size_t length; + + parse_info( + IteratorT const& stop_ = IteratorT(), + bool hit_ = false, + bool full_ = false, + std::size_t length_ = 0) + : stop(stop_) + , hit(hit_) + , full(full_) + , length(length_) {} + + template <typename ParseInfoT> + parse_info(ParseInfoT const& pi) + : stop(pi.stop) + , hit(pi.hit) + , full(pi.full) + , length(pi.length) {} + }; + + /////////////////////////////////////////////////////////////////////////// + // + // Generic parse function + // + /////////////////////////////////////////////////////////////////////////// + template <typename IteratorT, typename DerivedT> + parse_info<IteratorT> + parse( + IteratorT const& first, + IteratorT const& last, + parser<DerivedT> const& p); + + /////////////////////////////////////////////////////////////////////////// + // + // Parse function for null terminated strings + // + /////////////////////////////////////////////////////////////////////////// + template <typename CharT, typename DerivedT> + parse_info<CharT const*> + parse( + CharT const* str, + parser<DerivedT> const& p); + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif + +#include <boost/spirit/home/classic/core/impl/parser.ipp> diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/primitives/impl/numerics.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/core/primitives/impl/numerics.ipp new file mode 100644 index 0000000..19586f1 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/primitives/impl/numerics.ipp @@ -0,0 +1,478 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001-2003 Hartmut Kaiser + 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) +=============================================================================*/ +#ifndef BOOST_SPIRIT_NUMERICS_IPP +#define BOOST_SPIRIT_NUMERICS_IPP + +#include <boost/config/no_tr1/cmath.hpp> +#include <limits> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + struct sign_parser; // forward declaration only + + namespace impl + { + /////////////////////////////////////////////////////////////////////// + // + // Extract the prefix sign (- or +) + // + /////////////////////////////////////////////////////////////////////// + template <typename ScannerT> + bool + extract_sign(ScannerT const& scan, std::size_t& count) + { + // Extract the sign + count = 0; + bool neg = *scan == '-'; + if (neg || (*scan == '+')) + { + ++scan; + ++count; + return neg; + } + + return false; + } + + /////////////////////////////////////////////////////////////////////// + // + // Traits class for radix specific number conversion + // + // Convert a digit from character representation, ch, to binary + // representation, returned in val. + // Returns whether the conversion was successful. + // + // template<typename CharT> static bool digit(CharT ch, T& val); + // + /////////////////////////////////////////////////////////////////////// + template<const int Radix> + struct radix_traits; + + ////////////////////////////////// Binary + template<> + struct radix_traits<2> + { + template<typename CharT, typename T> + static bool digit(CharT ch, T& val) + { + val = ch - '0'; + return ('0' == ch || '1' == ch); + } + }; + + ////////////////////////////////// Octal + template<> + struct radix_traits<8> + { + template<typename CharT, typename T> + static bool digit(CharT ch, T& val) + { + val = ch - '0'; + return ('0' <= ch && ch <= '7'); + } + }; + + ////////////////////////////////// Decimal + template<> + struct radix_traits<10> + { + template<typename CharT, typename T> + static bool digit(CharT ch, T& val) + { + val = ch - '0'; + return impl::isdigit_(ch); + } + }; + + ////////////////////////////////// Hexadecimal + template<> + struct radix_traits<16> + { + template<typename CharT, typename T> + static bool digit(CharT ch, T& val) + { + if (radix_traits<10>::digit(ch, val)) + return true; + + CharT lc = impl::tolower_(ch); + if ('a' <= lc && lc <= 'f') + { + val = lc - 'a' + 10; + return true; + } + return false; + } + }; + + /////////////////////////////////////////////////////////////////////// + // + // Helper templates for encapsulation of radix specific + // conversion of an input string to an integral value. + // + // main entry point: + // + // extract_int<Radix, MinDigits, MaxDigits, Accumulate> + // ::f(first, last, n, count); + // + // The template parameter Radix represents the radix of the + // number contained in the parsed string. The template + // parameter MinDigits specifies the minimum digits to + // accept. The template parameter MaxDigits specifies the + // maximum digits to parse. A -1 value for MaxDigits will + // make it parse an arbitrarilly large number as long as the + // numeric type can hold it. Accumulate is either + // positive_accumulate<Radix> (default) for parsing positive + // numbers or negative_accumulate<Radix> otherwise. + // Checking is only performed when std::numeric_limits<T>:: + // is_specialized is true. Otherwise, there's no way to + // do the check. + // + // scan.first and scan.last are iterators as usual (i.e. + // first is mutable and is moved forward when a match is + // found), n is a variable that holds the number (passed by + // reference). The number of parsed characters is added to + // count (also passed by reference) + // + // NOTE: + // Returns a non-match, if the number to parse + // overflows (or underflows) the used type. + // + // BEWARE: + // the parameters 'n' and 'count' should be properly + // initialized before calling this function. + // + /////////////////////////////////////////////////////////////////////// +#if defined(BOOST_MSVC) +#pragma warning(push) +#pragma warning(disable:4127) //conditional expression is constant +#endif + + template <typename T, int Radix> + struct positive_accumulate + { + // Use this accumulator if number is positive + static bool add(T& n, T digit) + { + if (std::numeric_limits<T>::is_specialized) + { + static T const max = (std::numeric_limits<T>::max)(); + static T const max_div_radix = max/Radix; + + if (n > max_div_radix) + return false; + n *= Radix; + + if (n > max - digit) + return false; + n += digit; + + return true; + } + else + { + n *= Radix; + n += digit; + return true; + } + } + }; + + template <typename T, int Radix> + struct negative_accumulate + { + // Use this accumulator if number is negative + static bool add(T& n, T digit) + { + if (std::numeric_limits<T>::is_specialized) + { + typedef std::numeric_limits<T> num_limits; + static T const min = + (!num_limits::is_integer && num_limits::is_signed && num_limits::has_denorm) ? + -(num_limits::max)() : (num_limits::min)(); + static T const min_div_radix = min/Radix; + + if (n < min_div_radix) + return false; + n *= Radix; + + if (n < min + digit) + return false; + n -= digit; + + return true; + } + else + { + n *= Radix; + n -= digit; + return true; + } + } + }; + + template <int MaxDigits> + inline bool allow_more_digits(std::size_t i) + { + return i < MaxDigits; + } + + template <> + inline bool allow_more_digits<-1>(std::size_t) + { + return true; + } + + ////////////////////////////////// + template < + int Radix, unsigned MinDigits, int MaxDigits, + typename Accumulate + > + struct extract_int + { + template <typename ScannerT, typename T> + static bool + f(ScannerT& scan, T& n, std::size_t& count) + { + std::size_t i = 0; + T digit; + while( allow_more_digits<MaxDigits>(i) && !scan.at_end() && + radix_traits<Radix>::digit(*scan, digit) ) + { + if (!Accumulate::add(n, digit)) + return false; // Overflow + ++i, ++scan, ++count; + } + return i >= MinDigits; + } + }; + + /////////////////////////////////////////////////////////////////////// + // + // uint_parser_impl class + // + /////////////////////////////////////////////////////////////////////// + template < + typename T = unsigned, + int Radix = 10, + unsigned MinDigits = 1, + int MaxDigits = -1 + > + struct uint_parser_impl + : parser<uint_parser_impl<T, Radix, MinDigits, MaxDigits> > + { + typedef uint_parser_impl<T, Radix, MinDigits, MaxDigits> self_t; + + template <typename ScannerT> + struct result + { + typedef typename match_result<ScannerT, T>::type type; + }; + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + if (!scan.at_end()) + { + T n = 0; + std::size_t count = 0; + typename ScannerT::iterator_t save = scan.first; + if (extract_int<Radix, MinDigits, MaxDigits, + positive_accumulate<T, Radix> >::f(scan, n, count)) + { + return scan.create_match(count, n, save, scan.first); + } + // return no-match if number overflows + } + return scan.no_match(); + } + }; + + /////////////////////////////////////////////////////////////////////// + // + // int_parser_impl class + // + /////////////////////////////////////////////////////////////////////// + template < + typename T = unsigned, + int Radix = 10, + unsigned MinDigits = 1, + int MaxDigits = -1 + > + struct int_parser_impl + : parser<int_parser_impl<T, Radix, MinDigits, MaxDigits> > + { + typedef int_parser_impl<T, Radix, MinDigits, MaxDigits> self_t; + + template <typename ScannerT> + struct result + { + typedef typename match_result<ScannerT, T>::type type; + }; + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef extract_int<Radix, MinDigits, MaxDigits, + negative_accumulate<T, Radix> > extract_int_neg_t; + typedef extract_int<Radix, MinDigits, MaxDigits, + positive_accumulate<T, Radix> > extract_int_pos_t; + + if (!scan.at_end()) + { + T n = 0; + std::size_t count = 0; + typename ScannerT::iterator_t save = scan.first; + + bool hit = impl::extract_sign(scan, count); + + if (hit) + hit = extract_int_neg_t::f(scan, n, count); + else + hit = extract_int_pos_t::f(scan, n, count); + + if (hit) + return scan.create_match(count, n, save, scan.first); + else + scan.first = save; + // return no-match if number overflows or underflows + } + return scan.no_match(); + } + }; + + /////////////////////////////////////////////////////////////////////// + // + // real_parser_impl class + // + /////////////////////////////////////////////////////////////////////// + template <typename RT, typename T, typename RealPoliciesT> + struct real_parser_impl + { + typedef real_parser_impl<RT, T, RealPoliciesT> self_t; + + template <typename ScannerT> + RT parse_main(ScannerT const& scan) const + { + if (scan.at_end()) + return scan.no_match(); + typename ScannerT::iterator_t save = scan.first; + + typedef typename parser_result<sign_parser, ScannerT>::type + sign_match_t; + typedef typename parser_result<chlit<>, ScannerT>::type + exp_match_t; + + sign_match_t sign_match = RealPoliciesT::parse_sign(scan); + std::size_t count = sign_match ? sign_match.length() : 0; + bool neg = sign_match.has_valid_attribute() ? + sign_match.value() : false; + + RT n_match = RealPoliciesT::parse_n(scan); + T n = n_match.has_valid_attribute() ? + n_match.value() : T(0); + bool got_a_number = n_match; + exp_match_t e_hit; + + if (!got_a_number && !RealPoliciesT::allow_leading_dot) + return scan.no_match(); + else + count += n_match.length(); + + if (neg) + n = -n; + + if (RealPoliciesT::parse_dot(scan)) + { + // We got the decimal point. Now we will try to parse + // the fraction if it is there. If not, it defaults + // to zero (0) only if we already got a number. + + if (RT hit = RealPoliciesT::parse_frac_n(scan)) + { +#if !defined(BOOST_NO_STDC_NAMESPACE) + using namespace std; // allow for ADL to find pow() +#endif + hit.value(hit.value() + * pow(T(10), T(-hit.length()))); + if (neg) + n -= hit.value(); + else + n += hit.value(); + count += hit.length() + 1; + + } + + else if (!got_a_number || + !RealPoliciesT::allow_trailing_dot) + return scan.no_match(); + + e_hit = RealPoliciesT::parse_exp(scan); + } + else + { + // We have reached a point where we + // still haven't seen a number at all. + // We return early with a no-match. + if (!got_a_number) + return scan.no_match(); + + // If we must expect a dot and we didn't see + // an exponent, return early with a no-match. + e_hit = RealPoliciesT::parse_exp(scan); + if (RealPoliciesT::expect_dot && !e_hit) + return scan.no_match(); + } + + if (e_hit) + { + // We got the exponent prefix. Now we will try to parse the + // actual exponent. It is an error if it is not there. + if (RT e_n_hit = RealPoliciesT::parse_exp_n(scan)) + { +#if !defined(BOOST_NO_STDC_NAMESPACE) + using namespace std; // allow for ADL to find pow() +#endif + n *= pow(T(10), T(e_n_hit.value())); + count += e_n_hit.length() + e_hit.length(); + } + else + { + // Oops, no exponent, return a no-match + return scan.no_match(); + } + } + + return scan.create_match(count, n, save, scan.first); + } + + template <typename ScannerT> + static RT parse(ScannerT const& scan) + { + static self_t this_; + return impl::implicit_lexeme_parse<RT>(this_, scan, scan); + } + }; + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + + } // namespace impl + +/////////////////////////////////////////////////////////////////////////////// +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/primitives/impl/primitives.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/core/primitives/impl/primitives.ipp new file mode 100644 index 0000000..152e5b1 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/primitives/impl/primitives.ipp @@ -0,0 +1,476 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2003 Martin Wille + 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_PRIMITIVES_IPP) +#define BOOST_SPIRIT_PRIMITIVES_IPP + +// This should eventually go to a config file. +#if defined(__GNUC__) && (__GNUC__ < 3) && !defined(_STLPORT_VERSION) +# ifndef BOOST_SPIRIT_NO_CHAR_TRAITS +# define BOOST_SPIRIT_NO_CHAR_TRAITS +# endif +#endif + +#include <cctype> +#if !defined(BOOST_NO_CWCTYPE) +#include <cwctype> +#endif + +#ifndef BOOST_SPIRIT_NO_CHAR_TRAITS +# include <string> // char_traits +#endif + +#if defined(BOOST_MSVC) +# pragma warning (push) +# pragma warning(disable:4800) +#endif + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + template <typename DrivedT> struct char_parser; + + namespace impl + { + template <typename IteratorT> + inline IteratorT + get_last(IteratorT first) + { + while (*first) + first++; + return first; + } + + template< + typename RT, + typename IteratorT, + typename ScannerT> + inline RT + string_parser_parse( + IteratorT str_first, + IteratorT str_last, + ScannerT& scan) + { + typedef typename ScannerT::iterator_t iterator_t; + iterator_t saved = scan.first; + std::size_t slen = str_last - str_first; + + while (str_first != str_last) + { + if (scan.at_end() || (*str_first != *scan)) + return scan.no_match(); + ++str_first; + ++scan; + } + + return scan.create_match(slen, nil_t(), saved, scan.first); + } + + /////////////////////////////////////////////////////////////////////////// + // + // Conversion from char_type to int_type + // + /////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_SPIRIT_NO_CHAR_TRAITS +# define BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE std +#else + + template <typename CharT> + struct char_traits + { + typedef CharT int_type; + typedef CharT char_type; + }; + + template<> + struct char_traits<char> + { + typedef int int_type; + typedef char char_type; + + static char_type + to_char_type(int_type c) + { + return static_cast<char_type>(c); + } + + static int + to_int_type(char c) + { + return static_cast<unsigned char>(c); + } + }; + + template<> + struct char_traits<unsigned char> + { + typedef int int_type; + typedef unsigned char char_type; + + static char_type + to_char_type(int_type c) + { + return static_cast<char_type>(c); + } + + static int + to_int_type(unsigned char c) + { + return c; + } + }; + +# define BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE impl +# ifndef BOOST_NO_CWCTYPE + + template<> + struct char_traits<wchar_t> + { + typedef wint_t int_type; + typedef wchar_t char_type; + + static char_type + to_char_type(int_type c) + { + return static_cast<char_type>(c); + } + + static wint_t + to_int_type(wchar_t c) + { + return c; + } + }; + +# endif +#endif // BOOST_SPIRIT_NO_CHAR_TRAITS + + // Use char_traits for char and wchar_t only, as these are the only + // specializations provided in the standard. Other types are on their + // own. + // + // For UDT, one may override: + // + // isalnum + // isalpha + // iscntrl + // isdigit + // isgraph + // islower + // isprint + // ispunct + // isspace + // isupper + // isxdigit + // isblank + // isupper + // tolower + // toupper + // + // in a namespace suitable for Argument Dependent lookup or in + // namespace std (disallowed by the standard). + + template <typename CharT> + struct char_type_char_traits_helper + { + typedef CharT char_type; + typedef typename BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE + ::char_traits<CharT>::int_type int_type; + + static int_type to_int_type(CharT c) + { + return BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE + ::char_traits<CharT>::to_int_type(c); + } + + static char_type to_char_type(int_type i) + { + return BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE + ::char_traits<CharT>::to_char_type(i); + } + }; + + template <typename CharT> + struct char_traits_helper + { + typedef CharT char_type; + typedef CharT int_type; + + static CharT & to_int_type(CharT & c) + { + return c; + } + + static CharT & to_char_type(CharT & c) + { + return c; + } + }; + + template <> + struct char_traits_helper<char> + : char_type_char_traits_helper<char> + { + }; + +#if !defined(BOOST_NO_CWCTYPE) + + template <> + struct char_traits_helper<wchar_t> + : char_type_char_traits_helper<wchar_t> + { + }; + +#endif + + template <typename CharT> + inline typename char_traits_helper<CharT>::int_type + to_int_type(CharT c) + { + return char_traits_helper<CharT>::to_int_type(c); + } + + template <typename CharT> + inline CharT + to_char_type(typename char_traits_helper<CharT>::int_type c) + { + return char_traits_helper<CharT>::to_char_type(c); + } + + /////////////////////////////////////////////////////////////////////// + // + // Convenience functions + // + /////////////////////////////////////////////////////////////////////// + + template <typename CharT> + inline bool + isalnum_(CharT c) + { + using namespace std; + return isalnum(to_int_type(c)) ? true : false; + } + + template <typename CharT> + inline bool + isalpha_(CharT c) + { + using namespace std; + return isalpha(to_int_type(c)) ? true : false; + } + + template <typename CharT> + inline bool + iscntrl_(CharT c) + { + using namespace std; + return iscntrl(to_int_type(c)) ? true : false; + } + + template <typename CharT> + inline bool + isdigit_(CharT c) + { + using namespace std; + return isdigit(to_int_type(c)) ? true : false; + } + + template <typename CharT> + inline bool + isgraph_(CharT c) + { + using namespace std; + return isgraph(to_int_type(c)) ? true : false; + } + + template <typename CharT> + inline bool + islower_(CharT c) + { + using namespace std; + return islower(to_int_type(c)) ? true : false; + } + + template <typename CharT> + inline bool + isprint_(CharT c) + { + using namespace std; + return isprint(to_int_type(c)) ? true : false; + } + + template <typename CharT> + inline bool + ispunct_(CharT c) + { + using namespace std; + return ispunct(to_int_type(c)) ? true : false; + } + + template <typename CharT> + inline bool + isspace_(CharT c) + { + using namespace std; + return isspace(to_int_type(c)) ? true : false; + } + + template <typename CharT> + inline bool + isupper_(CharT c) + { + using namespace std; + return isupper(to_int_type(c)) ? true : false; + } + + template <typename CharT> + inline bool + isxdigit_(CharT c) + { + using namespace std; + return isxdigit(to_int_type(c)) ? true : false; + } + + template <typename CharT> + inline bool + isblank_(CharT c) + { + return (c == ' ' || c == '\t'); + } + + template <typename CharT> + inline CharT + tolower_(CharT c) + { + using namespace std; + return to_char_type<CharT>(tolower(to_int_type(c))); + } + + template <typename CharT> + inline CharT + toupper_(CharT c) + { + using namespace std; + return to_char_type<CharT>(toupper(to_int_type(c))); + } + +#if !defined(BOOST_NO_CWCTYPE) + + inline bool + isalnum_(wchar_t c) + { + using namespace std; + return iswalnum(to_int_type(c)) ? true : false; + } + + inline bool + isalpha_(wchar_t c) + { + using namespace std; + return iswalpha(to_int_type(c)) ? true : false; + } + + inline bool + iscntrl_(wchar_t c) + { + using namespace std; + return iswcntrl(to_int_type(c)) ? true : false; + } + + inline bool + isdigit_(wchar_t c) + { + using namespace std; + return iswdigit(to_int_type(c)) ? true : false; + } + + inline bool + isgraph_(wchar_t c) + { + using namespace std; + return iswgraph(to_int_type(c)) ? true : false; + } + + inline bool + islower_(wchar_t c) + { + using namespace std; + return iswlower(to_int_type(c)) ? true : false; + } + + inline bool + isprint_(wchar_t c) + { + using namespace std; + return iswprint(to_int_type(c)) ? true : false; + } + + inline bool + ispunct_(wchar_t c) + { + using namespace std; + return iswpunct(to_int_type(c)) ? true : false; + } + + inline bool + isspace_(wchar_t c) + { + using namespace std; + return iswspace(to_int_type(c)) ? true : false; + } + + inline bool + isupper_(wchar_t c) + { + using namespace std; + return iswupper(to_int_type(c)) ? true : false; + } + + inline bool + isxdigit_(wchar_t c) + { + using namespace std; + return iswxdigit(to_int_type(c)) ? true : false; + } + + inline bool + isblank_(wchar_t c) + { + return (c == L' ' || c == L'\t'); + } + + inline wchar_t + tolower_(wchar_t c) + { + using namespace std; + return to_char_type<wchar_t>(towlower(to_int_type(c))); + } + + inline wchar_t + toupper_(wchar_t c) + { + using namespace std; + return to_char_type<wchar_t>(towupper(to_int_type(c))); + } + +#endif // !defined(BOOST_NO_CWCTYPE) + +} + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit::impl + +#ifdef BOOST_MSVC +#pragma warning (pop) +#endif + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/primitives/numerics.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/primitives/numerics.hpp new file mode 100644 index 0000000..20ea091 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/primitives/numerics.hpp @@ -0,0 +1,289 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2001-2003 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) +=============================================================================*/ +#ifndef BOOST_SPIRIT_NUMERICS_HPP +#define BOOST_SPIRIT_NUMERICS_HPP + +#include <boost/config.hpp> +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/parser.hpp> +#include <boost/spirit/home/classic/core/composite/directives.hpp> + +#include <boost/spirit/home/classic/core/primitives/numerics_fwd.hpp> +#include <boost/spirit/home/classic/core/primitives/impl/numerics.ipp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // uint_parser class + // + /////////////////////////////////////////////////////////////////////////// + template < + typename T, + int Radix, + unsigned MinDigits, + int MaxDigits + > + struct uint_parser : parser<uint_parser<T, Radix, MinDigits, MaxDigits> > + { + typedef uint_parser<T, Radix, MinDigits, MaxDigits> self_t; + + template <typename ScannerT> + struct result + { + typedef typename match_result<ScannerT, T>::type type; + }; + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef impl::uint_parser_impl<T, Radix, MinDigits, MaxDigits> impl_t; + typedef typename parser_result<impl_t, ScannerT>::type result_t; + return impl::contiguous_parser_parse<result_t>(impl_t(), scan, scan); + } + }; + + /////////////////////////////////////////////////////////////////////////// + // + // int_parser class + // + /////////////////////////////////////////////////////////////////////////// + template < + typename T, + int Radix, + unsigned MinDigits, + int MaxDigits + > + struct int_parser : parser<int_parser<T, Radix, MinDigits, MaxDigits> > + { + typedef int_parser<T, Radix, MinDigits, MaxDigits> self_t; + + template <typename ScannerT> + struct result + { + typedef typename match_result<ScannerT, T>::type type; + }; + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef impl::int_parser_impl<T, Radix, MinDigits, MaxDigits> impl_t; + typedef typename parser_result<impl_t, ScannerT>::type result_t; + return impl::contiguous_parser_parse<result_t>(impl_t(), scan, scan); + } + }; + + /////////////////////////////////////////////////////////////////////////// + // + // uint_parser/int_parser instantiations + // + /////////////////////////////////////////////////////////////////////////// + int_parser<int> const + int_p = int_parser<int>(); + + uint_parser<unsigned> const + uint_p = uint_parser<unsigned>(); + + uint_parser<unsigned, 2> const + bin_p = uint_parser<unsigned, 2>(); + + uint_parser<unsigned, 8> const + oct_p = uint_parser<unsigned, 8>(); + + uint_parser<unsigned, 16> const + hex_p = uint_parser<unsigned, 16>(); + + /////////////////////////////////////////////////////////////////////////// + // + // sign_parser class + // + /////////////////////////////////////////////////////////////////////////// + namespace impl + { + // Utility to extract the prefix sign ('-' | '+') + template <typename ScannerT> + bool extract_sign(ScannerT const& scan, std::size_t& count); + } + + struct sign_parser : public parser<sign_parser> + { + typedef sign_parser self_t; + + template <typename ScannerT> + struct result + { + typedef typename match_result<ScannerT, bool>::type type; + }; + + sign_parser() {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + if (!scan.at_end()) + { + std::size_t length; + typename ScannerT::iterator_t save(scan.first); + bool neg = impl::extract_sign(scan, length); + if (length) + return scan.create_match(1, neg, save, scan.first); + } + return scan.no_match(); + } + }; + + sign_parser const sign_p = sign_parser(); + + /////////////////////////////////////////////////////////////////////////// + // + // default real number policies + // + /////////////////////////////////////////////////////////////////////////// + template <typename T> + struct ureal_parser_policies + { + // trailing dot policy suggested suggested by Gustavo Guerra + BOOST_STATIC_CONSTANT(bool, allow_leading_dot = true); + BOOST_STATIC_CONSTANT(bool, allow_trailing_dot = true); + BOOST_STATIC_CONSTANT(bool, expect_dot = false); + + typedef uint_parser<T, 10, 1, -1> uint_parser_t; + typedef int_parser<T, 10, 1, -1> int_parser_t; + + template <typename ScannerT> + static typename match_result<ScannerT, nil_t>::type + parse_sign(ScannerT& scan) + { + return scan.no_match(); + } + + template <typename ScannerT> + static typename parser_result<uint_parser_t, ScannerT>::type + parse_n(ScannerT& scan) + { + return uint_parser_t().parse(scan); + } + + template <typename ScannerT> + static typename parser_result<chlit<>, ScannerT>::type + parse_dot(ScannerT& scan) + { + return ch_p('.').parse(scan); + } + + template <typename ScannerT> + static typename parser_result<uint_parser_t, ScannerT>::type + parse_frac_n(ScannerT& scan) + { + return uint_parser_t().parse(scan); + } + + template <typename ScannerT> + static typename parser_result<chlit<>, ScannerT>::type + parse_exp(ScannerT& scan) + { + return as_lower_d['e'].parse(scan); + } + + template <typename ScannerT> + static typename parser_result<int_parser_t, ScannerT>::type + parse_exp_n(ScannerT& scan) + { + return int_parser_t().parse(scan); + } + }; + + template <typename T> + struct real_parser_policies : public ureal_parser_policies<T> + { + template <typename ScannerT> + static typename parser_result<sign_parser, ScannerT>::type + parse_sign(ScannerT& scan) + { + return sign_p.parse(scan); + } + }; + + /////////////////////////////////////////////////////////////////////////// + // + // real_parser class + // + /////////////////////////////////////////////////////////////////////////// + template < + typename T, + typename RealPoliciesT + > + struct real_parser + : public parser<real_parser<T, RealPoliciesT> > + { + typedef real_parser<T, RealPoliciesT> self_t; + + template <typename ScannerT> + struct result + { + typedef typename match_result<ScannerT, T>::type type; + }; + + real_parser() {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef typename parser_result<self_t, ScannerT>::type result_t; + return impl::real_parser_impl<result_t, T, RealPoliciesT>::parse(scan); + } + }; + + /////////////////////////////////////////////////////////////////////////// + // + // real_parser instantiations + // + /////////////////////////////////////////////////////////////////////////// + real_parser<double, ureal_parser_policies<double> > const + ureal_p = real_parser<double, ureal_parser_policies<double> >(); + + real_parser<double, real_parser_policies<double> > const + real_p = real_parser<double, real_parser_policies<double> >(); + + /////////////////////////////////////////////////////////////////////////// + // + // strict reals (do not allow plain integers (no decimal point)) + // + /////////////////////////////////////////////////////////////////////////// + template <typename T> + struct strict_ureal_parser_policies : public ureal_parser_policies<T> + { + BOOST_STATIC_CONSTANT(bool, expect_dot = true); + }; + + template <typename T> + struct strict_real_parser_policies : public real_parser_policies<T> + { + BOOST_STATIC_CONSTANT(bool, expect_dot = true); + }; + + real_parser<double, strict_ureal_parser_policies<double> > const + strict_ureal_p + = real_parser<double, strict_ureal_parser_policies<double> >(); + + real_parser<double, strict_real_parser_policies<double> > const + strict_real_p + = real_parser<double, strict_real_parser_policies<double> >(); + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/primitives/numerics_fwd.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/primitives/numerics_fwd.hpp new file mode 100644 index 0000000..b0f20d9 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/primitives/numerics_fwd.hpp @@ -0,0 +1,88 @@ +/*============================================================================= + Copyright (C) 2006 Tobias Schwinger + 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_NUMERICS_FWD_HPP) +# define BOOST_SPIRIT_NUMERICS_FWD_HPP + +#include <boost/spirit/home/classic/namespace.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // uint_parser class + // + /////////////////////////////////////////////////////////////////////////// + template < + typename T = unsigned, + int Radix = 10, + unsigned MinDigits = 1, + int MaxDigits = -1 + > + struct uint_parser; + + /////////////////////////////////////////////////////////////////////////// + // + // int_parser class + // + /////////////////////////////////////////////////////////////////////////// + template < + typename T = unsigned, + int Radix = 10, + unsigned MinDigits = 1, + int MaxDigits = -1 + > + struct int_parser; + + /////////////////////////////////////////////////////////////////////////// + // + // sign_parser class + // + /////////////////////////////////////////////////////////////////////////// + struct sign_parser; + + /////////////////////////////////////////////////////////////////////////// + // + // default real number policies + // + /////////////////////////////////////////////////////////////////////////// + template <typename T> + struct ureal_parser_policies; + + template <typename T> + struct real_parser_policies; + + /////////////////////////////////////////////////////////////////////////// + // + // real_parser class + // + /////////////////////////////////////////////////////////////////////////// + template < + typename T = double, + typename RealPoliciesT = ureal_parser_policies<T> + > + struct real_parser; + + /////////////////////////////////////////////////////////////////////////// + // + // strict reals (do not allow plain integers (no decimal point)) + // + /////////////////////////////////////////////////////////////////////////// + template <typename T> + struct strict_ureal_parser_policies; + + template <typename T> + struct strict_real_parser_policies; + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif + diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/primitives/primitives.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/primitives/primitives.hpp new file mode 100644 index 0000000..d89585b --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/primitives/primitives.hpp @@ -0,0 +1,654 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + Copyright (c) 2003 Martin Wille + 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_PRIMITIVES_HPP) +#define BOOST_SPIRIT_PRIMITIVES_HPP + +#include <boost/ref.hpp> +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/assert.hpp> +#include <boost/spirit/home/classic/core/parser.hpp> +#include <boost/spirit/home/classic/core/composite/impl/directives.ipp> +#include <boost/spirit/home/classic/core/primitives/impl/primitives.ipp> + +#ifdef BOOST_MSVC +#pragma warning (push) +#pragma warning(disable : 4512) +#endif + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // char_parser class + // + /////////////////////////////////////////////////////////////////////////// + template <typename DerivedT> + struct char_parser : public parser<DerivedT> + { + typedef DerivedT self_t; + template <typename ScannerT> + struct result + { + typedef typename match_result< + ScannerT, + typename ScannerT::value_t + >::type type; + }; + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef typename parser_result<self_t, ScannerT>::type result_t; + typedef typename ScannerT::value_t value_t; + typedef typename ScannerT::iterator_t iterator_t; + + if (!scan.at_end()) + { + value_t ch = *scan; + if (this->derived().test(ch)) + { + iterator_t save(scan.first); + ++scan.first; + return scan.create_match(1, ch, save, scan.first); + } + } + return scan.no_match(); + } + }; + + /////////////////////////////////////////////////////////////////////////// + // + // negation of char_parsers + // + /////////////////////////////////////////////////////////////////////////// + template <typename PositiveT> + struct negated_char_parser + : public char_parser<negated_char_parser<PositiveT> > + { + typedef negated_char_parser<PositiveT> self_t; + typedef PositiveT positive_t; + + negated_char_parser(positive_t const& p) + : positive(p.derived()) {} + + template <typename T> + bool test(T ch) const + { + return !positive.test(ch); + } + + positive_t const positive; + }; + + template <typename ParserT> + inline negated_char_parser<ParserT> + operator~(char_parser<ParserT> const& p) + { + return negated_char_parser<ParserT>(p.derived()); + } + + template <typename ParserT> + inline ParserT + operator~(negated_char_parser<ParserT> const& n) + { + return n.positive; + } + + /////////////////////////////////////////////////////////////////////////// + // + // chlit class + // + /////////////////////////////////////////////////////////////////////////// + template <typename CharT = char> + struct chlit : public char_parser<chlit<CharT> > + { + chlit(CharT ch_) + : ch(ch_) {} + + template <typename T> + bool test(T ch_) const + { + return ch_ == ch; + } + + CharT ch; + }; + + template <typename CharT> + inline chlit<CharT> + ch_p(CharT ch) + { + return chlit<CharT>(ch); + } + + // This should take care of ch_p("a") "bugs" + template <typename CharT, std::size_t N> + inline chlit<CharT> + ch_p(CharT const (& str)[N]) + { + // ch_p's argument should be a single character or a null-terminated + // string with a single character + BOOST_STATIC_ASSERT(N < 3); + return chlit<CharT>(str[0]); + } + + /////////////////////////////////////////////////////////////////////////// + // + // range class + // + /////////////////////////////////////////////////////////////////////////// + template <typename CharT = char> + struct range : public char_parser<range<CharT> > + { + range(CharT first_, CharT last_) + : first(first_), last(last_) + { + BOOST_SPIRIT_ASSERT(!(last < first)); + } + + template <typename T> + bool test(T ch) const + { + return !(CharT(ch) < first) && !(last < CharT(ch)); + } + + CharT first; + CharT last; + }; + + template <typename CharT> + inline range<CharT> + range_p(CharT first, CharT last) + { + return range<CharT>(first, last); + } + + /////////////////////////////////////////////////////////////////////////// + // + // chseq class + // + /////////////////////////////////////////////////////////////////////////// + template <typename IteratorT = char const*> + class chseq : public parser<chseq<IteratorT> > + { + public: + + typedef chseq<IteratorT> self_t; + + chseq(IteratorT first_, IteratorT last_) + : first(first_), last(last_) {} + + chseq(IteratorT first_) + : first(first_), last(impl::get_last(first_)) {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef typename boost::unwrap_reference<IteratorT>::type striter_t; + typedef typename parser_result<self_t, ScannerT>::type result_t; + return impl::string_parser_parse<result_t>( + striter_t(first), + striter_t(last), + scan); + } + + private: + + IteratorT first; + IteratorT last; + }; + + template <typename CharT> + inline chseq<CharT const*> + chseq_p(CharT const* str) + { + return chseq<CharT const*>(str); + } + + template <typename IteratorT> + inline chseq<IteratorT> + chseq_p(IteratorT first, IteratorT last) + { + return chseq<IteratorT>(first, last); + } + + /////////////////////////////////////////////////////////////////////////// + // + // strlit class + // + /////////////////////////////////////////////////////////////////////////// + template <typename IteratorT = char const*> + class strlit : public parser<strlit<IteratorT> > + { + public: + + typedef strlit<IteratorT> self_t; + + strlit(IteratorT first, IteratorT last) + : seq(first, last) {} + + strlit(IteratorT first) + : seq(first) {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typedef typename parser_result<self_t, ScannerT>::type result_t; + return impl::contiguous_parser_parse<result_t> + (seq, scan, scan); + } + + private: + + chseq<IteratorT> seq; + }; + + template <typename CharT> + inline strlit<CharT const*> + str_p(CharT const* str) + { + return strlit<CharT const*>(str); + } + + template <typename CharT> + inline strlit<CharT *> + str_p(CharT * str) + { + return strlit<CharT *>(str); + } + + template <typename IteratorT> + inline strlit<IteratorT> + str_p(IteratorT first, IteratorT last) + { + return strlit<IteratorT>(first, last); + } + + // This should take care of str_p('a') "bugs" + template <typename CharT> + inline chlit<CharT> + str_p(CharT ch) + { + return chlit<CharT>(ch); + } + + /////////////////////////////////////////////////////////////////////////// + // + // nothing_parser class + // + /////////////////////////////////////////////////////////////////////////// + struct nothing_parser : public parser<nothing_parser> + { + typedef nothing_parser self_t; + + nothing_parser() {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + return scan.no_match(); + } + }; + + nothing_parser const nothing_p = nothing_parser(); + + /////////////////////////////////////////////////////////////////////////// + // + // anychar_parser class + // + /////////////////////////////////////////////////////////////////////////// + struct anychar_parser : public char_parser<anychar_parser> + { + typedef anychar_parser self_t; + + anychar_parser() {} + + template <typename CharT> + bool test(CharT) const + { + return true; + } + }; + + anychar_parser const anychar_p = anychar_parser(); + + inline nothing_parser + operator~(anychar_parser) + { + return nothing_p; + } + + /////////////////////////////////////////////////////////////////////////// + // + // alnum_parser class + // + /////////////////////////////////////////////////////////////////////////// + struct alnum_parser : public char_parser<alnum_parser> + { + typedef alnum_parser self_t; + + alnum_parser() {} + + template <typename CharT> + bool test(CharT ch) const + { + return impl::isalnum_(ch); + } + }; + + alnum_parser const alnum_p = alnum_parser(); + + /////////////////////////////////////////////////////////////////////////// + // + // alpha_parser class + // + /////////////////////////////////////////////////////////////////////////// + struct alpha_parser : public char_parser<alpha_parser> + { + typedef alpha_parser self_t; + + alpha_parser() {} + + template <typename CharT> + bool test(CharT ch) const + { + return impl::isalpha_(ch); + } + }; + + alpha_parser const alpha_p = alpha_parser(); + + /////////////////////////////////////////////////////////////////////////// + // + // cntrl_parser class + // + /////////////////////////////////////////////////////////////////////////// + struct cntrl_parser : public char_parser<cntrl_parser> + { + typedef cntrl_parser self_t; + + cntrl_parser() {} + + template <typename CharT> + bool test(CharT ch) const + { + return impl::iscntrl_(ch); + } + }; + + cntrl_parser const cntrl_p = cntrl_parser(); + + /////////////////////////////////////////////////////////////////////////// + // + // digit_parser class + // + /////////////////////////////////////////////////////////////////////////// + struct digit_parser : public char_parser<digit_parser> + { + typedef digit_parser self_t; + + digit_parser() {} + + template <typename CharT> + bool test(CharT ch) const + { + return impl::isdigit_(ch); + } + }; + + digit_parser const digit_p = digit_parser(); + + /////////////////////////////////////////////////////////////////////////// + // + // graph_parser class + // + /////////////////////////////////////////////////////////////////////////// + struct graph_parser : public char_parser<graph_parser> + { + typedef graph_parser self_t; + + graph_parser() {} + + template <typename CharT> + bool test(CharT ch) const + { + return impl::isgraph_(ch); + } + }; + + graph_parser const graph_p = graph_parser(); + + /////////////////////////////////////////////////////////////////////////// + // + // lower_parser class + // + /////////////////////////////////////////////////////////////////////////// + struct lower_parser : public char_parser<lower_parser> + { + typedef lower_parser self_t; + + lower_parser() {} + + template <typename CharT> + bool test(CharT ch) const + { + return impl::islower_(ch); + } + }; + + lower_parser const lower_p = lower_parser(); + + /////////////////////////////////////////////////////////////////////////// + // + // print_parser class + // + /////////////////////////////////////////////////////////////////////////// + struct print_parser : public char_parser<print_parser> + { + typedef print_parser self_t; + + print_parser() {} + + template <typename CharT> + bool test(CharT ch) const + { + return impl::isprint_(ch); + } + }; + + print_parser const print_p = print_parser(); + + /////////////////////////////////////////////////////////////////////////// + // + // punct_parser class + // + /////////////////////////////////////////////////////////////////////////// + struct punct_parser : public char_parser<punct_parser> + { + typedef punct_parser self_t; + + punct_parser() {} + + template <typename CharT> + bool test(CharT ch) const + { + return impl::ispunct_(ch); + } + }; + + punct_parser const punct_p = punct_parser(); + + /////////////////////////////////////////////////////////////////////////// + // + // blank_parser class + // + /////////////////////////////////////////////////////////////////////////// + struct blank_parser : public char_parser<blank_parser> + { + typedef blank_parser self_t; + + blank_parser() {} + + template <typename CharT> + bool test(CharT ch) const + { + return impl::isblank_(ch); + } + }; + + blank_parser const blank_p = blank_parser(); + + /////////////////////////////////////////////////////////////////////////// + // + // space_parser class + // + /////////////////////////////////////////////////////////////////////////// + struct space_parser : public char_parser<space_parser> + { + typedef space_parser self_t; + + space_parser() {} + + template <typename CharT> + bool test(CharT ch) const + { + return impl::isspace_(ch); + } + }; + + space_parser const space_p = space_parser(); + + /////////////////////////////////////////////////////////////////////////// + // + // upper_parser class + // + /////////////////////////////////////////////////////////////////////////// + struct upper_parser : public char_parser<upper_parser> + { + typedef upper_parser self_t; + + upper_parser() {} + + template <typename CharT> + bool test(CharT ch) const + { + return impl::isupper_(ch); + } + }; + + upper_parser const upper_p = upper_parser(); + + /////////////////////////////////////////////////////////////////////////// + // + // xdigit_parser class + // + /////////////////////////////////////////////////////////////////////////// + struct xdigit_parser : public char_parser<xdigit_parser> + { + typedef xdigit_parser self_t; + + xdigit_parser() {} + + template <typename CharT> + bool test(CharT ch) const + { + return impl::isxdigit_(ch); + } + }; + + xdigit_parser const xdigit_p = xdigit_parser(); + + /////////////////////////////////////////////////////////////////////////// + // + // eol_parser class (contributed by Martin Wille) + // + /////////////////////////////////////////////////////////////////////////// + struct eol_parser : public parser<eol_parser> + { + typedef eol_parser self_t; + + eol_parser() {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + typename ScannerT::iterator_t save = scan.first; + std::size_t len = 0; + + if (!scan.at_end() && *scan == '\r') // CR + { + ++scan.first; + ++len; + } + + // Don't call skipper here + if (scan.first != scan.last && *scan == '\n') // LF + { + ++scan.first; + ++len; + } + + if (len) + return scan.create_match(len, nil_t(), save, scan.first); + return scan.no_match(); + } + }; + + eol_parser const eol_p = eol_parser(); + + /////////////////////////////////////////////////////////////////////////// + // + // end_parser class (suggested by Markus Schoepflin) + // + /////////////////////////////////////////////////////////////////////////// + struct end_parser : public parser<end_parser> + { + typedef end_parser self_t; + + end_parser() {} + + template <typename ScannerT> + typename parser_result<self_t, ScannerT>::type + parse(ScannerT const& scan) const + { + if (scan.at_end()) + return scan.empty_match(); + return scan.no_match(); + } + }; + + end_parser const end_p = end_parser(); + + /////////////////////////////////////////////////////////////////////////// + // + // the pizza_p parser :-) + // + /////////////////////////////////////////////////////////////////////////// + inline strlit<char const*> const + pizza_p(char const* your_favorite_pizza) + { + return your_favorite_pizza; + } + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#ifdef BOOST_MSVC +#pragma warning (pop) +#endif + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/safe_bool.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/safe_bool.hpp new file mode 100644 index 0000000..73b6e7b --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/safe_bool.hpp @@ -0,0 +1,64 @@ +/*============================================================================= + Copyright (c) 2003 Joel de Guzman + 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_SAFE_BOOL_HPP) +#define BOOST_SPIRIT_SAFE_BOOL_HPP + +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/spirit/home/classic/namespace.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + namespace impl + { + template <typename T> + struct no_base {}; + + template <typename T> + struct safe_bool_impl + { +#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) + void stub(T*) {}; + typedef void (safe_bool_impl::*type)(T*); +#else + typedef T* TP; // workaround to make parsing easier + TP stub; + typedef TP safe_bool_impl::*type; +#endif + }; + } + + template <typename DerivedT, typename BaseT = impl::no_base<DerivedT> > + struct safe_bool : BaseT + { + private: + typedef impl::safe_bool_impl<DerivedT> impl_t; + typedef typename impl_t::type bool_type; + + public: + operator bool_type() const + { + return static_cast<const DerivedT*>(this)->operator_bool() ? + &impl_t::stub : 0; + } + + operator bool_type() + { + return static_cast<DerivedT*>(this)->operator_bool() ? + &impl_t::stub : 0; + } + }; + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} + +#endif + diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/scanner/impl/skipper.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/core/scanner/impl/skipper.ipp new file mode 100644 index 0000000..fab74bd --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/scanner/impl/skipper.ipp @@ -0,0 +1,181 @@ +/*============================================================================= + 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_SKIPPER_IPP) +#define BOOST_SPIRIT_SKIPPER_IPP + +/////////////////////////////////////////////////////////////////////////////// +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + struct space_parser; + template <typename BaseT> + struct no_skipper_iteration_policy; + + namespace impl + { + template <typename ST, typename ScannerT, typename BaseT> + inline void + skipper_skip( + ST const& s, + ScannerT const& scan, + skipper_iteration_policy<BaseT> const&) + { + typedef scanner_policies< + no_skipper_iteration_policy< + BOOST_DEDUCED_TYPENAME ScannerT::iteration_policy_t>, + BOOST_DEDUCED_TYPENAME ScannerT::match_policy_t, + BOOST_DEDUCED_TYPENAME ScannerT::action_policy_t + > policies_t; + + scanner<BOOST_DEDUCED_TYPENAME ScannerT::iterator_t, policies_t> + scan2(scan.first, scan.last, policies_t(scan)); + typedef typename ScannerT::iterator_t iterator_t; + + for (;;) + { + iterator_t save = scan.first; + if (!s.parse(scan2)) + { + scan.first = save; + break; + } + } + } + + template <typename ST, typename ScannerT, typename BaseT> + inline void + skipper_skip( + ST const& s, + ScannerT const& scan, + no_skipper_iteration_policy<BaseT> const&) + { + for (;;) + { + typedef typename ScannerT::iterator_t iterator_t; + iterator_t save = scan.first; + if (!s.parse(scan)) + { + scan.first = save; + break; + } + } + } + + template <typename ST, typename ScannerT> + inline void + skipper_skip( + ST const& s, + ScannerT const& scan, + iteration_policy const&) + { + for (;;) + { + typedef typename ScannerT::iterator_t iterator_t; + iterator_t save = scan.first; + if (!s.parse(scan)) + { + scan.first = save; + break; + } + } + } + + template <typename SkipT> + struct phrase_parser + { + template <typename IteratorT, typename ParserT> + static parse_info<IteratorT> + parse( + IteratorT const& first_, + IteratorT const& last, + ParserT const& p, + SkipT const& skip) + { + typedef skip_parser_iteration_policy<SkipT> iter_policy_t; + typedef scanner_policies<iter_policy_t> scanner_policies_t; + typedef scanner<IteratorT, scanner_policies_t> scanner_t; + + iter_policy_t iter_policy(skip); + scanner_policies_t policies(iter_policy); + IteratorT first = first_; + scanner_t scan(first, last, policies); + match<nil_t> hit = p.parse(scan); + return parse_info<IteratorT>( + first, hit, hit && (first == last), + hit.length()); + } + }; + + template <> + struct phrase_parser<space_parser> + { + template <typename IteratorT, typename ParserT> + static parse_info<IteratorT> + parse( + IteratorT const& first_, + IteratorT const& last, + ParserT const& p, + space_parser const&) + { + typedef skipper_iteration_policy<> iter_policy_t; + typedef scanner_policies<iter_policy_t> scanner_policies_t; + typedef scanner<IteratorT, scanner_policies_t> scanner_t; + + IteratorT first = first_; + scanner_t scan(first, last); + match<nil_t> hit = p.parse(scan); + return parse_info<IteratorT>( + first, hit, hit && (first == last), + hit.length()); + } + }; + } + + /////////////////////////////////////////////////////////////////////////// + // + // Free parse functions using the skippers + // + /////////////////////////////////////////////////////////////////////////// + template <typename IteratorT, typename ParserT, typename SkipT> + inline parse_info<IteratorT> + parse( + IteratorT const& first, + IteratorT const& last, + parser<ParserT> const& p, + parser<SkipT> const& skip) + { + return impl::phrase_parser<SkipT>:: + parse(first, last, p.derived(), skip.derived()); + } + + /////////////////////////////////////////////////////////////////////////// + // + // Parse function for null terminated strings using the skippers + // + /////////////////////////////////////////////////////////////////////////// + template <typename CharT, typename ParserT, typename SkipT> + inline parse_info<CharT const*> + parse( + CharT const* str, + parser<ParserT> const& p, + parser<SkipT> const& skip) + { + CharT const* last = str; + while (*last) + last++; + return parse(str, last, p, skip); + } + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit + +#endif + diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/scanner/scanner.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/scanner/scanner.hpp new file mode 100644 index 0000000..3854877 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/scanner/scanner.hpp @@ -0,0 +1,329 @@ +/*============================================================================= + Copyright (c) 1998-2002 Joel de Guzman + 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_SCANNER_HPP) +#define BOOST_SPIRIT_SCANNER_HPP + +#include <iterator> +#include <boost/config.hpp> +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/match.hpp> +#include <boost/spirit/home/classic/core/non_terminal/parser_id.hpp> +#include <boost/detail/iterator.hpp> // for boost::detail::iterator_traits + +#include <boost/spirit/home/classic/core/scanner/scanner_fwd.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // iteration_policy class + // + /////////////////////////////////////////////////////////////////////////// + struct iteration_policy + { + template <typename ScannerT> + void + advance(ScannerT const& scan) const + { + ++scan.first; + } + + template <typename ScannerT> + bool at_end(ScannerT const& scan) const + { + return scan.first == scan.last; + } + + template <typename T> + T filter(T ch) const + { + return ch; + } + + template <typename ScannerT> + typename ScannerT::ref_t + get(ScannerT const& scan) const + { + return *scan.first; + } + }; + + /////////////////////////////////////////////////////////////////////////// + // + // match_policy class + // + /////////////////////////////////////////////////////////////////////////// + struct match_policy + { + template <typename T> + struct result { typedef match<T> type; }; + + const match<nil_t> + no_match() const + { + return match<nil_t>(); + } + + const match<nil_t> + empty_match() const + { + return match<nil_t>(0, nil_t()); + } + + template <typename AttrT, typename IteratorT> + match<AttrT> + create_match( + std::size_t length, + AttrT const& val, + IteratorT const& /*first*/, + IteratorT const& /*last*/) const + { + return match<AttrT>(length, val); + } + + template <typename MatchT, typename IteratorT> + void group_match( + MatchT& /*m*/, + parser_id const& /*id*/, + IteratorT const& /*first*/, + IteratorT const& /*last*/) const {} + + template <typename Match1T, typename Match2T> + void concat_match(Match1T& l, Match2T const& r) const + { + l.concat(r); + } + }; + + /////////////////////////////////////////////////////////////////////////// + // + // match_result class + // + /////////////////////////////////////////////////////////////////////////// + template <typename MatchPolicyT, typename T> + struct match_result + { + typedef typename MatchPolicyT::template result<T>::type type; + }; + + /////////////////////////////////////////////////////////////////////////// + // + // action_policy class + // + /////////////////////////////////////////////////////////////////////////// + template <typename AttrT> + struct attributed_action_policy + { + template <typename ActorT, typename IteratorT> + static void + call( + ActorT const& actor, + AttrT& val, + IteratorT const&, + IteratorT const&) + { + actor(val); + } + }; + + ////////////////////////////////// + template <> + struct attributed_action_policy<nil_t> + { + template <typename ActorT, typename IteratorT> + static void + call( + ActorT const& actor, + nil_t, + IteratorT const& first, + IteratorT const& last) + { + actor(first, last); + } + }; + + ////////////////////////////////// + struct action_policy + { + template <typename ActorT, typename AttrT, typename IteratorT> + void + do_action( + ActorT const& actor, + AttrT& val, + IteratorT const& first, + IteratorT const& last) const + { + attributed_action_policy<AttrT>::call(actor, val, first, last); + } + }; + + /////////////////////////////////////////////////////////////////////////// + // + // scanner_policies class + // + /////////////////////////////////////////////////////////////////////////// + template < + typename IterationPolicyT, + typename MatchPolicyT, + typename ActionPolicyT> + struct scanner_policies : + public IterationPolicyT, + public MatchPolicyT, + public ActionPolicyT + { + typedef IterationPolicyT iteration_policy_t; + typedef MatchPolicyT match_policy_t; + typedef ActionPolicyT action_policy_t; + + scanner_policies( + IterationPolicyT const& i_policy = IterationPolicyT(), + MatchPolicyT const& m_policy = MatchPolicyT(), + ActionPolicyT const& a_policy = ActionPolicyT()) + : IterationPolicyT(i_policy) + , MatchPolicyT(m_policy) + , ActionPolicyT(a_policy) {} + + template <typename ScannerPoliciesT> + scanner_policies(ScannerPoliciesT const& policies) + : IterationPolicyT(policies) + , MatchPolicyT(policies) + , ActionPolicyT(policies) {} + }; + + /////////////////////////////////////////////////////////////////////////// + // + // scanner_policies_base class: the base class of all scanners + // + /////////////////////////////////////////////////////////////////////////// + struct scanner_base {}; + + /////////////////////////////////////////////////////////////////////////// + // + // scanner class + // + /////////////////////////////////////////////////////////////////////////// + template < + typename IteratorT, + typename PoliciesT> + class scanner : public PoliciesT, public scanner_base + { + public: + + typedef IteratorT iterator_t; + typedef PoliciesT policies_t; + + typedef typename boost::detail:: + iterator_traits<IteratorT>::value_type value_t; + typedef typename boost::detail:: + iterator_traits<IteratorT>::reference ref_t; + typedef typename boost:: + call_traits<IteratorT>::param_type iter_param_t; + + scanner( + IteratorT& first_, + iter_param_t last_, + PoliciesT const& policies = PoliciesT()) + : PoliciesT(policies), first(first_), last(last_) + { + at_end(); + } + + scanner(scanner const& other) + : PoliciesT(other), first(other.first), last(other.last) {} + + scanner(scanner const& other, IteratorT& first_) + : PoliciesT(other), first(first_), last(other.last) {} + + template <typename PoliciesT1> + scanner(scanner<IteratorT, PoliciesT1> const& other) + : PoliciesT(other), first(other.first), last(other.last) {} + + bool + at_end() const + { + typedef typename PoliciesT::iteration_policy_t iteration_policy_type; + return iteration_policy_type::at_end(*this); + } + + value_t + operator*() const + { + typedef typename PoliciesT::iteration_policy_t iteration_policy_type; + return iteration_policy_type::filter(iteration_policy_type::get(*this)); + } + + scanner const& + operator++() const + { + typedef typename PoliciesT::iteration_policy_t iteration_policy_type; + iteration_policy_type::advance(*this); + return *this; + } + + template <typename PoliciesT2> + struct rebind_policies + { + typedef scanner<IteratorT, PoliciesT2> type; + }; + + template <typename PoliciesT2> + scanner<IteratorT, PoliciesT2> + change_policies(PoliciesT2 const& policies) const + { + return scanner<IteratorT, PoliciesT2>(first, last, policies); + } + + template <typename IteratorT2> + struct rebind_iterator + { + typedef scanner<IteratorT2, PoliciesT> type; + }; + + template <typename IteratorT2> + scanner<IteratorT2, PoliciesT> + change_iterator(IteratorT2 const& first_, IteratorT2 const &last_) const + { + return scanner<IteratorT2, PoliciesT>(first_, last_, *this); + } + + IteratorT& first; + IteratorT const last; + + private: + + scanner& + operator=(scanner const& other); + }; + + /////////////////////////////////////////////////////////////////////////// + // + // rebind_scanner_policies class + // + /////////////////////////////////////////////////////////////////////////// + template <typename ScannerT, typename PoliciesT> + struct rebind_scanner_policies + { + typedef typename ScannerT::template + rebind_policies<PoliciesT>::type type; + }; + + ////////////////////////////////// + template <typename ScannerT, typename IteratorT> + struct rebind_scanner_iterator + { + typedef typename ScannerT::template + rebind_iterator<IteratorT>::type type; + }; + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/scanner/scanner_fwd.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/scanner/scanner_fwd.hpp new file mode 100644 index 0000000..efd78cf --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/scanner/scanner_fwd.hpp @@ -0,0 +1,52 @@ +/*============================================================================= + Copyright (c) 2006 Tobias Schwinger + 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_SCANNER_FWD_HPP) +#define BOOST_SPIRIT_SCANNER_FWD_HPP + +#include <boost/spirit/home/classic/namespace.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // policy classes + // + /////////////////////////////////////////////////////////////////////////// + struct iteration_policy; + struct action_policy; + struct match_policy; + + /////////////////////////////////////////////////////////////////////////// + // + // scanner_policies class + // + /////////////////////////////////////////////////////////////////////////// + template < + typename IterationPolicyT = iteration_policy, + typename MatchPolicyT = match_policy, + typename ActionPolicyT = action_policy> + struct scanner_policies; + + /////////////////////////////////////////////////////////////////////////// + // + // scanner class + // + /////////////////////////////////////////////////////////////////////////// + template < + typename IteratorT = char const*, + typename PoliciesT = scanner_policies<> > + class scanner; + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif + diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/scanner/skipper.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/scanner/skipper.hpp new file mode 100644 index 0000000..4e655ae --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/scanner/skipper.hpp @@ -0,0 +1,197 @@ +/*============================================================================= + Copyright (c) 1998-2003 Joel de Guzman + 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_SKIPPER_HPP) +#define BOOST_SPIRIT_SKIPPER_HPP + +/////////////////////////////////////////////////////////////////////////////// +#include <cctype> + +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/scanner/scanner.hpp> +#include <boost/spirit/home/classic/core/primitives/impl/primitives.ipp> + +#include <boost/spirit/home/classic/core/scanner/skipper_fwd.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // skipper_iteration_policy class + // + /////////////////////////////////////////////////////////////////////////// + template <typename BaseT> + struct skipper_iteration_policy : public BaseT + { + typedef BaseT base_t; + + skipper_iteration_policy() + : BaseT() {} + + template <typename PolicyT> + skipper_iteration_policy(PolicyT const& other) + : BaseT(other) {} + + template <typename ScannerT> + void + advance(ScannerT const& scan) const + { + BaseT::advance(scan); + scan.skip(scan); + } + + template <typename ScannerT> + bool + at_end(ScannerT const& scan) const + { + scan.skip(scan); + return BaseT::at_end(scan); + } + + template <typename ScannerT> + void + skip(ScannerT const& scan) const + { + while (!BaseT::at_end(scan) && impl::isspace_(BaseT::get(scan))) + BaseT::advance(scan); + } + }; + + /////////////////////////////////////////////////////////////////////////// + // + // no_skipper_iteration_policy class + // + /////////////////////////////////////////////////////////////////////////// + template <typename BaseT> + struct no_skipper_iteration_policy : public BaseT + { + typedef BaseT base_t; + + no_skipper_iteration_policy() + : BaseT() {} + + template <typename PolicyT> + no_skipper_iteration_policy(PolicyT const& other) + : BaseT(other) {} + + template <typename ScannerT> + void + skip(ScannerT const& /*scan*/) const {} + }; + + /////////////////////////////////////////////////////////////////////////// + // + // skip_parser_iteration_policy class + // + /////////////////////////////////////////////////////////////////////////// + namespace impl + { + template <typename ST, typename ScannerT, typename BaseT> + void + skipper_skip( + ST const& s, + ScannerT const& scan, + skipper_iteration_policy<BaseT> const&); + + template <typename ST, typename ScannerT, typename BaseT> + void + skipper_skip( + ST const& s, + ScannerT const& scan, + no_skipper_iteration_policy<BaseT> const&); + + template <typename ST, typename ScannerT> + void + skipper_skip( + ST const& s, + ScannerT const& scan, + iteration_policy const&); + } + + template <typename ParserT, typename BaseT> + class skip_parser_iteration_policy : public skipper_iteration_policy<BaseT> + { + public: + + typedef skipper_iteration_policy<BaseT> base_t; + + skip_parser_iteration_policy( + ParserT const& skip_parser, + base_t const& base = base_t()) + : base_t(base), subject(skip_parser) {} + + template <typename PolicyT> + skip_parser_iteration_policy(PolicyT const& other) + : base_t(other), subject(other.skipper()) {} + + template <typename ScannerT> + void + skip(ScannerT const& scan) const + { + impl::skipper_skip(subject, scan, scan); + } + + ParserT const& + skipper() const + { + return subject; + } + + private: + + ParserT const& subject; + }; + + /////////////////////////////////////////////////////////////////////////////// + // + // Free parse functions using the skippers + // + /////////////////////////////////////////////////////////////////////////////// + template <typename IteratorT, typename ParserT, typename SkipT> + parse_info<IteratorT> + parse( + IteratorT const& first, + IteratorT const& last, + parser<ParserT> const& p, + parser<SkipT> const& skip); + + /////////////////////////////////////////////////////////////////////////////// + // + // Parse function for null terminated strings using the skippers + // + /////////////////////////////////////////////////////////////////////////////// + template <typename CharT, typename ParserT, typename SkipT> + parse_info<CharT const*> + parse( + CharT const* str, + parser<ParserT> const& p, + parser<SkipT> const& skip); + + /////////////////////////////////////////////////////////////////////////////// + // + // phrase_scanner_t and wide_phrase_scanner_t + // + // The most common scanners. Use these typedefs when you need + // a scanner that skips white spaces. + // + /////////////////////////////////////////////////////////////////////////////// + typedef skipper_iteration_policy<> iter_policy_t; + typedef scanner_policies<iter_policy_t> scanner_policies_t; + typedef scanner<char const*, scanner_policies_t> phrase_scanner_t; + typedef scanner<wchar_t const*, scanner_policies_t> wide_phrase_scanner_t; + + /////////////////////////////////////////////////////////////////////////////// + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#include <boost/spirit/home/classic/core/scanner/impl/skipper.ipp> +#endif + diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/core/scanner/skipper_fwd.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/core/scanner/skipper_fwd.hpp new file mode 100644 index 0000000..228e618 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/core/scanner/skipper_fwd.hpp @@ -0,0 +1,32 @@ +/*============================================================================= + Copyright (c) 2006 Tobias Schwinger + 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_SKIPPER_FWD_HPP) +#define BOOST_SPIRIT_SKIPPER_FWD_HPP + +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/scanner/scanner_fwd.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + template <typename BaseT = iteration_policy> + struct skipper_iteration_policy; + + template <typename BaseT = iteration_policy> + struct no_skipper_iteration_policy; + + template <typename ParserT, typename BaseT = iteration_policy> + class skip_parser_iteration_policy; + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif + diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/debug.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/debug.hpp new file mode 100644 index 0000000..9737b35 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/debug.hpp @@ -0,0 +1,154 @@ +/*============================================================================= + Copyright (c) 2001-2003 Joel de Guzman + Copyright (c) 2002-2003 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_DEBUG_MAIN_HPP) +#define BOOST_SPIRIT_DEBUG_MAIN_HPP + +/////////////////////////////////////////////////////////////////////////// +#if defined(BOOST_SPIRIT_DEBUG) + +#include <boost/spirit/home/classic/version.hpp> + +/////////////////////////////////////////////////////////////////////////////// +// +// Spirit.Debug includes and defines +// +/////////////////////////////////////////////////////////////////////////////// + + #include <iostream> + + /////////////////////////////////////////////////////////////////////////// + // + // The BOOST_SPIRIT_DEBUG_OUT defines the stream object, which should be used + // for debug diagnostics. This defaults to std::cout. + // + /////////////////////////////////////////////////////////////////////////// + #if !defined(BOOST_SPIRIT_DEBUG_OUT) + #define BOOST_SPIRIT_DEBUG_OUT std::cout + #endif + + /////////////////////////////////////////////////////////////////////////// + // + // The BOOST_SPIRIT_DEBUG_PRINT_SOME constant defines the number of characters + // from the stream to be printed for diagnosis. This defaults to the first + // 20 characters. + // + /////////////////////////////////////////////////////////////////////////// + #if !defined(BOOST_SPIRIT_DEBUG_PRINT_SOME) + #define BOOST_SPIRIT_DEBUG_PRINT_SOME 20 + #endif + + /////////////////////////////////////////////////////////////////////////// + // + // Additional BOOST_SPIRIT_DEBUG_FLAGS control the level of diagnostics printed + // Basic constants are defined in debug/minimal.hpp. + // + /////////////////////////////////////////////////////////////////////////// + #define BOOST_SPIRIT_DEBUG_FLAGS_NODES 0x0001 // node diagnostics + #define BOOST_SPIRIT_DEBUG_FLAGS_ESCAPE_CHAR 0x0002 // escape_char_parse diagnostics + #define BOOST_SPIRIT_DEBUG_FLAGS_TREES 0x0004 // parse tree/ast diagnostics + #define BOOST_SPIRIT_DEBUG_FLAGS_CLOSURES 0x0008 // closure diagnostics + #define BOOST_SPIRIT_DEBUG_FLAGS_SLEX 0x8000 // slex diagnostics + + #define BOOST_SPIRIT_DEBUG_FLAGS_MAX 0xFFFF // print maximal diagnostics + + #if !defined(BOOST_SPIRIT_DEBUG_FLAGS) + #define BOOST_SPIRIT_DEBUG_FLAGS BOOST_SPIRIT_DEBUG_FLAGS_MAX + #endif + + /////////////////////////////////////////////////////////////////////////// + // + // By default all nodes are traced (even those, not registered with + // BOOST_SPIRIT_DEBUG_RULE et.al. - see below). The following constant may be + // used to redefine this default. + // + /////////////////////////////////////////////////////////////////////////// + #if !defined(BOOST_SPIRIT_DEBUG_TRACENODE) + #define BOOST_SPIRIT_DEBUG_TRACENODE (true) + #endif // !defined(BOOST_SPIRIT_DEBUG_TRACENODE) + + /////////////////////////////////////////////////////////////////////////// + // + // Helper macros for giving rules and subrules a name accessible through + // parser_name() functions (see parser_names.hpp). + // + // Additionally, the macros BOOST_SPIRIT_DEBUG_RULE, SPIRIT_DEBUG_NODE and + // BOOST_SPIRIT_DEBUG_GRAMMAR enable/disable the tracing of the + // correspondingnode accordingly to the PP constant + // BOOST_SPIRIT_DEBUG_TRACENODE. + // + // The macros BOOST_SPIRIT_DEBUG_TRACE_RULE, BOOST_SPIRIT_DEBUG_TRACE_NODE + // and BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR allow to specify a flag to define, + // whether the corresponding node is to be traced or not. + // + /////////////////////////////////////////////////////////////////////////// + #if !defined(BOOST_SPIRIT_DEBUG_RULE) + #define BOOST_SPIRIT_DEBUG_RULE(r) \ + ::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \ + register_node(&r, #r, BOOST_SPIRIT_DEBUG_TRACENODE) + #endif // !defined(BOOST_SPIRIT_DEBUG_RULE) + + #if !defined(BOOST_SPIRIT_DEBUG_NODE) + #define BOOST_SPIRIT_DEBUG_NODE(r) \ + ::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \ + register_node(&r, #r, BOOST_SPIRIT_DEBUG_TRACENODE) + #endif // !defined(BOOST_SPIRIT_DEBUG_NODE) + + #if !defined(BOOST_SPIRIT_DEBUG_GRAMMAR) + #define BOOST_SPIRIT_DEBUG_GRAMMAR(r) \ + ::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \ + register_node(&r, #r, BOOST_SPIRIT_DEBUG_TRACENODE) + #endif // !defined(BOOST_SPIRIT_DEBUG_GRAMMAR) + + #if !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE) + #define BOOST_SPIRIT_DEBUG_TRACE_RULE(r, t) \ + ::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \ + register_node(&r, #r, (t)) + #endif // !defined(BOOST_SPIRIT_TRACE_RULE) + + #if !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE) + #define BOOST_SPIRIT_DEBUG_TRACE_NODE(r, t) \ + ::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \ + register_node(&r, #r, (t)) + #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE) + + #if !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR) + #define BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR(r, t) \ + ::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \ + register_node(&r, #r, (t)) + #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR) + + #if !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME) + #define BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME(r, n, t) \ + ::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \ + register_node(&r, (n), (t)) + #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME) + + #if !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME) + #define BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME(r, n, t) \ + ::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \ + register_node(&r, (n), (t)) + #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME) + + #if !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME) + #define BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME(r, n, t) \ + ::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \ + register_node(&r, (n), (t)) + #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME) + + ////////////////////////////////// + #include <boost/spirit/home/classic/debug/debug_node.hpp> + +#else + ////////////////////////////////// + #include <boost/spirit/home/classic/debug/minimal.hpp> + +#endif // BOOST_SPIRIT_DEBUG + +#endif + diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/debug/debug_node.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/debug/debug_node.hpp new file mode 100644 index 0000000..adc1f91 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/debug/debug_node.hpp @@ -0,0 +1,319 @@ +/*============================================================================= + Copyright (c) 2001-2003 Joel de Guzman + Copyright (c) 2002-2003 Hartmut Kaiser + Copyright (c) 2003 Gustavo Guerra + 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_DEBUG_NODE_HPP) +#define BOOST_SPIRIT_DEBUG_NODE_HPP + +#if !defined(BOOST_SPIRIT_DEBUG_MAIN_HPP) +#error "You must include boost/spirit/debug.hpp, not boost/spirit/debug/debug_node.hpp" +#endif + +#if defined(BOOST_SPIRIT_DEBUG) + +#include <string> + +#include <boost/type_traits/is_convertible.hpp> +#include <boost/mpl/if.hpp> +#include <boost/mpl/and.hpp> +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/primitives/primitives.hpp> // for iscntrl_ + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + +/////////////////////////////////////////////////////////////////////////////// +// +// Debug helper classes for rules, which ensure maximum non-intrusiveness of +// the Spirit debug support +// +/////////////////////////////////////////////////////////////////////////////// + +namespace impl { + + struct token_printer_aux_for_chars + { + template<typename CharT> + static void print(std::ostream& o, CharT c) + { + if (c == static_cast<CharT>('\a')) + o << "\\a"; + + else if (c == static_cast<CharT>('\b')) + o << "\\b"; + + else if (c == static_cast<CharT>('\f')) + o << "\\f"; + + else if (c == static_cast<CharT>('\n')) + o << "\\n"; + + else if (c == static_cast<CharT>('\r')) + o << "\\r"; + + else if (c == static_cast<CharT>('\t')) + o << "\\t"; + + else if (c == static_cast<CharT>('\v')) + o << "\\v"; + + else if (iscntrl_(c)) + o << "\\" << static_cast<int>(c); + + else + o << static_cast<char>(c); + } + }; + + // for token types where the comparison with char constants wouldn't work + struct token_printer_aux_for_other_types + { + template<typename CharT> + static void print(std::ostream& o, CharT c) + { + o << c; + } + }; + + template <typename CharT> + struct token_printer_aux + : mpl::if_< + mpl::and_< + is_convertible<CharT, char>, + is_convertible<char, CharT> >, + token_printer_aux_for_chars, + token_printer_aux_for_other_types + >::type + { + }; + + template<typename CharT> + inline void token_printer(std::ostream& o, CharT c) + { + #if !defined(BOOST_SPIRIT_DEBUG_TOKEN_PRINTER) + + token_printer_aux<CharT>::print(o, c); + + #else + + BOOST_SPIRIT_DEBUG_TOKEN_PRINTER(o, c); + + #endif + } + +/////////////////////////////////////////////////////////////////////////////// +// +// Dump infos about the parsing state of a rule +// +/////////////////////////////////////////////////////////////////////////////// + +#if BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES + template <typename IteratorT> + inline void + print_node_info(bool hit, int level, bool close, std::string const& name, + IteratorT first, IteratorT last) + { + if (!name.empty()) + { + for (int i = 0; i < level; ++i) + BOOST_SPIRIT_DEBUG_OUT << " "; + if (close) + { + if (hit) + BOOST_SPIRIT_DEBUG_OUT << "/"; + else + BOOST_SPIRIT_DEBUG_OUT << "#"; + } + BOOST_SPIRIT_DEBUG_OUT << name << ":\t\""; + IteratorT iter = first; + IteratorT ilast = last; + for (int j = 0; j < BOOST_SPIRIT_DEBUG_PRINT_SOME; ++j) + { + if (iter == ilast) + break; + + token_printer(BOOST_SPIRIT_DEBUG_OUT, *iter); + ++iter; + } + BOOST_SPIRIT_DEBUG_OUT << "\"\n"; + } + } +#endif // BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES + +#if BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_CLOSURES + template <typename ResultT> + inline ResultT & + print_closure_info(ResultT &hit, int level, std::string const& name) + { + if (!name.empty()) + { + for (int i = 0; i < level-1; ++i) + BOOST_SPIRIT_DEBUG_OUT << " "; + + // for now, print out the return value only + BOOST_SPIRIT_DEBUG_OUT << "^" << name << ":\t"; + if (hit.has_valid_attribute()) + BOOST_SPIRIT_DEBUG_OUT << hit.value(); + else + BOOST_SPIRIT_DEBUG_OUT << "undefined attribute"; + BOOST_SPIRIT_DEBUG_OUT << "\n"; + } + return hit; + } +#endif // BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_CLOSURES + +} + +/////////////////////////////////////////////////////////////////////////////// +// +// Implementation note: The parser_context_linker, parser_scanner_linker and +// closure_context_linker classes are wrapped by a PP constant to allow +// redefinition of this classes outside of Spirit +// +/////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_SPIRIT_PARSER_CONTEXT_LINKER_DEFINED) +#define BOOST_SPIRIT_PARSER_CONTEXT_LINKER_DEFINED + + /////////////////////////////////////////////////////////////////////////// + // + // parser_context_linker is a debug wrapper for the ContextT template + // parameter of the rule<>, subrule<> and the grammar<> classes + // + /////////////////////////////////////////////////////////////////////////// + template<typename ContextT> + struct parser_context_linker : public ContextT + { + typedef ContextT base_t; + + template <typename ParserT> + parser_context_linker(ParserT const& p) + : ContextT(p) {} + + template <typename ParserT, typename ScannerT> + void pre_parse(ParserT const& p, ScannerT &scan) + { + this->base_t::pre_parse(p, scan); + +#if BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES + if (trace_parser(p.derived())) { + impl::print_node_info( + false, + scan.get_level(), + false, + parser_name(p.derived()), + scan.first, + scan.last); + } + scan.get_level()++; +#endif // BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES + } + + template <typename ResultT, typename ParserT, typename ScannerT> + ResultT& post_parse(ResultT& hit, ParserT const& p, ScannerT &scan) + { +#if BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES + --scan.get_level(); + if (trace_parser(p.derived())) { + impl::print_node_info( + hit, + scan.get_level(), + true, + parser_name(p.derived()), + scan.first, + scan.last); + } +#endif // BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES + + return this->base_t::post_parse(hit, p, scan); + } + }; + +#endif // !defined(BOOST_SPIRIT_PARSER_CONTEXT_LINKER_DEFINED) + +#if !defined(BOOST_SPIRIT_PARSER_SCANNER_LINKER_DEFINED) +#define BOOST_SPIRIT_PARSER_SCANNER_LINKER_DEFINED + +/////////////////////////////////////////////////////////////////////////////// +// This class is to avoid linker problems and to ensure a real singleton +// 'level' variable + struct debug_support + { + int& get_level() + { + static int level = 0; + return level; + } + }; + + template<typename ScannerT> + struct parser_scanner_linker : public ScannerT + { + parser_scanner_linker(ScannerT const &scan_) : ScannerT(scan_) + {} + + int &get_level() + { return debug.get_level(); } + + private: debug_support debug; + }; + +#endif // !defined(BOOST_SPIRIT_PARSER_SCANNER_LINKER_DEFINED) + +#if !defined(BOOST_SPIRIT_CLOSURE_CONTEXT_LINKER_DEFINED) +#define BOOST_SPIRIT_CLOSURE_CONTEXT_LINKER_DEFINED + + /////////////////////////////////////////////////////////////////////////// + // + // closure_context_linker is a debug wrapper for the closure template + // parameter of the rule<>, subrule<> and grammar classes + // + /////////////////////////////////////////////////////////////////////////// + + template<typename ContextT> + struct closure_context_linker : public parser_context_linker<ContextT> + { + typedef parser_context_linker<ContextT> base_t; + + template <typename ParserT> + closure_context_linker(ParserT const& p) + : parser_context_linker<ContextT>(p) {} + + template <typename ParserT, typename ScannerT> + void pre_parse(ParserT const& p, ScannerT &scan) + { this->base_t::pre_parse(p, scan); } + + template <typename ResultT, typename ParserT, typename ScannerT> + ResultT& + post_parse(ResultT& hit, ParserT const& p, ScannerT &scan) + { +#if BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_CLOSURES + if (hit && trace_parser(p.derived())) { + // for now, print out the return value only + return impl::print_closure_info( + this->base_t::post_parse(hit, p, scan), + scan.get_level(), + parser_name(p.derived()) + ); + } +#endif // BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_CLOSURES + + return this->base_t::post_parse(hit, p, scan); + } + }; + +#endif // !defined(BOOST_SPIRIT_CLOSURE_CONTEXT_LINKER_DEFINED) + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif // defined(BOOST_SPIRIT_DEBUG) + +#endif // !defined(BOOST_SPIRIT_DEBUG_NODE_HPP) + diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/debug/minimal.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/debug/minimal.hpp new file mode 100644 index 0000000..0cb4264 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/debug/minimal.hpp @@ -0,0 +1,81 @@ +/*============================================================================= + Copyright (c) 2001-2003 Joel de Guzman + Copyright (c) 2002-2003 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_MINIMAL_DEBUG_HPP) +#define BOOST_SPIRIT_MINIMAL_DEBUG_HPP + +#if !defined(BOOST_SPIRIT_DEBUG_MAIN_HPP) +#error "You must include boost/spirit/debug.hpp, not boost/spirit/debug/minimal.hpp" +#endif +/////////////////////////////////////////////////////////////////////////////// +// +// Minimum debugging tools support +// +/////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_SPIRIT_DEBUG_OUT) +#define BOOST_SPIRIT_DEBUG_OUT std::cout +#endif + +/////////////////////////////////////////////////////////////////////////// +// +// BOOST_SPIRIT_DEBUG_FLAGS controls the level of diagnostics printed +// +/////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_SPIRIT_DEBUG_FLAGS_NONE) +#define BOOST_SPIRIT_DEBUG_FLAGS_NONE 0x0000 // no diagnostics at all +#endif + +#if !defined(BOOST_SPIRIT_DEBUG_FLAGS_MAX) +#define BOOST_SPIRIT_DEBUG_FLAGS_MAX 0xFFFF // print maximal diagnostics +#endif + +#if !defined(BOOST_SPIRIT_DEBUG_FLAGS) +#define BOOST_SPIRIT_DEBUG_FLAGS BOOST_SPIRIT_DEBUG_FLAGS_MAX +#endif + +#if !defined(BOOST_SPIRIT_DEBUG_PRINT_SOME) +#define BOOST_SPIRIT_DEBUG_PRINT_SOME 20 +#endif + +#if !defined(BOOST_SPIRIT_DEBUG_RULE) +#define BOOST_SPIRIT_DEBUG_RULE(r) +#endif // !defined(BOOST_SPIRIT_DEBUG_RULE) + +#if !defined(BOOST_SPIRIT_DEBUG_NODE) +#define BOOST_SPIRIT_DEBUG_NODE(r) +#endif // !defined(BOOST_SPIRIT_DEBUG_NODE) + +#if !defined(BOOST_SPIRIT_DEBUG_GRAMMAR) +#define BOOST_SPIRIT_DEBUG_GRAMMAR(r) +#endif // !defined(BOOST_SPIRIT_DEBUG_GRAMMAR) + +#if !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE) +#define BOOST_SPIRIT_DEBUG_TRACE_RULE(r, t) +#endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE) + +#if !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE) +#define BOOST_SPIRIT_DEBUG_TRACE_NODE(r, t) +#endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE) + +#if !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR) +#define BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR(r, t) +#endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR) + +#if !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME) +#define BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME(r, n, t) +#endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME) + +#if !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME) +#define BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME(r, n, t) +#endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME) + +#if !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME) +#define BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME(r, n, t) +#endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME) + +#endif // !defined(BOOST_SPIRIT_MINIMAL_DEBUG_HPP) diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/meta/as_parser.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/meta/as_parser.hpp new file mode 100644 index 0000000..c5cc82d --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/meta/as_parser.hpp @@ -0,0 +1,113 @@ +/*============================================================================= + Copyright (c) 2002-2003 Joel de Guzman + Copyright (c) 2002-2003 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_AS_PARSER_HPP) +#define BOOST_SPIRIT_AS_PARSER_HPP + +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/primitives/primitives.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // Helper templates to derive the parser type from an auxilliary type + // and to generate an object of the required parser type given an + // auxilliary object. Supported types to convert are parsers, + // single characters and character strings. + // + /////////////////////////////////////////////////////////////////////////// + namespace impl + { + template<typename T> + struct default_as_parser + { + typedef T type; + static type const& convert(type const& p) + { + return p; + } + }; + + struct char_as_parser + { + typedef chlit<char> type; + static type convert(char ch) + { + return type(ch); + } + }; + + struct wchar_as_parser + { + typedef chlit<wchar_t> type; + static type convert(wchar_t ch) + { + return type(ch); + } + }; + + struct string_as_parser + { + typedef strlit<char const*> type; + static type convert(char const* str) + { + return type(str); + } + }; + + struct wstring_as_parser + { + typedef strlit<wchar_t const*> type; + static type convert(wchar_t const* str) + { + return type(str); + } + }; + } + + template<typename T> + struct as_parser : impl::default_as_parser<T> {}; + + template<> + struct as_parser<char> : impl::char_as_parser {}; + + template<> + struct as_parser<wchar_t> : impl::wchar_as_parser {}; + + template<> + struct as_parser<char*> : impl::string_as_parser {}; + + template<> + struct as_parser<char const*> : impl::string_as_parser {}; + + template<> + struct as_parser<wchar_t*> : impl::wstring_as_parser {}; + + template<> + struct as_parser<wchar_t const*> : impl::wstring_as_parser {}; + + template<int N> + struct as_parser<char[N]> : impl::string_as_parser {}; + + template<int N> + struct as_parser<wchar_t[N]> : impl::wstring_as_parser {}; + + template<int N> + struct as_parser<char const[N]> : impl::string_as_parser {}; + + template<int N> + struct as_parser<wchar_t const[N]> : impl::wstring_as_parser {}; + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/namespace.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/namespace.hpp new file mode 100644 index 0000000..f64fc81 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/namespace.hpp @@ -0,0 +1,35 @@ +/*============================================================================= + Copyright (c) 2001-2008 Joel de Guzman + Copyright (c) 2001-2008 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(SPIRIT_CLASSIC_NAMESPACE_HPP) +#define SPIRIT_CLASSIC_NAMESPACE_HPP + +#if defined(BOOST_SPIRIT_USE_OLD_NAMESPACE) + +// Use the old namespace for Spirit.Classic, everything is located in the +// namespace boost::spirit. +// This is in place for backwards compatibility with Spirit V1.8.x. Don't use +// it when combining Spirit.Classic with other parts of the library + +#define BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN /*namespace classic {*/ +#define BOOST_SPIRIT_CLASSIC_NS boost::spirit/*::classic*/ +#define BOOST_SPIRIT_CLASSIC_NAMESPACE_END /*}*/ + +#else + +// This is the normal (and suggested) mode of operation when using +// Spirit.Classic. Everything will be located in the namespace +// boost::spirit::classic, avoiding name clashes with other parts of Spirit. + +#define BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN namespace classic { +#define BOOST_SPIRIT_CLASSIC_NS boost::spirit::classic +#define BOOST_SPIRIT_CLASSIC_NAMESPACE_END } + +#endif + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/utility/chset.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/utility/chset.hpp new file mode 100644 index 0000000..3635456 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/utility/chset.hpp @@ -0,0 +1,187 @@ +/*============================================================================= + Copyright (c) 2001-2003 Joel de Guzman + Copyright (c) 2001-2003 Daniel Nuffer + 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) +=============================================================================*/ +#ifndef BOOST_SPIRIT_CHSET_HPP +#define BOOST_SPIRIT_CHSET_HPP + +/////////////////////////////////////////////////////////////////////////////// +#include <boost/shared_ptr.hpp> +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/core/primitives/primitives.hpp> +#include <boost/spirit/home/classic/utility/impl/chset/basic_chset.hpp> + +/////////////////////////////////////////////////////////////////////////////// +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + +namespace utility { namespace impl { + + // This is here because some compilers choke on out-of-line member + // template functions. And we don't want to put the whole algorithm + // in the chset constructor in the class definition. + template <typename CharT, typename CharT2> + void construct_chset(boost::shared_ptr<basic_chset<CharT> >& ptr, + CharT2 const* definition); + +}} // namespace utility::impl + +/////////////////////////////////////////////////////////////////////////////// +// +// chset class +// +/////////////////////////////////////////////////////////////////////////////// +template <typename CharT = char> +class chset: public char_parser<chset<CharT> > { + +public: + chset(); + chset(chset const& arg_); + explicit chset(CharT arg_); + explicit chset(anychar_parser arg_); + explicit chset(nothing_parser arg_); + explicit chset(chlit<CharT> const& arg_); + explicit chset(range<CharT> const& arg_); + explicit chset(negated_char_parser<chlit<CharT> > const& arg_); + explicit chset(negated_char_parser<range<CharT> > const& arg_); + + template <typename CharT2> + explicit chset(CharT2 const* definition) + : ptr(new basic_chset<CharT>()) + { + utility::impl::construct_chset(ptr, definition); + } + ~chset(); + + chset& operator=(chset const& rhs); + chset& operator=(CharT rhs); + chset& operator=(anychar_parser rhs); + chset& operator=(nothing_parser rhs); + chset& operator=(chlit<CharT> const& rhs); + chset& operator=(range<CharT> const& rhs); + chset& operator=(negated_char_parser<chlit<CharT> > const& rhs); + chset& operator=(negated_char_parser<range<CharT> > const& rhs); + + void set(range<CharT> const& arg_); + void set(negated_char_parser<chlit<CharT> > const& arg_); + void set(negated_char_parser<range<CharT> > const& arg_); + + void clear(range<CharT> const& arg_); + void clear(negated_char_parser<range<CharT> > const& arg_); + bool test(CharT ch) const; + chset& inverse(); + void swap(chset& x); + + chset& operator|=(chset const& x); + chset& operator&=(chset const& x); + chset& operator-=(chset const& x); + chset& operator^=(chset const& x); + +private: + + boost::shared_ptr<basic_chset<CharT> > ptr; +}; + +/////////////////////////////////////////////////////////////////////////////// +// +// Generator functions +// +/////////////////////////////////////////////////////////////////////////////// +template <typename CharT> +inline chset<CharT> +chset_p(chlit<CharT> const& arg_) +{ return chset<CharT>(arg_); } + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +chset_p(range<CharT> const& arg_) +{ return chset<CharT>(arg_); } + +template <typename CharT> +inline chset<CharT> +chset_p(negated_char_parser<chlit<CharT> > const& arg_) +{ return chset<CharT>(arg_); } + +template <typename CharT> +inline chset<CharT> +chset_p(negated_char_parser<range<CharT> > const& arg_) +{ return chset<CharT>(arg_); } + +////////////////////////////////// +inline chset<char> +chset_p(char const* init) +{ return chset<char>(init); } + +////////////////////////////////// +inline chset<wchar_t> +chset_p(wchar_t const* init) +{ return chset<wchar_t>(init); } + +////////////////////////////////// +inline chset<char> +chset_p(char ch) +{ return chset<char>(ch); } + +////////////////////////////////// +inline chset<wchar_t> +chset_p(wchar_t ch) +{ return chset<wchar_t>(ch); } + +////////////////////////////////// +inline chset<int> +chset_p(int ch) +{ return chset<int>(ch); } + +////////////////////////////////// +inline chset<unsigned int> +chset_p(unsigned int ch) +{ return chset<unsigned int>(ch); } + +////////////////////////////////// +inline chset<short> +chset_p(short ch) +{ return chset<short>(ch); } + +#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) +////////////////////////////////// +inline chset<unsigned short> +chset_p(unsigned short ch) +{ return chset<unsigned short>(ch); } +#endif +////////////////////////////////// +inline chset<long> +chset_p(long ch) +{ return chset<long>(ch); } + +////////////////////////////////// +inline chset<unsigned long> +chset_p(unsigned long ch) +{ return chset<unsigned long>(ch); } + +#ifdef BOOST_HAS_LONG_LONG +////////////////////////////////// +inline chset< ::boost::long_long_type> +chset_p( ::boost::long_long_type ch) +{ return chset< ::boost::long_long_type>(ch); } + +////////////////////////////////// +inline chset< ::boost::ulong_long_type> +chset_p( ::boost::ulong_long_type ch) +{ return chset< ::boost::ulong_long_type>(ch); } +#endif + +/////////////////////////////////////////////////////////////////////////////// +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif + +#include <boost/spirit/home/classic/utility/impl/chset.ipp> +#include <boost/spirit/home/classic/utility/chset_operators.hpp> diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/utility/chset_operators.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/utility/chset_operators.hpp new file mode 100644 index 0000000..d42b5fa --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/utility/chset_operators.hpp @@ -0,0 +1,402 @@ +/*============================================================================= + Copyright (c) 2001-2003 Joel de Guzman + Copyright (c) 2001-2003 Daniel Nuffer + 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) +=============================================================================*/ +#ifndef BOOST_SPIRIT_CHSET_OPERATORS_HPP +#define BOOST_SPIRIT_CHSET_OPERATORS_HPP + +/////////////////////////////////////////////////////////////////////////////// +#include <boost/spirit/home/classic/namespace.hpp> +#include <boost/spirit/home/classic/utility/chset.hpp> + +/////////////////////////////////////////////////////////////////////////////// +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + +/////////////////////////////////////////////////////////////////////////////// +// +// chset free operators +// +// Where a and b are both chsets, implements: +// +// a | b, a & b, a - b, a ^ b +// +// Where a is a chset, implements: +// +// ~a +// +/////////////////////////////////////////////////////////////////////////////// +template <typename CharT> +chset<CharT> +operator~(chset<CharT> const& a); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator|(chset<CharT> const& a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator&(chset<CharT> const& a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator-(chset<CharT> const& a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator^(chset<CharT> const& a, chset<CharT> const& b); + +/////////////////////////////////////////////////////////////////////////////// +// +// range <--> chset free operators +// +// Where a is a chset and b is a range, and vice-versa, implements: +// +// a | b, a & b, a - b, a ^ b +// +/////////////////////////////////////////////////////////////////////////////// +template <typename CharT> +chset<CharT> +operator|(chset<CharT> const& a, range<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator&(chset<CharT> const& a, range<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator-(chset<CharT> const& a, range<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator^(chset<CharT> const& a, range<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator|(range<CharT> const& a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator&(range<CharT> const& a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator-(range<CharT> const& a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator^(range<CharT> const& a, chset<CharT> const& b); + +/////////////////////////////////////////////////////////////////////////////// +// +// chlit <--> chset free operators +// +// Where a is a chset and b is a chlit, and vice-versa, implements: +// +// a | b, a & b, a - b, a ^ b +// +/////////////////////////////////////////////////////////////////////////////// +template <typename CharT> +chset<CharT> +operator|(chset<CharT> const& a, chlit<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator&(chset<CharT> const& a, chlit<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator-(chset<CharT> const& a, chlit<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator^(chset<CharT> const& a, chlit<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator|(chlit<CharT> const& a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator&(chlit<CharT> const& a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator-(chlit<CharT> const& a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator^(chlit<CharT> const& a, chset<CharT> const& b); + +/////////////////////////////////////////////////////////////////////////////// +// +// negated_char_parser<range> <--> chset free operators +// +// Where a is a chset and b is a range, and vice-versa, implements: +// +// a | b, a & b, a - b, a ^ b +// +/////////////////////////////////////////////////////////////////////////////// +template <typename CharT> +chset<CharT> +operator|(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator&(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator-(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator^(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator|(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator&(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator-(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator^(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b); + +/////////////////////////////////////////////////////////////////////////////// +// +// negated_char_parser<chlit> <--> chset free operators +// +// Where a is a chset and b is a chlit, and vice-versa, implements: +// +// a | b, a & b, a - b, a ^ b +// +/////////////////////////////////////////////////////////////////////////////// +template <typename CharT> +chset<CharT> +operator|(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator&(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator-(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator^(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator|(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator&(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator-(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator^(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b); + +/////////////////////////////////////////////////////////////////////////////// +// +// literal primitives <--> chset free operators +// +// Where a is a chset and b is a literal primitive, +// and vice-versa, implements: +// +// a | b, a & b, a - b, a ^ b +// +/////////////////////////////////////////////////////////////////////////////// +template <typename CharT> +chset<CharT> +operator|(chset<CharT> const& a, CharT b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator&(chset<CharT> const& a, CharT b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator-(chset<CharT> const& a, CharT b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator^(chset<CharT> const& a, CharT b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator|(CharT a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator&(CharT a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator-(CharT a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator^(CharT a, chset<CharT> const& b); + +/////////////////////////////////////////////////////////////////////////////// +// +// anychar_parser <--> chset free operators +// +// Where a is chset and b is a anychar_parser, and vice-versa, implements: +// +// a | b, a & b, a - b, a ^ b +// +/////////////////////////////////////////////////////////////////////////////// +template <typename CharT> +chset<CharT> +operator|(chset<CharT> const& a, anychar_parser b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator&(chset<CharT> const& a, anychar_parser b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator-(chset<CharT> const& a, anychar_parser b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator^(chset<CharT> const& a, anychar_parser b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator|(anychar_parser a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator&(anychar_parser a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator-(anychar_parser a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator^(anychar_parser a, chset<CharT> const& b); + +/////////////////////////////////////////////////////////////////////////////// +// +// nothing_parser <--> chset free operators +// +// Where a is chset and b is nothing_parser, and vice-versa, implements: +// +// a | b, a & b, a - b, a ^ b +// +/////////////////////////////////////////////////////////////////////////////// +template <typename CharT> +chset<CharT> +operator|(chset<CharT> const& a, nothing_parser b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator&(chset<CharT> const& a, nothing_parser b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator-(chset<CharT> const& a, nothing_parser b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator^(chset<CharT> const& a, nothing_parser b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator|(nothing_parser a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator&(nothing_parser a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator-(nothing_parser a, chset<CharT> const& b); + +////////////////////////////////// +template <typename CharT> +chset<CharT> +operator^(nothing_parser a, chset<CharT> const& b); + +/////////////////////////////////////////////////////////////////////////////// +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif + +#include <boost/spirit/home/classic/utility/impl/chset_operators.ipp> diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/utility/impl/chset.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/utility/impl/chset.ipp new file mode 100644 index 0000000..3017035 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/utility/impl/chset.ipp @@ -0,0 +1,366 @@ +/*============================================================================= + Copyright (c) 2001-2003 Joel de Guzman + Copyright (c) 2001-2003 Daniel Nuffer + 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) +=============================================================================*/ +#ifndef BOOST_SPIRIT_CHSET_IPP +#define BOOST_SPIRIT_CHSET_IPP + +/////////////////////////////////////////////////////////////////////////////// +#include <boost/limits.hpp> +#include <boost/spirit/home/classic/utility/chset.hpp> + +/////////////////////////////////////////////////////////////////////////////// +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + +/////////////////////////////////////////////////////////////////////////////// +// +// chset class +// +/////////////////////////////////////////////////////////////////////////////// +namespace utility { namespace impl { + template <typename CharT> + inline void + detach(boost::shared_ptr<basic_chset<CharT> >& ptr) + { + if (!ptr.unique()) + ptr = boost::shared_ptr<basic_chset<CharT> > + (new basic_chset<CharT>(*ptr)); + } + + template <typename CharT> + inline void + detach_clear(boost::shared_ptr<basic_chset<CharT> >& ptr) + { + if (ptr.unique()) + ptr->clear(); + else + ptr.reset(new basic_chset<CharT>()); + } + + template <typename CharT, typename CharT2> + void construct_chset(boost::shared_ptr<basic_chset<CharT> >& ptr, + CharT2 const* definition) + { + CharT2 ch = *definition++; + while (ch) + { + CharT2 next = *definition++; + if (next == '-') + { + next = *definition++; + if (next == 0) + { + ptr->set(ch); + ptr->set('-'); + break; + } + ptr->set(ch, next); + } + else + { + ptr->set(ch); + } + ch = next; + } + } + + ////////////////////////////////// + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + + template <typename CharT, typename FakeT> + void chset_negated_set(boost::shared_ptr<basic_chset<CharT> > &ptr, chlit<CharT> const &ch, + FakeT) + { + if(ch.ch != (std::numeric_limits<CharT>::min)()) { + ptr->set((std::numeric_limits<CharT>::min)(), ch.ch - 1); + } + if(ch.ch != (std::numeric_limits<CharT>::max)()) { + ptr->set(ch.ch + 1, (std::numeric_limits<CharT>::max)()); + } + } + + template <typename CharT, typename FakeT> + void chset_negated_set(boost::shared_ptr<basic_chset<CharT> > &ptr, + spirit::range<CharT> const &rng, FakeT) + { + if(rng.first != (std::numeric_limits<CharT>::min)()) { + ptr->set((std::numeric_limits<CharT>::min)(), rng.first - 1); + } + if(rng.last != (std::numeric_limits<CharT>::max)()) { + ptr->set(rng.last + 1, (std::numeric_limits<CharT>::max)()); + } + } + +#endif // BOOST_WORKAROUND(BOOST_MSVC, < 1300) + +////////////////////////////////// + +}} // namespace utility::impl + +template <typename CharT> +inline chset<CharT>::chset() +: ptr(new basic_chset<CharT>()) {} + +template <typename CharT> +inline chset<CharT>::chset(chset const& arg_) +: ptr(new basic_chset<CharT>(*arg_.ptr)) {} + +template <typename CharT> +inline chset<CharT>::chset(CharT arg_) +: ptr(new basic_chset<CharT>()) +{ ptr->set(arg_); } + +template <typename CharT> +inline chset<CharT>::chset(anychar_parser /*arg*/) +: ptr(new basic_chset<CharT>()) +{ + ptr->set( + (std::numeric_limits<CharT>::min)(), + (std::numeric_limits<CharT>::max)() + ); +} + +template <typename CharT> +inline chset<CharT>::chset(nothing_parser arg_) +: ptr(new basic_chset<CharT>()) {} + +template <typename CharT> +inline chset<CharT>::chset(chlit<CharT> const& arg_) +: ptr(new basic_chset<CharT>()) +{ ptr->set(arg_.ch); } + +template <typename CharT> +inline chset<CharT>::chset(range<CharT> const& arg_) +: ptr(new basic_chset<CharT>()) +{ ptr->set(arg_.first, arg_.last); } + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + +template <typename CharT> +inline chset<CharT>::chset(negated_char_parser<chlit<CharT> > const& arg_) +: ptr(new basic_chset<CharT>()) +{ + set(arg_); +} + +template <typename CharT> +inline chset<CharT>::chset(negated_char_parser<range<CharT> > const& arg_) +: ptr(new basic_chset<CharT>()) +{ + set(arg_); +} + +#endif // !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + +template <typename CharT> +inline chset<CharT>::~chset() {} + +template <typename CharT> +inline chset<CharT>& +chset<CharT>::operator=(chset const& rhs) +{ + ptr = rhs.ptr; + return *this; +} + +template <typename CharT> +inline chset<CharT>& +chset<CharT>::operator=(CharT rhs) +{ + utility::impl::detach_clear(ptr); + ptr->set(rhs); + return *this; +} + +template <typename CharT> +inline chset<CharT>& +chset<CharT>::operator=(anychar_parser rhs) +{ + utility::impl::detach_clear(ptr); + ptr->set( + (std::numeric_limits<CharT>::min)(), + (std::numeric_limits<CharT>::max)() + ); + return *this; +} + +template <typename CharT> +inline chset<CharT>& +chset<CharT>::operator=(nothing_parser rhs) +{ + utility::impl::detach_clear(ptr); + return *this; +} + +template <typename CharT> +inline chset<CharT>& +chset<CharT>::operator=(chlit<CharT> const& rhs) +{ + utility::impl::detach_clear(ptr); + ptr->set(rhs.ch); + return *this; +} + +template <typename CharT> +inline chset<CharT>& +chset<CharT>::operator=(range<CharT> const& rhs) +{ + utility::impl::detach_clear(ptr); + ptr->set(rhs.first, rhs.last); + return *this; +} + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + +template <typename CharT> +inline chset<CharT>& +chset<CharT>::operator=(negated_char_parser<chlit<CharT> > const& rhs) +{ + utility::impl::detach_clear(ptr); + set(rhs); + return *this; +} + +template <typename CharT> +inline chset<CharT>& +chset<CharT>::operator=(negated_char_parser<range<CharT> > const& rhs) +{ + utility::impl::detach_clear(ptr); + set(rhs); + return *this; +} + +#endif // !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + +template <typename CharT> +inline void +chset<CharT>::set(range<CharT> const& arg_) +{ + utility::impl::detach(ptr); + ptr->set(arg_.first, arg_.last); +} + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + +template <typename CharT> +inline void +chset<CharT>::set(negated_char_parser<chlit<CharT> > const& arg_) +{ + utility::impl::detach(ptr); + + if(arg_.positive.ch != (std::numeric_limits<CharT>::min)()) { + ptr->set((std::numeric_limits<CharT>::min)(), arg_.positive.ch - 1); + } + if(arg_.positive.ch != (std::numeric_limits<CharT>::max)()) { + ptr->set(arg_.positive.ch + 1, (std::numeric_limits<CharT>::max)()); + } +} + +template <typename CharT> +inline void +chset<CharT>::set(negated_char_parser<range<CharT> > const& arg_) +{ + utility::impl::detach(ptr); + + if(arg_.positive.first != (std::numeric_limits<CharT>::min)()) { + ptr->set((std::numeric_limits<CharT>::min)(), arg_.positive.first - 1); + } + if(arg_.positive.last != (std::numeric_limits<CharT>::max)()) { + ptr->set(arg_.positive.last + 1, (std::numeric_limits<CharT>::max)()); + } +} + +#endif // !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + +template <typename CharT> +inline void +chset<CharT>::clear(range<CharT> const& arg_) +{ + utility::impl::detach(ptr); + ptr->clear(arg_.first, arg_.last); +} + +template <typename CharT> +inline void +chset<CharT>::clear(negated_char_parser<range<CharT> > const& arg_) +{ + utility::impl::detach(ptr); + + if(arg_.positive.first != (std::numeric_limits<CharT>::min)()) { + ptr->clear((std::numeric_limits<CharT>::min)(), arg_.positive.first - 1); + } + if(arg_.positive.last != (std::numeric_limits<CharT>::max)()) { + ptr->clear(arg_.positive.last + 1, (std::numeric_limits<CharT>::max)()); + } +} + +template <typename CharT> +inline bool +chset<CharT>::test(CharT ch) const +{ return ptr->test(ch); } + +template <typename CharT> +inline chset<CharT>& +chset<CharT>::inverse() +{ + utility::impl::detach(ptr); + ptr->inverse(); + return *this; +} + +template <typename CharT> +inline void +chset<CharT>::swap(chset& x) +{ ptr.swap(x.ptr); } + +template <typename CharT> +inline chset<CharT>& +chset<CharT>::operator|=(chset const& x) +{ + utility::impl::detach(ptr); + *ptr |= *x.ptr; + return *this; +} + +template <typename CharT> +inline chset<CharT>& +chset<CharT>::operator&=(chset const& x) +{ + utility::impl::detach(ptr); + *ptr &= *x.ptr; + return *this; +} + +template <typename CharT> +inline chset<CharT>& +chset<CharT>::operator-=(chset const& x) +{ + utility::impl::detach(ptr); + *ptr -= *x.ptr; + return *this; +} + +template <typename CharT> +inline chset<CharT>& +chset<CharT>::operator^=(chset const& x) +{ + utility::impl::detach(ptr); + *ptr ^= *x.ptr; + return *this; +} + +/////////////////////////////////////////////////////////////////////////////// +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit + +#endif + diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/utility/impl/chset/basic_chset.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/utility/impl/chset/basic_chset.hpp new file mode 100644 index 0000000..ace6501 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/utility/impl/chset/basic_chset.hpp @@ -0,0 +1,107 @@ +/*============================================================================= + Copyright (c) 2001-2003 Joel de Guzman + Copyright (c) 2001-2003 Daniel Nuffer + 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) +=============================================================================*/ +#ifndef BOOST_SPIRIT_BASIC_CHSET_HPP +#define BOOST_SPIRIT_BASIC_CHSET_HPP + +/////////////////////////////////////////////////////////////////////////////// +#include <bitset> +#include <climits> +#include <boost/spirit/home/classic/utility/impl/chset/range_run.hpp> +#include <boost/spirit/home/classic/namespace.hpp> + +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + /////////////////////////////////////////////////////////////////////////// + // + // basic_chset: basic character set implementation using range_run + // + /////////////////////////////////////////////////////////////////////////// + template <typename CharT> + class basic_chset + { + public: + basic_chset(); + basic_chset(basic_chset const& arg_); + + bool test(CharT v) const; + void set(CharT from, CharT to); + void set(CharT c); + void clear(CharT from, CharT to); + void clear(CharT c); + void clear(); + + void inverse(); + void swap(basic_chset& x); + + basic_chset& operator|=(basic_chset const& x); + basic_chset& operator&=(basic_chset const& x); + basic_chset& operator-=(basic_chset const& x); + basic_chset& operator^=(basic_chset const& x); + + private: utility::impl::range_run<CharT> rr; + }; + + #if (CHAR_BIT == 8) + + /////////////////////////////////////////////////////////////////////////// + // + // basic_chset: specializations for 8 bit chars using std::bitset + // + /////////////////////////////////////////////////////////////////////////// + template <typename CharT> + class basic_chset_8bit { + + public: + basic_chset_8bit(); + basic_chset_8bit(basic_chset_8bit const& arg_); + + bool test(CharT v) const; + void set(CharT from, CharT to); + void set(CharT c); + void clear(CharT from, CharT to); + void clear(CharT c); + void clear(); + + void inverse(); + void swap(basic_chset_8bit& x); + + basic_chset_8bit& operator|=(basic_chset_8bit const& x); + basic_chset_8bit& operator&=(basic_chset_8bit const& x); + basic_chset_8bit& operator-=(basic_chset_8bit const& x); + basic_chset_8bit& operator^=(basic_chset_8bit const& x); + + private: std::bitset<256> bset; + }; + + ///////////////////////////////// + template <> + class basic_chset<char> + : public basic_chset_8bit<char> {}; + + ///////////////////////////////// + template <> + class basic_chset<signed char> + : public basic_chset_8bit<signed char> {}; + + ///////////////////////////////// + template <> + class basic_chset<unsigned char> + : public basic_chset_8bit<unsigned char> {}; + +#endif + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS + +#endif + +#include <boost/spirit/home/classic/utility/impl/chset/basic_chset.ipp> diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/utility/impl/chset/basic_chset.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/utility/impl/chset/basic_chset.ipp new file mode 100644 index 0000000..e7d9272 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/utility/impl/chset/basic_chset.ipp @@ -0,0 +1,246 @@ +/*============================================================================= + Copyright (c) 2001-2003 Joel de Guzman + Copyright (c) 2001-2003 Daniel Nuffer + 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) +=============================================================================*/ +#ifndef BOOST_SPIRIT_BASIC_CHSET_IPP +#define BOOST_SPIRIT_BASIC_CHSET_IPP + +/////////////////////////////////////////////////////////////////////////////// +#include <bitset> +#include <boost/spirit/home/classic/utility/impl/chset/basic_chset.hpp> + +/////////////////////////////////////////////////////////////////////////////// +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + +/////////////////////////////////////////////////////////////////////////////// +// +// basic_chset: character set implementation +// +/////////////////////////////////////////////////////////////////////////////// +template <typename CharT> +inline basic_chset<CharT>::basic_chset() {} + +////////////////////////////////// +template <typename CharT> +inline basic_chset<CharT>::basic_chset(basic_chset const& arg_) +: rr(arg_.rr) {} + +////////////////////////////////// +template <typename CharT> +inline bool +basic_chset<CharT>::test(CharT v) const +{ return rr.test(v); } + +////////////////////////////////// +template <typename CharT> +inline void +basic_chset<CharT>::set(CharT from, CharT to) +{ rr.set(utility::impl::range<CharT>(from, to)); } + +////////////////////////////////// +template <typename CharT> +inline void +basic_chset<CharT>::set(CharT c) +{ rr.set(utility::impl::range<CharT>(c, c)); } + +////////////////////////////////// +template <typename CharT> +inline void +basic_chset<CharT>::clear(CharT from, CharT to) +{ rr.clear(utility::impl::range<CharT>(from, to)); } + +////////////////////////////////// +template <typename CharT> +inline void +basic_chset<CharT>::clear() +{ rr.clear(); } + +///////////////////////////////// +template <typename CharT> +inline void +basic_chset<CharT>::inverse() +{ + basic_chset inv; + inv.set( + (std::numeric_limits<CharT>::min)(), + (std::numeric_limits<CharT>::max)() + ); + inv -= *this; + swap(inv); +} + +///////////////////////////////// +template <typename CharT> +inline void +basic_chset<CharT>::swap(basic_chset& x) +{ rr.swap(x.rr); } + +///////////////////////////////// +template <typename CharT> +inline basic_chset<CharT>& +basic_chset<CharT>::operator|=(basic_chset<CharT> const& x) +{ + typedef typename utility::impl::range_run<CharT>::const_iterator const_iterator; + for (const_iterator iter = x.rr.begin(); iter != x.rr.end(); ++iter) + rr.set(*iter); + return *this; +} + +///////////////////////////////// +template <typename CharT> +inline basic_chset<CharT>& +basic_chset<CharT>::operator&=(basic_chset<CharT> const& x) +{ + basic_chset inv; + inv.set( + (std::numeric_limits<CharT>::min)(), + (std::numeric_limits<CharT>::max)() + ); + inv -= x; + *this -= inv; + return *this; +} + +///////////////////////////////// +template <typename CharT> +inline basic_chset<CharT>& +basic_chset<CharT>::operator-=(basic_chset<CharT> const& x) +{ + typedef typename utility::impl::range_run<CharT>::const_iterator const_iterator; + for (const_iterator iter = x.rr.begin(); iter != x.rr.end(); ++iter) + rr.clear(*iter); + return *this; +} + +///////////////////////////////// +template <typename CharT> +inline basic_chset<CharT>& +basic_chset<CharT>::operator^=(basic_chset<CharT> const& x) +{ + basic_chset bma = x; + bma -= *this; + *this -= x; + *this |= bma; + return *this; +} + +#if (CHAR_BIT == 8) + +/////////////////////////////////////////////////////////////////////////////// +// +// basic_chset: specializations for 8 bit chars using std::bitset +// +/////////////////////////////////////////////////////////////////////////////// +template <typename CharT> +inline basic_chset_8bit<CharT>::basic_chset_8bit() {} + +///////////////////////////////// +template <typename CharT> +inline basic_chset_8bit<CharT>::basic_chset_8bit(basic_chset_8bit const& arg_) +: bset(arg_.bset) {} + +///////////////////////////////// +template <typename CharT> +inline bool +basic_chset_8bit<CharT>::test(CharT v) const +{ return bset.test((unsigned char)v); } + +///////////////////////////////// +template <typename CharT> +inline void +basic_chset_8bit<CharT>::set(CharT from, CharT to) +{ + for (int i = from; i <= to; ++i) + bset.set((unsigned char)i); +} + +///////////////////////////////// +template <typename CharT> +inline void +basic_chset_8bit<CharT>::set(CharT c) +{ bset.set((unsigned char)c); } + +///////////////////////////////// +template <typename CharT> +inline void +basic_chset_8bit<CharT>::clear(CharT from, CharT to) +{ + for (int i = from; i <= to; ++i) + bset.reset((unsigned char)i); +} + +///////////////////////////////// +template <typename CharT> +inline void +basic_chset_8bit<CharT>::clear(CharT c) +{ bset.reset((unsigned char)c); } + +///////////////////////////////// +template <typename CharT> +inline void +basic_chset_8bit<CharT>::clear() +{ bset.reset(); } + +///////////////////////////////// +template <typename CharT> +inline void +basic_chset_8bit<CharT>::inverse() +{ bset.flip(); } + +///////////////////////////////// +template <typename CharT> +inline void +basic_chset_8bit<CharT>::swap(basic_chset_8bit& x) +{ std::swap(bset, x.bset); } + +///////////////////////////////// +template <typename CharT> +inline basic_chset_8bit<CharT>& +basic_chset_8bit<CharT>::operator|=(basic_chset_8bit const& x) +{ + bset |= x.bset; + return *this; +} + +///////////////////////////////// +template <typename CharT> +inline basic_chset_8bit<CharT>& +basic_chset_8bit<CharT>::operator&=(basic_chset_8bit const& x) +{ + bset &= x.bset; + return *this; +} + +///////////////////////////////// +template <typename CharT> +inline basic_chset_8bit<CharT>& +basic_chset_8bit<CharT>::operator-=(basic_chset_8bit const& x) +{ + bset &= ~x.bset; + return *this; +} + +///////////////////////////////// +template <typename CharT> +inline basic_chset_8bit<CharT>& +basic_chset_8bit<CharT>::operator^=(basic_chset_8bit const& x) +{ + bset ^= x.bset; + return *this; +} + +#endif + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit + +#endif + diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/utility/impl/chset/range_run.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/utility/impl/chset/range_run.hpp new file mode 100644 index 0000000..579bcae --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/utility/impl/chset/range_run.hpp @@ -0,0 +1,127 @@ +/*============================================================================= + Copyright (c) 2001-2003 Joel de Guzman + 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) +=============================================================================*/ +#ifndef BOOST_SPIRIT_RANGE_RUN_HPP +#define BOOST_SPIRIT_RANGE_RUN_HPP + +/////////////////////////////////////////////////////////////////////////////// +#include <vector> + +#include <boost/spirit/home/classic/namespace.hpp> + +/////////////////////////////////////////////////////////////////////////////// +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + +namespace utility { namespace impl { + + /////////////////////////////////////////////////////////////////////////// + // + // range class + // + // Implements a closed range of values. This class is used in + // the implementation of the range_run class. + // + // { Low level implementation detail } + // { Not to be confused with BOOST_SPIRIT_CLASSIC_NS::range } + // + /////////////////////////////////////////////////////////////////////////// + template <typename CharT> + struct range { + + range(CharT first, CharT last); + + bool is_valid() const; + bool includes(CharT v) const; + bool includes(range const& r) const; + bool overlaps(range const& r) const; + void merge(range const& r); + + CharT first; + CharT last; + }; + + ////////////////////////////////// + template <typename CharT> + struct range_char_compare { + + bool operator()(range<CharT> const& x, const CharT y) const + { return x.first < y; } + + bool operator()(const CharT x, range<CharT> const& y) const + { return x < y.first; } + + // This additional operator is required for the checked STL shipped + // with VC8 testing the ordering of the iterators passed to the + // std::lower_bound algo this range_char_compare<> predicate is passed + // to. + bool operator()(range<CharT> const& x, range<CharT> const& y) const + { return x.first < y.first; } + }; + + ////////////////////////////////// + template <typename CharT> + struct range_compare { + + bool operator()(range<CharT> const& x, range<CharT> const& y) const + { return x.first < y.first; } + }; + + /////////////////////////////////////////////////////////////////////////// + // + // range_run + // + // An implementation of a sparse bit (boolean) set. The set uses + // a sorted vector of disjoint ranges. This class implements the + // bare minimum essentials from which the full range of set + // operators can be implemented. The set is constructed from + // ranges. Internally, adjacent or overlapping ranges are + // coalesced. + // + // range_runs are very space-economical in situations where there + // are lots of ranges and a few individual disjoint values. + // Searching is O(log n) where n is the number of ranges. + // + // { Low level implementation detail } + // + /////////////////////////////////////////////////////////////////////////// + template <typename CharT> + class range_run { + + public: + + typedef range<CharT> range_t; + typedef std::vector<range_t> run_t; + typedef typename run_t::iterator iterator; + typedef typename run_t::const_iterator const_iterator; + + void swap(range_run& rr); + bool test(CharT v) const; + void set(range_t const& r); + void clear(range_t const& r); + void clear(); + + const_iterator begin() const; + const_iterator end() const; + + private: + + void merge(iterator iter, range_t const& r); + + run_t run; + }; + +}} + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace BOOST_SPIRIT_CLASSIC_NS::utility::impl + +#endif + +#include <boost/spirit/home/classic/utility/impl/chset/range_run.ipp> diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/utility/impl/chset/range_run.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/utility/impl/chset/range_run.ipp new file mode 100644 index 0000000..ede1567 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/utility/impl/chset/range_run.ipp @@ -0,0 +1,218 @@ +/*============================================================================= + Copyright (c) 2001-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) +=============================================================================*/ +#ifndef BOOST_SPIRIT_RANGE_RUN_IPP +#define BOOST_SPIRIT_RANGE_RUN_IPP + +/////////////////////////////////////////////////////////////////////////////// +#include <algorithm> // for std::lower_bound +#include <boost/spirit/home/classic/core/assert.hpp> // for BOOST_SPIRIT_ASSERT +#include <boost/spirit/home/classic/utility/impl/chset/range_run.hpp> +#include <boost/spirit/home/classic/debug.hpp> +#include <boost/limits.hpp> + +/////////////////////////////////////////////////////////////////////////////// +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + + namespace utility { namespace impl { + + /////////////////////////////////////////////////////////////////////// + // + // range class implementation + // + /////////////////////////////////////////////////////////////////////// + template <typename CharT> + inline range<CharT>::range(CharT first_, CharT last_) + : first(first_), last(last_) {} + + ////////////////////////////////// + template <typename CharT> + inline bool + range<CharT>::is_valid() const + { return first <= last; } + + ////////////////////////////////// + template <typename CharT> + inline bool + range<CharT>::includes(range const& r) const + { return (first <= r.first) && (last >= r.last); } + + ////////////////////////////////// + template <typename CharT> + inline bool + range<CharT>::includes(CharT v) const + { return (first <= v) && (last >= v); } + + ////////////////////////////////// + template <typename CharT> + inline bool + range<CharT>::overlaps(range const& r) const + { + CharT decr_first = + first == (std::numeric_limits<CharT>::min)() ? first : first-1; + CharT incr_last = + last == (std::numeric_limits<CharT>::max)() ? last : last+1; + + return (decr_first <= r.last) && (incr_last >= r.first); + } + + ////////////////////////////////// + template <typename CharT> + inline void + range<CharT>::merge(range const& r) + { + first = (std::min)(first, r.first); + last = (std::max)(last, r.last); + } + + /////////////////////////////////////////////////////////////////////// + // + // range_run class implementation + // + /////////////////////////////////////////////////////////////////////// + template <typename CharT> + inline bool + range_run<CharT>::test(CharT v) const + { + if (!run.empty()) + { + const_iterator iter = + std::lower_bound( + run.begin(), run.end(), v, + range_char_compare<CharT>() + ); + + if (iter != run.end() && iter->includes(v)) + return true; + if (iter != run.begin()) + return (--iter)->includes(v); + } + return false; + } + + ////////////////////////////////// + template <typename CharT> + inline void + range_run<CharT>::swap(range_run& rr) + { run.swap(rr.run); } + + ////////////////////////////////// + template <typename CharT> + void + range_run<CharT>::merge(iterator iter, range<CharT> const& r) + { + iter->merge(r); + iterator i = iter + 1; + + while (i != run.end() && iter->overlaps(*i)) + iter->merge(*i++); + + run.erase(iter+1, i); + } + + ////////////////////////////////// + template <typename CharT> + void + range_run<CharT>::set(range<CharT> const& r) + { + BOOST_SPIRIT_ASSERT(r.is_valid()); + if (!run.empty()) + { + iterator iter = + std::lower_bound( + run.begin(), run.end(), r, + range_compare<CharT>() + ); + + if ((iter != run.end() && iter->includes(r)) || + ((iter != run.begin()) && (iter - 1)->includes(r))) + return; + + if (iter != run.begin() && (iter - 1)->overlaps(r)) + merge(--iter, r); + + else if (iter != run.end() && iter->overlaps(r)) + merge(iter, r); + + else + run.insert(iter, r); + } + else + { + run.push_back(r); + } + } + + ////////////////////////////////// + template <typename CharT> + void + range_run<CharT>::clear(range<CharT> const& r) + { + BOOST_SPIRIT_ASSERT(r.is_valid()); + if (!run.empty()) + { + iterator iter = + std::lower_bound( + run.begin(), run.end(), r, + range_compare<CharT>() + ); + + iterator left_iter; + + if ((iter != run.begin()) && + (left_iter = (iter - 1))->includes(r.first)) + { + if (left_iter->last > r.last) + { + CharT save_last = left_iter->last; + left_iter->last = r.first-1; + run.insert(iter, range<CharT>(r.last+1, save_last)); + return; + } + else + { + left_iter->last = r.first-1; + } + } + + iterator i = iter; + while (i != run.end() && r.includes(*i)) + i++; + if (i != run.end() && i->includes(r.last)) + i->first = r.last+1; + run.erase(iter, i); + } + } + + ////////////////////////////////// + template <typename CharT> + inline void + range_run<CharT>::clear() + { run.clear(); } + + ////////////////////////////////// + template <typename CharT> + inline typename range_run<CharT>::const_iterator + range_run<CharT>::begin() const + { return run.begin(); } + + ////////////////////////////////// + template <typename CharT> + inline typename range_run<CharT>::const_iterator + range_run<CharT>::end() const + { return run.end(); } + + }} // namespace utility::impl + +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit + +#endif diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/utility/impl/chset_operators.ipp b/3rdParty/Boost/src/boost/spirit/home/classic/utility/impl/chset_operators.ipp new file mode 100644 index 0000000..4319c9b --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/utility/impl/chset_operators.ipp @@ -0,0 +1,666 @@ +/*============================================================================= + Copyright (c) 2001-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) +=============================================================================*/ +#ifndef BOOST_SPIRIT_CHSET_OPERATORS_IPP +#define BOOST_SPIRIT_CHSET_OPERATORS_IPP + +/////////////////////////////////////////////////////////////////////////////// +#include <boost/limits.hpp> + +/////////////////////////////////////////////////////////////////////////////// +namespace boost { namespace spirit { + +BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN + +/////////////////////////////////////////////////////////////////////////////// +// +// chset free operators implementation +// +/////////////////////////////////////////////////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator|(chset<CharT> const& a, chset<CharT> const& b) +{ + return chset<CharT>(a) |= b; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator-(chset<CharT> const& a, chset<CharT> const& b) +{ + return chset<CharT>(a) -= b; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator~(chset<CharT> const& a) +{ + return chset<CharT>(a).inverse(); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator&(chset<CharT> const& a, chset<CharT> const& b) +{ + return chset<CharT>(a) &= b; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator^(chset<CharT> const& a, chset<CharT> const& b) +{ + return chset<CharT>(a) ^= b; +} + +/////////////////////////////////////////////////////////////////////////////// +// +// range <--> chset free operators implementation +// +/////////////////////////////////////////////////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator|(chset<CharT> const& a, range<CharT> const& b) +{ + chset<CharT> a_(a); + a_.set(b); + return a_; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator&(chset<CharT> const& a, range<CharT> const& b) +{ + chset<CharT> a_(a); + if(b.first != (std::numeric_limits<CharT>::min)()) { + a_.clear(range<CharT>((std::numeric_limits<CharT>::min)(), b.first - 1)); + } + if(b.last != (std::numeric_limits<CharT>::max)()) { + a_.clear(range<CharT>(b.last + 1, (std::numeric_limits<CharT>::max)())); + } + return a_; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator-(chset<CharT> const& a, range<CharT> const& b) +{ + chset<CharT> a_(a); + a_.clear(b); + return a_; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator^(chset<CharT> const& a, range<CharT> const& b) +{ + return a ^ chset<CharT>(b); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator|(range<CharT> const& a, chset<CharT> const& b) +{ + chset<CharT> b_(b); + b_.set(a); + return b_; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator&(range<CharT> const& a, chset<CharT> const& b) +{ + chset<CharT> b_(b); + if(a.first != (std::numeric_limits<CharT>::min)()) { + b_.clear(range<CharT>((std::numeric_limits<CharT>::min)(), a.first - 1)); + } + if(a.last != (std::numeric_limits<CharT>::max)()) { + b_.clear(range<CharT>(a.last + 1, (std::numeric_limits<CharT>::max)())); + } + return b_; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator-(range<CharT> const& a, chset<CharT> const& b) +{ + return chset<CharT>(a) - b; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator^(range<CharT> const& a, chset<CharT> const& b) +{ + return chset<CharT>(a) ^ b; +} + +/////////////////////////////////////////////////////////////////////////////// +// +// literal primitives <--> chset free operators implementation +// +/////////////////////////////////////////////////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator|(chset<CharT> const& a, CharT b) +{ + return a | chset<CharT>(b); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator&(chset<CharT> const& a, CharT b) +{ + return a & chset<CharT>(b); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator-(chset<CharT> const& a, CharT b) +{ + return a - chset<CharT>(b); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator^(chset<CharT> const& a, CharT b) +{ + return a ^ chset<CharT>(b); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator|(CharT a, chset<CharT> const& b) +{ + return chset<CharT>(a) | b; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator&(CharT a, chset<CharT> const& b) +{ + return chset<CharT>(a) & b; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator-(CharT a, chset<CharT> const& b) +{ + return chset<CharT>(a) - b; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator^(CharT a, chset<CharT> const& b) +{ + return chset<CharT>(a) ^ b; +} + +/////////////////////////////////////////////////////////////////////////////// +// +// chlit <--> chset free operators implementation +// +/////////////////////////////////////////////////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator|(chset<CharT> const& a, chlit<CharT> const& b) +{ + return a | chset<CharT>(b.ch); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator&(chset<CharT> const& a, chlit<CharT> const& b) +{ + return a & chset<CharT>(b.ch); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator-(chset<CharT> const& a, chlit<CharT> const& b) +{ + return a - chset<CharT>(b.ch); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator^(chset<CharT> const& a, chlit<CharT> const& b) +{ + return a ^ chset<CharT>(b.ch); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator|(chlit<CharT> const& a, chset<CharT> const& b) +{ + return chset<CharT>(a.ch) | b; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator&(chlit<CharT> const& a, chset<CharT> const& b) +{ + return chset<CharT>(a.ch) & b; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator-(chlit<CharT> const& a, chset<CharT> const& b) +{ + return chset<CharT>(a.ch) - b; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator^(chlit<CharT> const& a, chset<CharT> const& b) +{ + return chset<CharT>(a.ch) ^ b; +} + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + +/////////////////////////////////////////////////////////////////////////////// +// +// negated_char_parser <--> chset free operators implementation +// +/////////////////////////////////////////////////////////////////////////////// +template <typename CharT, typename ParserT> +inline chset<CharT> +operator|(chset<CharT> const& a, negated_char_parser<ParserT> const& b) +{ + return a | chset<CharT>(b); +} + +////////////////////////////////// +template <typename CharT, typename ParserT> +inline chset<CharT> +operator&(chset<CharT> const& a, negated_char_parser<ParserT> const& b) +{ + return a & chset<CharT>(b); +} + +////////////////////////////////// +template <typename CharT, typename ParserT> +inline chset<CharT> +operator-(chset<CharT> const& a, negated_char_parser<ParserT> const& b) +{ + return a - chset<CharT>(b); +} + +////////////////////////////////// +template <typename CharT, typename ParserT> +inline chset<CharT> +operator^(chset<CharT> const& a, negated_char_parser<ParserT> const& b) +{ + return a ^ chset<CharT>(b); +} + +////////////////////////////////// +template <typename CharT, typename ParserT> +inline chset<CharT> +operator|(negated_char_parser<ParserT> const& a, chset<CharT> const& b) +{ + return chset<CharT>(a) | b; +} + +////////////////////////////////// +template <typename CharT, typename ParserT> +inline chset<CharT> +operator&(negated_char_parser<ParserT> const& a, chset<CharT> const& b) +{ + return chset<CharT>(a) & b; +} + +////////////////////////////////// +template <typename CharT, typename ParserT> +inline chset<CharT> +operator-(negated_char_parser<ParserT> const& a, chset<CharT> const& b) +{ + return chset<CharT>(a) - b; +} + +////////////////////////////////// +template <typename CharT, typename ParserT> +inline chset<CharT> +operator^(negated_char_parser<ParserT> const& a, chset<CharT> const& b) +{ + return chset<CharT>(a) ^ b; +} + +#else // BOOST_WORKAROUND(BOOST_MSVC, < 1300) + +/////////////////////////////////////////////////////////////////////////////// +// +// negated_char_parser<range> <--> chset free operators implementation +// +/////////////////////////////////////////////////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator|(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b) +{ + return a | chset<CharT>(b); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator&(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b) +{ + return a & chset<CharT>(b); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator-(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b) +{ + return a - chset<CharT>(b); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator^(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b) +{ + return a ^ chset<CharT>(b); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator|(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b) +{ + return chset<CharT>(a) | b; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator&(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b) +{ + return chset<CharT>(a) & b; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator-(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b) +{ + return chset<CharT>(a) - b; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator^(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b) +{ + return chset<CharT>(a) ^ b; +} + +/////////////////////////////////////////////////////////////////////////////// +// +// negated_char_parser<chlit> <--> chset free operators implementation +// +/////////////////////////////////////////////////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator|(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b) +{ + return a | chset<CharT>(b); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator&(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b) +{ + return a & chset<CharT>(b); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator-(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b) +{ + return a - chset<CharT>(b); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator^(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b) +{ + return a ^ chset<CharT>(b); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator|(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b) +{ + return chset<CharT>(a) | b; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator&(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b) +{ + return chset<CharT>(a) & b; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator-(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b) +{ + return chset<CharT>(a) - b; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator^(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b) +{ + return chset<CharT>(a) ^ b; +} + +#endif // BOOST_WORKAROUND(BOOST_MSVC, < 1300) + +/////////////////////////////////////////////////////////////////////////////// +// +// anychar_parser <--> chset free operators +// +// Where a is chset and b is a anychar_parser, and vice-versa, implements: +// +// a | b, a & b, a - b, a ^ b +// +/////////////////////////////////////////////////////////////////////////////// +namespace impl { + + template <typename CharT> + inline BOOST_SPIRIT_CLASSIC_NS::range<CharT> const& + full() + { + static BOOST_SPIRIT_CLASSIC_NS::range<CharT> full_( + (std::numeric_limits<CharT>::min)(), + (std::numeric_limits<CharT>::max)()); + return full_; + } + + template <typename CharT> + inline BOOST_SPIRIT_CLASSIC_NS::range<CharT> const& + empty() + { + static BOOST_SPIRIT_CLASSIC_NS::range<CharT> empty_; + return empty_; + } +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator|(chset<CharT> const&, anychar_parser) +{ + return chset<CharT>(impl::full<CharT>()); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator&(chset<CharT> const& a, anychar_parser) +{ + return a; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator-(chset<CharT> const&, anychar_parser) +{ + return chset<CharT>(); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator^(chset<CharT> const& a, anychar_parser) +{ + return ~a; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator|(anychar_parser, chset<CharT> const& /*b*/) +{ + return chset<CharT>(impl::full<CharT>()); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator&(anychar_parser, chset<CharT> const& b) +{ + return b; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator-(anychar_parser, chset<CharT> const& b) +{ + return ~b; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator^(anychar_parser, chset<CharT> const& b) +{ + return ~b; +} + +/////////////////////////////////////////////////////////////////////////////// +// +// nothing_parser <--> chset free operators implementation +// +/////////////////////////////////////////////////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator|(chset<CharT> const& a, nothing_parser) +{ + return a; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator&(chset<CharT> const& /*a*/, nothing_parser) +{ + return impl::empty<CharT>(); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator-(chset<CharT> const& a, nothing_parser) +{ + return a; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator^(chset<CharT> const& a, nothing_parser) +{ + return a; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator|(nothing_parser, chset<CharT> const& b) +{ + return b; +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator&(nothing_parser, chset<CharT> const& /*b*/) +{ + return impl::empty<CharT>(); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator-(nothing_parser, chset<CharT> const& /*b*/) +{ + return impl::empty<CharT>(); +} + +////////////////////////////////// +template <typename CharT> +inline chset<CharT> +operator^(nothing_parser, chset<CharT> const& b) +{ + return b; +} + +/////////////////////////////////////////////////////////////////////////////// +BOOST_SPIRIT_CLASSIC_NAMESPACE_END + +}} // namespace boost::spirit + +#endif + diff --git a/3rdParty/Boost/src/boost/spirit/home/classic/version.hpp b/3rdParty/Boost/src/boost/spirit/home/classic/version.hpp new file mode 100644 index 0000000..77371ed --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/classic/version.hpp @@ -0,0 +1,30 @@ +/*============================================================================= + Copyright (c) 2001-2003 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(SPIRIT_CLASSIC_VERSION_HPP) +#define SPIRIT_CLASSIC_VERSION_HPP + +/////////////////////////////////////////////////////////////////////////////// +// +// This checks, whether the used Boost library is at least V1.32.0 +// +/////////////////////////////////////////////////////////////////////////////// +#include <boost/version.hpp> + +#if BOOST_VERSION < 103200 +#error "Spirit v1.8.x needs at least Boost V1.32.0 to compile successfully." +#endif + +/////////////////////////////////////////////////////////////////////////////// +// +// This is the version of the current Spirit distribution +// +/////////////////////////////////////////////////////////////////////////////// +#define SPIRIT_VERSION 0x1806 +#define SPIRIT_PIZZA_VERSION SPIRIT_MEGA_VEGGI // :-) + +#endif // defined(SPIRIT_VERSION_HPP) diff --git a/3rdParty/Boost/src/boost/spirit/include/classic_actions.hpp b/3rdParty/Boost/src/boost/spirit/include/classic_actions.hpp new file mode 100644 index 0000000..a37d631 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/include/classic_actions.hpp @@ -0,0 +1,12 @@ +/*============================================================================= + Copyright (c) 2001-2008 Joel de Guzman + Copyright (c) 2001-2008 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) +=============================================================================*/ +#ifndef BOOST_SPIRIT_INCLUDE_CLASSIC_CLASSIC_ACTIONS +#define BOOST_SPIRIT_INCLUDE_CLASSIC_CLASSIC_ACTIONS +#include <boost/spirit/home/classic/core/composite/actions.hpp> +#endif diff --git a/3rdParty/Boost/src/boost/spirit/include/classic_chset.hpp b/3rdParty/Boost/src/boost/spirit/include/classic_chset.hpp new file mode 100644 index 0000000..2f8df49 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/include/classic_chset.hpp @@ -0,0 +1,12 @@ +/*============================================================================= + Copyright (c) 2001-2008 Joel de Guzman + Copyright (c) 2001-2008 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) +=============================================================================*/ +#ifndef BOOST_SPIRIT_INCLUDE_CLASSIC_CHSET +#define BOOST_SPIRIT_INCLUDE_CLASSIC_CHSET +#include <boost/spirit/home/classic/utility/chset.hpp> +#endif diff --git a/3rdParty/Boost/src/boost/spirit/include/classic_numerics.hpp b/3rdParty/Boost/src/boost/spirit/include/classic_numerics.hpp new file mode 100644 index 0000000..75f7c05 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/include/classic_numerics.hpp @@ -0,0 +1,12 @@ +/*============================================================================= + Copyright (c) 2001-2008 Joel de Guzman + Copyright (c) 2001-2008 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) +=============================================================================*/ +#ifndef BOOST_SPIRIT_INCLUDE_CLASSIC_NUMERICS +#define BOOST_SPIRIT_INCLUDE_CLASSIC_NUMERICS +#include <boost/spirit/home/classic/core/primitives/numerics.hpp> +#endif diff --git a/3rdParty/Boost/src/boost/spirit/include/classic_operators.hpp b/3rdParty/Boost/src/boost/spirit/include/classic_operators.hpp new file mode 100644 index 0000000..c05d947 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/include/classic_operators.hpp @@ -0,0 +1,12 @@ +/*============================================================================= + Copyright (c) 2001-2008 Joel de Guzman + Copyright (c) 2001-2008 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) +=============================================================================*/ +#ifndef BOOST_SPIRIT_INCLUDE_CLASSIC_OPERATORS +#define BOOST_SPIRIT_INCLUDE_CLASSIC_OPERATORS +#include <boost/spirit/home/classic/core/composite/operators.hpp> +#endif diff --git a/3rdParty/Boost/src/boost/spirit/include/classic_rule.hpp b/3rdParty/Boost/src/boost/spirit/include/classic_rule.hpp new file mode 100644 index 0000000..c2e0df1 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/include/classic_rule.hpp @@ -0,0 +1,12 @@ +/*============================================================================= + Copyright (c) 2001-2008 Joel de Guzman + Copyright (c) 2001-2008 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) +=============================================================================*/ +#ifndef BOOST_SPIRIT_INCLUDE_CLASSIC_RULE +#define BOOST_SPIRIT_INCLUDE_CLASSIC_RULE +#include <boost/spirit/home/classic/core/non_terminal/rule.hpp> +#endif |