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/home/classic/core/composite | |
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/home/classic/core/composite')
27 files changed, 3459 insertions, 0 deletions
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> |