MCPcopy Create free account
hub / github.com/boostorg/parser / operator()

Method operator()

include/boost/parser/parser.hpp:3998–4161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3996 {
3997 template<typename T, typename U>
3998 auto operator()(
3999 T result_merging_indices_and_prev_group, U x_and_group) const
4000 {
4001 using namespace literals;
4002 using detail::merge_wrap;
4003 using detail::merge_kind;
4004
4005 auto x = parser::get(x_and_group, 0_c);
4006 auto group = parser::get(x_and_group, 1_c);
4007
4008 auto result =
4009 parser::get(result_merging_indices_and_prev_group, 0_c);
4010 using result_back_type =
4011 typename std::decay_t<decltype(detail::hl::back(
4012 result))>::type;
4013 using unwrapped_optional_result_back_type =
4014 detail::unwrapped_optional_t<result_back_type>;
4015
4016 auto merging =
4017 parser::get(result_merging_indices_and_prev_group, 1_c);
4018 auto indices =
4019 parser::get(result_merging_indices_and_prev_group, 2_c);
4020 auto prev_group =
4021 parser::get(result_merging_indices_and_prev_group, 3_c);
4022
4023 using x_type = typename decltype(x)::type;
4024 using unwrapped_optional_x_type =
4025 detail::unwrapped_optional_t<x_type>;
4026
4027 if constexpr (detail::is_nope_v<x_type>) {
4028 if constexpr (
4029 !detail::is_nope_v<result_back_type> &&
4030 0 < decltype(group)::value &&
4031 decltype(group)::value != decltype(prev_group)::value) {
4032 // T >> merge[nope >> ...] -> nope
4033 // This is a very special case. If we see a nope at
4034 // the begining of a group, and there's a non-nope
4035 // before it, we put the nope in place in the result
4036 // tuple temporarily, knowing that a non-nope will
4037 // come along later in the group to replace it.
4038 return detail::hl::make_tuple(
4039 detail::hl::append(result, x),
4040 detail::hl::append(
4041 merging,
4042 merge_wrap<merge_kind::second_pass_detect>),
4043 detail::hl::append(
4044 indices, detail::hl::size(result)),
4045 group);
4046 } else {
4047 // T >> nope -> T
4048 return detail::hl::make_tuple(
4049 result,
4050 detail::hl::append(
4051 merging,
4052 merge_wrap<merge_kind::second_pass_detect>),
4053 detail::hl::append(
4054 indices, detail::hl::size_minus_one(result)),
4055 prev_group);

Callers

nothing calls this directly

Calls 8

backFunction · 0.85
make_tupleFunction · 0.85
appendFunction · 0.85
size_minus_oneFunction · 0.85
drop_backFunction · 0.85
drop_frontFunction · 0.85
getFunction · 0.70
sizeFunction · 0.50

Tested by

no test coverage detected