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

Method call

include/boost/parser/parser.hpp:3442–3499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3440 typename Context,
3441 typename SkipParser>
3442 auto call(
3443 Iter & first,
3444 Sentinel last,
3445 Context const & context,
3446 SkipParser const & skip,
3447 detail::flags flags,
3448 bool & success) const
3449 {
3450 use_parser_t<Iter, Sentinel, Context, SkipParser> const use_parser{
3451 first, last, context, skip, flags, success};
3452
3453 // A result type for each of the parsers in parsers_.
3454 using all_types =
3455 decltype(detail::hl::transform(parsers_, use_parser));
3456
3457 // Same as above, wrapped in detail::wrapper.
3458 using all_types_wrapped =
3459 decltype(detail::hl::transform(all_types{}, detail::wrap{}));
3460
3461 // Returns a tuple<> containing two things: 1) A tuple of only the
3462 // unique wrapped types from above, without nopes; this may be
3463 // empty. 2) std::true_type or std::false_type indicating whether
3464 // nopes were found; if so, the final result is an optional.
3465 auto append_unique = [](auto result, auto x) {
3466 using x_type = typename decltype(x)::type;
3467 if constexpr (detail::is_nope_v<x_type>) {
3468 return detail::hl::make_pair(
3469 detail::hl::first(result), std::true_type{});
3470 } else if constexpr (detail::hl::contains(
3471 detail::hl::first(result), x)) {
3472 return result;
3473 } else {
3474 return detail::hl::make_pair(
3475 detail::hl::append(detail::hl::first(result), x),
3476 detail::hl::second(result));
3477 }
3478 };
3479 using wrapped_unique_types = decltype(detail::hl::fold_left(
3480 all_types_wrapped{},
3481 detail::hl::make_pair(tuple<>{}, std::false_type{}),
3482 append_unique));
3483
3484 // Same as above, with the tuple types unwrapped.
3485 using unwrapped_types = decltype(detail::hl::make_pair(
3486 detail::hl::transform(
3487 detail::hl::first(wrapped_unique_types{}),
3488 detail::unwrap{}),
3489 detail::hl::second(wrapped_unique_types{})));
3490
3491 // Types above converted to a "variant", which may actually be a
3492 // non-variant type T if that is the only unique non-nope type, or a
3493 // nope if unwrapped_types is empty.
3494 using result_t = detail::to_hana_tuple_or_type_t<unwrapped_types>;
3495
3496 result_t retval{};
3497 call(first, last, context, skip, flags, success, retval);
3498 return retval;
3499 }

Callers 15

apply_parserFunction · 0.45
callMethod · 0.45
callMethod · 0.45
operator()Method · 0.45
operator()Method · 0.45
call_implMethod · 0.45
operator()Method · 0.45
call_implMethod · 0.45
callMethod · 0.45
callMethod · 0.45
callMethod · 0.45
callMethod · 0.45

Calls 10

make_pairFunction · 0.85
firstFunction · 0.85
appendFunction · 0.85
secondFunction · 0.85
fold_leftFunction · 0.85
callFunction · 0.85
scoped_traceFunction · 0.85
applyFunction · 0.85
transformFunction · 0.70
containsFunction · 0.50

Tested by

no test coverage detected