[#foldl_reject_incomplete_start_with_parser] [section foldl_reject_incomplete_start_with_parser] [h1 Synopsis] template struct foldl_reject_incomplete_start_with_parser; This is a [link parser_combinator parser combinator]. [table Arguments [[Name] [Type]] [[`P`] [[link parser parser]]] [[`StateP`] [[link parser parser]]] [[`ForwardOp`] [[link metafunction_class template metafunction class] taking two arguments]] ] [h1 Description] The same as [link foldl_start_with_parser `foldl_start_with_parser`], but once `P` rejects the input, `foldl_reject_incomplete_start_with_parser` checks if `P` consumes any characters before rejecting the input. If so, `foldl_reject_incomplete_start_with_parser` rejects the input with the same error message this last application of `P` returned. Otherwise `foldl_reject_incomplete_start_with_parser` accepts the input and gives the same result as [link foldl_start_with_parser `foldl_start_with_parser`]. Here is a diagram showing how `foldl_reject_incomplete_start_with_parser` works by example: using int_token = token; using plus_token = token>; using plus_int = last_of; using sum_op = mpl::lambda>::type; [$images/metaparse/foldl_reject_incomplete_start_with_parser_diag1.png [width 70%]] Further details can be found in the [link introducing-foldl_reject_incomplete_start_with_parser Introducing foldl_reject_incomplete_start_with_parser] section of the [link manual User Manual]. [h1 Header] #include [h1 Expression semantics] For any `p` parser, `pt` class, `f` metafunction class taking two arguments, `s` compile-time string and `pos` source position foldl_reject_incomplete_start_with_parser::apply is equivalent to first_of< foldl_start_with_parser, fail_at_first_char_expected

>::apply [h1 Example] #include #include #include #include #include #include #include #include #include #include #include using namespace boost::metaparse; using int_token = token; using plus_token = token>; using plus_int = last_of; using sum_op = boost::mpl::lambda>::type; using ints = foldl_reject_incomplete_start_with_parser; static_assert( get_result< ints::apply >::type::value == 48, "ints should sum the numbers" ); static_assert( is_error< ints::apply >::type::value, "when the last number is missing, it should be an error" ); [endsect]