/*============================================================================= Copyright (c) 2001-2014 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(SPIRIT_ALTERNATIVE_JAN_07_2013_1131AM) #define SPIRIT_ALTERNATIVE_JAN_07_2013_1131AM #include #include #include namespace boost { namespace spirit { namespace x3 { template struct alternative : binary_parser> { typedef binary_parser> base_type; alternative(Left const& left, Right const& right) : base_type(left, right) {} template bool parse( Iterator& first, Iterator const& last , Context const& context, RContext& rcontext, unused_type) const { return this->left.parse(first, last, context, rcontext, unused) || this->right.parse(first, last, context, rcontext, unused); } template bool parse( Iterator& first, Iterator const& last , Context const& context, RContext& rcontext, Attribute& attr) const { return detail::parse_alternative(this->left, first, last, context, rcontext, attr) || detail::parse_alternative(this->right, first, last, context, rcontext, attr); } }; template inline alternative< typename extension::as_parser::value_type , typename extension::as_parser::value_type> operator|(Left const& left, Right const& right) { return { as_parser(left), as_parser(right) }; } }}} namespace boost { namespace spirit { namespace x3 { namespace traits { template struct attribute_of, Context> : x3::detail::attribute_of_alternative {}; }}}} #endif