MCPcopy Create free account
hub / github.com/boostorg/parser / make_temp_result

Method make_temp_result

include/boost/parser/parser.hpp:4230–4292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4228 typename Context,
4229 typename SkipParser>
4230 auto make_temp_result(
4231 Iter & first,
4232 Sentinel last,
4233 Context const & context,
4234 SkipParser const & skip,
4235 detail::flags flags,
4236 bool & success) const
4237 {
4238 using namespace literals;
4239
4240 detail::
4241 dummy_use_parser_t<Iter, Sentinel, Context, SkipParser> const
4242 dummy_use_parser(
4243 first, last, context, skip, flags, success);
4244
4245 // A result type for each of the parsers in parsers_.
4246 using all_types =
4247 decltype(detail::hl::transform(parsers_, dummy_use_parser));
4248
4249 // Same as above, wrapped in detail::wrapper.
4250 using all_types_wrapped =
4251 decltype(detail::hl::transform(all_types{}, detail::wrap{}));
4252
4253 using combining_groups =
4254 detail::combining_t<ParserTuple, CombiningGroups>;
4255 constexpr auto first_group = detail::hl::front(combining_groups{});
4256
4257 // Generate a tuple of outputs; the index that each parser should
4258 // use to write into its output; and whether the attribute for
4259 // each parser was merged into an adjacent container-attribute.
4260 constexpr auto combine_start = detail::hl::make_tuple(
4261 detail::hl::make_tuple(detail::hl::front(all_types_wrapped{})),
4262 detail::hl::make_tuple(merging_from_group(first_group)),
4263 tuple<llong<0>>{},
4264 first_group);
4265 using combined_types = decltype(detail::hl::fold_left(
4266 detail::hl::zip(
4267 detail::hl::drop_front(all_types_wrapped{}),
4268 detail::hl::drop_front(combining_groups{})),
4269 combine_start,
4270 combine{}));
4271
4272 // Unwrap the result tuple's types.
4273 constexpr auto result_type_wrapped =
4274 parser::get(combined_types{}, 0_c);
4275 using result_type = decltype(detail::hl::transform(
4276 result_type_wrapped, detail::unwrap{}));
4277
4278 using indices = decltype(parser::get(combined_types{}, 2_c));
4279 using first_pass_merged =
4280 decltype(parser::get(combined_types{}, 1_c));
4281
4282 constexpr auto find_merged_start =
4283 detail::hl::make_tuple(result_type_wrapped, tuple<>{});
4284 using merged = decltype(detail::hl::fold_left(
4285 detail::hl::zip(
4286 all_types_wrapped{}, indices{}, first_pass_merged{}),
4287 find_merged_start,

Callers

nothing calls this directly

Calls 7

frontFunction · 0.85
make_tupleFunction · 0.85
fold_leftFunction · 0.85
zipFunction · 0.85
drop_frontFunction · 0.85
transformFunction · 0.70
getFunction · 0.70

Tested by

no test coverage detected