/*============================================================================= Copyright (c) 2001-2010 Hartmut Kaiser Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #if !defined(BOOST_SPIRIT_DETAIL_PARSE_AUTO_DEC_02_2009_0426PM) #define BOOST_SPIRIT_DETAIL_PARSE_AUTO_DEC_02_2009_0426PM #if defined(_MSC_VER) #pragma once #endif #include #include #include #include #include namespace boost { namespace spirit { namespace qi { namespace detail { /////////////////////////////////////////////////////////////////////////// template struct parse_impl , mpl::not_ > > >::type> { template static bool call(Iterator& first, Iterator last, Expr& expr) { return qi::parse(first, last, create_parser(), expr); } template static bool call(Iterator& first, Iterator last, Expr const& expr) { return qi::parse(first, last, create_parser() , const_cast(expr)); } }; // the following specializations are needed to explicitly disambiguate // the two possible specializations for parse_impl and // parse_impl template <> struct parse_impl { template static bool call(Iterator& first, Iterator last, char& expr) { return qi::parse(first, last, create_parser(), expr); } template static bool call(Iterator& first, Iterator last, char const&) { return qi::parse(first, last, create_parser()); } }; template <> struct parse_impl { template static bool call(Iterator& first, Iterator last, wchar_t& expr) { return qi::parse(first, last, create_parser(), expr); } template static bool call(Iterator& first, Iterator last, wchar_t const&) { return qi::parse(first, last, create_parser()); } }; /////////////////////////////////////////////////////////////////////////// template struct phrase_parse_impl , mpl::not_ > > >::type> { template static bool call(Iterator& first, Iterator last, Expr& expr , Skipper const& skipper, BOOST_SCOPED_ENUM(skip_flag) post_skip) { return qi::phrase_parse(first, last, create_parser() , skipper, post_skip, expr); } template static bool call(Iterator& first, Iterator last, Expr const& expr , Skipper const& skipper, BOOST_SCOPED_ENUM(skip_flag) post_skip) { return qi::phrase_parse(first, last, create_parser() , skipper, post_skip, const_cast(expr)); } }; // the following specializations are needed to explicitly disambiguate // the two possible specializations for phrase_parse_impl and // phrase_parse_impl template <> struct phrase_parse_impl { template static bool call(Iterator& first, Iterator last, char& expr , Skipper const& skipper, BOOST_SCOPED_ENUM(skip_flag) post_skip) { return qi::phrase_parse(first, last, create_parser() , skipper, post_skip, expr); } template static bool call(Iterator& first, Iterator last, char const& , Skipper const& skipper, BOOST_SCOPED_ENUM(skip_flag) post_skip) { return qi::phrase_parse(first, last, create_parser() , skipper, post_skip); } }; template <> struct phrase_parse_impl { template static bool call(Iterator& first, Iterator last, wchar_t& expr , Skipper const& skipper, BOOST_SCOPED_ENUM(skip_flag) post_skip) { return qi::phrase_parse(first, last, create_parser() , skipper, post_skip, expr); } template static bool call(Iterator& first, Iterator last, wchar_t const& , Skipper const& skipper, BOOST_SCOPED_ENUM(skip_flag) post_skip) { return qi::phrase_parse(first, last, create_parser() , skipper, post_skip); } }; }}}} namespace boost { namespace spirit { namespace qi { /////////////////////////////////////////////////////////////////////////// template inline bool parse( Iterator& first , Iterator last , Expr& expr) { // Make sure the iterator is at least a forward_iterator. If you got a // compilation error here, then you are using an input_iterator while // calling this function, you need to supply at least a // forward_iterator instead. BOOST_CONCEPT_ASSERT((ForwardIterator)); return detail::parse_impl::call(first, last, expr); } /////////////////////////////////////////////////////////////////////////// template inline bool phrase_parse( Iterator& first , Iterator last , Expr& expr , Skipper const& skipper , BOOST_SCOPED_ENUM(skip_flag) post_skip = skip_flag::postskip) { // Make sure the iterator is at least a forward_iterator. If you got a // compilation error here, then you are using an input_iterator while // calling this function, you need to supply at least a // forward_iterator instead. BOOST_CONCEPT_ASSERT((ForwardIterator)); return detail::phrase_parse_impl::call( first, last, expr, skipper, post_skip); } }}} #endif