diff options
author | Vlad Voicu <vladv@rosedu.org> | 2012-03-02 10:01:11 (GMT) |
---|---|---|
committer | vlad <vlad@tyrion.(none)> | 2012-10-13 13:55:44 (GMT) |
commit | b21e43357c66df6824536793bf41bbd1cbdf1a72 (patch) | |
tree | a23ee2adda43c27aa1b720f524e368991264182c /3rdParty/Boost/src/boost/spirit/home/qi/parser.hpp | |
parent | 58efe2c43e54a3d868784a6968e52674309e2310 (diff) | |
download | swift-contrib-b21e43357c66df6824536793bf41bbd1cbdf1a72.zip swift-contrib-b21e43357c66df6824536793bf41bbd1cbdf1a72.tar.bz2 |
Added spirit to bundled boost
Diffstat (limited to '3rdParty/Boost/src/boost/spirit/home/qi/parser.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/spirit/home/qi/parser.hpp | 140 |
1 files changed, 140 insertions, 0 deletions
diff --git a/3rdParty/Boost/src/boost/spirit/home/qi/parser.hpp b/3rdParty/Boost/src/boost/spirit/home/qi/parser.hpp new file mode 100644 index 0000000..ffd8bc9 --- /dev/null +++ b/3rdParty/Boost/src/boost/spirit/home/qi/parser.hpp @@ -0,0 +1,140 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_SPIRIT_PARSER_OCTOBER_16_2008_0254PM) +#define BOOST_SPIRIT_PARSER_OCTOBER_16_2008_0254PM + +#if defined(_MSC_VER) +#pragma once +#endif + +#include <boost/mpl/has_xxx.hpp> +#include <boost/spirit/home/qi/domain.hpp> + +namespace boost { namespace spirit { namespace qi +{ + + //[parser_base_parser + template <typename Derived> + struct parser + { + struct parser_id; + typedef Derived derived_type; + typedef qi::domain domain; + + // Requirement: p.parse(f, l, context, skip, attr) -> bool + // + // p: a parser + // f, l: first/last iterator pair + // context: enclosing rule context (can be unused_type) + // skip: skipper (can be unused_type) + // attr: attribute (can be unused_type) + + // Requirement: p.what(context) -> info + // + // p: a parser + // context: enclosing rule context (can be unused_type) + + // Requirement: P::template attribute<Ctx, Iter>::type + // + // P: a parser type + // Ctx: A context type (can be unused_type) + // Iter: An iterator type (can be unused_type) + + Derived const& derived() const + { + return *static_cast<Derived const*>(this); + } + }; + //] + + template <typename Derived> + struct primitive_parser : parser<Derived> + { + struct primitive_parser_id; + }; + + template <typename Derived> + struct nary_parser : parser<Derived> + { + struct nary_parser_id; + + // Requirement: p.elements -> fusion sequence + // + // p: a composite parser + + // Requirement: P::elements_type -> fusion sequence + // + // P: a composite parser type + }; + + template <typename Derived> + struct unary_parser : parser<Derived> + { + struct unary_parser_id; + + // Requirement: p.subject -> subject parser + // + // p: a unary parser + + // Requirement: P::subject_type -> subject parser type + // + // P: a unary parser type + }; + + template <typename Derived> + struct binary_parser : parser<Derived> + { + struct binary_parser_id; + + // Requirement: p.left -> left parser + // + // p: a binary parser + + // Requirement: P::left_type -> left parser type + // + // P: a binary parser type + + // Requirement: p.right -> right parser + // + // p: a binary parser + + // Requirement: P::right_type -> right parser type + // + // P: a binary parser type + }; +}}} + +namespace boost { namespace spirit { namespace traits // classification +{ + namespace detail + { + BOOST_MPL_HAS_XXX_TRAIT_DEF(parser_id) + BOOST_MPL_HAS_XXX_TRAIT_DEF(primitive_parser_id) + BOOST_MPL_HAS_XXX_TRAIT_DEF(nary_parser_id) + BOOST_MPL_HAS_XXX_TRAIT_DEF(unary_parser_id) + BOOST_MPL_HAS_XXX_TRAIT_DEF(binary_parser_id) + } + + // parser type identification + template <typename T> + struct is_parser : detail::has_parser_id<T> {}; + + template <typename T> + struct is_primitive_parser : detail::has_primitive_parser_id<T> {}; + + template <typename T> + struct is_nary_parser : detail::has_nary_parser_id<T> {}; + + template <typename T> + struct is_unary_parser : detail::has_unary_parser_id<T> {}; + + template <typename T> + struct is_binary_parser : detail::has_binary_parser_id<T> {}; + +}}} + +#endif |