Chris@102: /*============================================================================= Chris@102: Copyright (c) 2001-2014 Joel de Guzman Chris@102: Chris@102: Distributed under the Boost Software License, Version 1.0. (See accompanying Chris@102: file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@102: =============================================================================*/ Chris@102: #if !defined(SPIRIT_SEQUENCE_JAN_06_2013_1015AM) Chris@102: #define SPIRIT_SEQUENCE_JAN_06_2013_1015AM Chris@102: Chris@102: #if defined(_MSC_VER) Chris@102: #pragma once Chris@102: #endif Chris@102: Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: Chris@102: namespace boost { namespace spirit { namespace x3 Chris@102: { Chris@102: template Chris@102: struct sequence : binary_parser> Chris@102: { Chris@102: typedef binary_parser> base_type; Chris@102: Chris@102: sequence(Left left, Right right) Chris@102: : base_type(left, right) {} Chris@102: Chris@102: template Chris@102: bool parse( Chris@102: Iterator& first, Iterator const& last Chris@102: , Context const& context, RContext& rcontext, unused_type) const Chris@102: { Chris@102: Iterator save = first; Chris@102: if (this->left.parse(first, last, context, rcontext, unused) Chris@102: && this->right.parse(first, last, context, rcontext, unused)) Chris@102: return true; Chris@102: first = save; Chris@102: return false; Chris@102: } Chris@102: Chris@102: template Chris@102: bool parse( Chris@102: Iterator& first, Iterator const& last Chris@102: , Context const& context, RContext& rcontext, Attribute& attr) const Chris@102: { Chris@102: return detail::parse_sequence(*this, first, last, context, rcontext, attr Chris@102: , typename traits::attribute_category::type()); Chris@102: } Chris@102: }; Chris@102: Chris@102: template Chris@102: inline sequence< Chris@102: typename extension::as_parser::value_type Chris@102: , typename extension::as_parser::value_type> Chris@102: operator>>(Left const& left, Right const& right) Chris@102: { Chris@102: return {as_parser(left), as_parser(right)}; Chris@102: } Chris@102: Chris@102: template Chris@102: inline sequence< Chris@102: typename extension::as_parser::value_type Chris@102: , expect_directive::value_type>> Chris@102: operator>(Left const& left, Right const& right) Chris@102: { Chris@102: return {as_parser(left), as_parser(right)}; Chris@102: } Chris@102: }}} Chris@102: Chris@102: namespace boost { namespace spirit { namespace x3 { namespace traits Chris@102: { Chris@102: template Chris@102: struct attribute_of, Context> Chris@102: : x3::detail::attribute_of_sequence {}; Chris@102: }}}} Chris@102: Chris@102: #endif