/*============================================================================= Copyright (c) 2001-2011 Joel de Guzman Copyright (c) 2001-2011 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_PARSE_APRIL_16_2006_0442PM) #define BOOST_SPIRIT_PARSE_APRIL_16_2006_0442PM #if defined(_MSC_VER) #pragma once #endif #include #include #include #include namespace boost { namespace spirit { namespace qi { /////////////////////////////////////////////////////////////////////////// template inline bool parse( Iterator& first , Iterator last , Expr const& 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 parse( Iterator const& first_ , Iterator last , Expr const& expr) { Iterator first = first_; return qi::parse(first, last, expr); } /////////////////////////////////////////////////////////////////////////// namespace detail { template struct make_context { typedef context, locals<> > type; }; template <> struct make_context { typedef unused_type type; }; } template inline bool parse( Iterator& first , Iterator last , Expr const& expr , Attr& attr) { // 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)); // Report invalid expression error as early as possible. // If you got an error_invalid_expression error message here, // then the expression (expr) is not a valid spirit qi expression. BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr); typename detail::make_context::type context(attr); return compile(expr).parse(first, last, context, unused, attr); } template inline bool parse( Iterator const& first_ , Iterator last , Expr const& expr , Attr& attr) { Iterator first = first_; return qi::parse(first, last, expr, attr); } /////////////////////////////////////////////////////////////////////////// template inline bool phrase_parse( Iterator& first , Iterator last , Expr const& 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); } template inline bool phrase_parse( Iterator const& first_ , Iterator last , Expr const& expr , Skipper const& skipper , BOOST_SCOPED_ENUM(skip_flag) post_skip = skip_flag::postskip) { Iterator first = first_; return qi::phrase_parse(first, last, expr, skipper, post_skip); } /////////////////////////////////////////////////////////////////////////// template inline bool phrase_parse( Iterator& first , Iterator last , Expr const& expr , Skipper const& skipper , BOOST_SCOPED_ENUM(skip_flag) post_skip , Attr& attr) { // 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)); // Report invalid expression error as early as possible. // If you got an error_invalid_expression error message here, // then either the expression (expr) or skipper is not a valid // spirit qi expression. BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr); BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper); typedef typename result_of::compile::type skipper_type; skipper_type const skipper_ = compile(skipper); typename detail::make_context::type context(attr); if (!compile(expr).parse( first, last, context, skipper_, attr)) return false; if (post_skip == skip_flag::postskip) qi::skip_over(first, last, skipper_); return true; } template inline bool phrase_parse( Iterator const& first_ , Iterator last , Expr const& expr , Skipper const& skipper , BOOST_SCOPED_ENUM(skip_flag) post_skip , Attr& attr) { Iterator first = first_; return qi::phrase_parse(first, last, expr, skipper, post_skip, attr); } /////////////////////////////////////////////////////////////////////////// template inline bool phrase_parse( Iterator& first , Iterator last , Expr const& expr , Skipper const& skipper , Attr& attr) { return qi::phrase_parse(first, last, expr, skipper, skip_flag::postskip, attr); } template inline bool phrase_parse( Iterator const& first_ , Iterator last , Expr const& expr , Skipper const& skipper , Attr& attr) { Iterator first = first_; return qi::phrase_parse(first, last, expr, skipper, skip_flag::postskip, attr); } }}} #endif