File indexing completed on 2025-01-31 10:02:38
0001
0002
0003
0004
0005
0006
0007 #if !defined(BOOST_SPIRIT_X3__ANNOTATE_ON_SUCCESS_HPP)
0008 #define BOOST_SPIRIT_X3__ANNOTATE_ON_SUCCESS_HPP
0009
0010 #include <boost/spirit/home/x3/support/ast/variant.hpp>
0011 #include <boost/spirit/home/x3/support/context.hpp>
0012 #include <boost/spirit/home/x3/support/utility/error_reporting.hpp>
0013 #include <boost/spirit/home/x3/support/utility/lambda_visitor.hpp>
0014 #include <boost/spirit/home/x3/support/traits/is_variant.hpp>
0015
0016 namespace boost { namespace spirit { namespace x3
0017 {
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 struct annotate_on_success
0031 {
0032 template <typename Iterator, typename Context, typename... Types>
0033 inline void on_success(Iterator const& first, Iterator const& last
0034 , variant<Types...>& ast, Context const& context)
0035 {
0036 ast.apply_visitor(x3::make_lambda_visitor<void>([&](auto& node)
0037 {
0038 this->on_success(first, last, node, context);
0039 }));
0040 }
0041
0042 template <typename T, typename Iterator, typename Context>
0043 inline void on_success(Iterator const& first, Iterator const& last
0044 , forward_ast<T>& ast, Context const& context)
0045 {
0046 this->on_success(first, last, ast.get(), context);
0047 }
0048
0049 template <typename T, typename Iterator, typename Context>
0050 inline typename disable_if<traits::is_variant<T>>::type on_success(Iterator const& first, Iterator const& last
0051 , T& ast, Context const& context)
0052 {
0053 auto& error_handler = x3::get<error_handler_tag>(context).get();
0054 error_handler.tag(ast, first, last);
0055 }
0056 };
0057 }}}
0058
0059 #endif