mirror of
https://github.com/boostorg/parser.git
synced 2026-01-19 04:22:13 +00:00
Define BOOST_PARSER_USE_CONCEPTS to be 1 when running Doxygen. This gets
concepts constraints on template parameters to show up. Also explicitly state requirements in the Doxygen strings for anything that adds constraints via requires clauses, since those do not show up in Doxygen. Fixes #109.
This commit is contained in:
@@ -24,6 +24,7 @@ doxygen parser_reference
|
||||
# note that there is no detail::unspecified -- this is a hack to get all
|
||||
# the SFINAE code out of the API docs.
|
||||
<doxygen:param>"PREDEFINED=\"BOOST_PARSER_DOXYGEN=1\" \\
|
||||
\"BOOST_PARSER_USE_CONCEPTS=1\" \\
|
||||
\"enable_if=detail::unspecified\""
|
||||
<doxygen:param>HIDE_UNDOC_MEMBERS=NO
|
||||
<doxygen:param>EXTRACT_PRIVATE=NO
|
||||
|
||||
@@ -2648,9 +2648,10 @@ namespace boost { namespace parser {
|
||||
};
|
||||
}
|
||||
|
||||
#ifndef BOOST_PARSER_DOXYGEN
|
||||
|
||||
// This constraint is only here to allow the alternate-call semantic
|
||||
// action metaprogramming logic function on MSVC.
|
||||
// action metaprogramming logic to function on MSVC.
|
||||
template<typename Context>
|
||||
auto _val(Context const & context) -> std::conditional_t<
|
||||
detail::is_nope_v<decltype(*context.val_)>,
|
||||
@@ -2773,6 +2774,8 @@ namespace boost { namespace parser {
|
||||
diagnostic_kind::warning, message, context);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/** An invocable that returns the `I`th parameter to the bottommost rule.
|
||||
This is useful for forwarding parameters to sub-rules. */
|
||||
template<unsigned int I>
|
||||
@@ -6038,7 +6041,9 @@ namespace boost { namespace parser {
|
||||
}
|
||||
|
||||
/** Returns a `parser_interface` containing a `char_parser` that
|
||||
matches `x`. */
|
||||
matches `x`.
|
||||
|
||||
\tparam T Constrained by `!parsable_range_like<T>`. */
|
||||
#if BOOST_PARSER_USE_CONCEPTS
|
||||
template<typename T>
|
||||
// clang-format off
|
||||
@@ -6111,7 +6116,10 @@ namespace boost { namespace parser {
|
||||
matches one of the values in `r`. `r` must be a sorted,
|
||||
random-access sequence of `char32_t`. The character begin matched
|
||||
is directly compared to the elements of `r`. The match is found
|
||||
via binary search. No case folding is performed. */
|
||||
via binary search. No case folding is performed.
|
||||
|
||||
\tparam R Additionally constrained by
|
||||
`std::same_as<std::ranges::range_value_t<R>, char32_t>`. */
|
||||
// clang-format off
|
||||
#if BOOST_PARSER_USE_CONCEPTS
|
||||
template<parsable_range_like R>
|
||||
@@ -7648,7 +7656,10 @@ namespace boost { namespace parser {
|
||||
/** Parses `[first, last)` using `parser`, and returns whether the parse
|
||||
was successful. On success, `attr` will be assigned the value of the
|
||||
attribute produced by `parser`. If `trace_mode == trace::on`, a
|
||||
verbose trace of the parse will be streamed to `std::cout`. */
|
||||
verbose trace of the parse will be streamed to `std::cout`.
|
||||
|
||||
\tparam Attr Constrained by
|
||||
`!detail::derived_from_parser_interface_v<std::remove_cvref_t<Attr>`. */
|
||||
#if BOOST_PARSER_USE_CONCEPTS
|
||||
template<
|
||||
parsable_iter I,
|
||||
@@ -7724,7 +7735,15 @@ namespace boost { namespace parser {
|
||||
to be considered successful. On success, `attr` will be assigned the
|
||||
value of the attribute produced by `parser`. If `trace_mode ==
|
||||
trace::on`, a verbose trace of the parse will be streamed to
|
||||
`std::cout`. */
|
||||
`std::cout`.
|
||||
|
||||
\tparam ErrorHandler Constrained by `error_handler<ErrorHandler,std::ranges::iterator_t<decltype(subrange_of(r))>, std::ranges::sentinel_t<decltype(subrange_of(r))>, GlobalState>`,
|
||||
where `subrange_of` is an implementation detail that: creates
|
||||
subranges out of pointers; trims trailing zeros off of bounded
|
||||
arrays (such as string literals); and transcodes to UTF-32 if the
|
||||
input is non-`char`.
|
||||
\tparam Attr Constrained by
|
||||
`!detail::derived_from_parser_interface_v<std::remove_cvref_t<Attr>`. */
|
||||
#if BOOST_PARSER_USE_CONCEPTS
|
||||
template<
|
||||
parsable_range_like R,
|
||||
@@ -7755,7 +7774,7 @@ namespace boost { namespace parser {
|
||||
ErrorHandler,
|
||||
std::ranges::iterator_t<decltype(detail::make_input_subrange(r))>,
|
||||
std::ranges::sentinel_t<decltype(detail::make_input_subrange(r))>,
|
||||
GlobalState> &&
|
||||
GlobalState> &&
|
||||
(!detail::derived_from_parser_interface_v<std::remove_cvref_t<Attr>>)
|
||||
// clang-format on
|
||||
#endif
|
||||
@@ -7773,7 +7792,10 @@ namespace boost { namespace parser {
|
||||
/** Parses `[first, last)` using `parser`. Returns a `std::optional`
|
||||
containing the attribute produced by `parser` on parse success, and
|
||||
`std::nullopt` on parse failure. If `trace_mode == trace::on`, a
|
||||
verbose trace of the parse will be streamed to `std::cout`. */
|
||||
verbose trace of the parse will be streamed to `std::cout`.
|
||||
|
||||
\tparam Attr Constrained by
|
||||
`!detail::derived_from_parser_interface_v<std::remove_cvref_t<Attr>`. */
|
||||
#if BOOST_PARSER_USE_CONCEPTS
|
||||
template<
|
||||
parsable_iter I,
|
||||
@@ -7826,7 +7848,15 @@ namespace boost { namespace parser {
|
||||
attribute produced by `parser` on parse success, and `std::nullopt` on
|
||||
parse failure. The entire input range `r` must be consumed for the
|
||||
parse to be considered successful. If `trace_mode == trace::on`, a
|
||||
verbose trace of the parse will be streamed to `std::cout`. */
|
||||
verbose trace of the parse will be streamed to `std::cout`.
|
||||
|
||||
\tparam ErrorHandler Constrained by `error_handler<ErrorHandler,std::ranges::iterator_t<decltype(subrange_of(r))>, std::ranges::sentinel_t<decltype(subrange_of(r))>, GlobalState>`,
|
||||
where `subrange_of` is an implementation detail that: creates
|
||||
subranges out of pointers; trims trailing zeros off of bounded
|
||||
arrays (such as string literals); and transcodes to UTF-32 if the
|
||||
input is non-`char`.
|
||||
\tparam Attr Constrained by
|
||||
`!detail::derived_from_parser_interface_v<std::remove_cvref_t<Attr>`. */
|
||||
#if BOOST_PARSER_USE_CONCEPTS
|
||||
template<
|
||||
parsable_range_like R,
|
||||
@@ -7949,7 +7979,13 @@ namespace boost { namespace parser {
|
||||
the parse to be considered successful. On success, `attr` will be
|
||||
assigned the value of the attribute produced by `parser`. If
|
||||
`trace_mode == trace::on`, a verbose trace of the parse will be
|
||||
streamed to `std::cout`. */
|
||||
streamed to `std::cout`.
|
||||
|
||||
\tparam ErrorHandler Constrained by `error_handler<ErrorHandler,std::ranges::iterator_t<decltype(subrange_of(r))>, std::ranges::sentinel_t<decltype(subrange_of(r))>, GlobalState>`,
|
||||
where `subrange_of` is an implementation detail that: creates
|
||||
subranges out of pointers; trims trailing zeros off of bounded
|
||||
arrays (such as string literals); and transcodes to UTF-32 if the
|
||||
input is non-`char`. */
|
||||
#if BOOST_PARSER_USE_CONCEPTS
|
||||
template<
|
||||
parsable_range_like R,
|
||||
@@ -8058,7 +8094,13 @@ namespace boost { namespace parser {
|
||||
`std::nullopt` on parse failure. The entire input range `r` must be
|
||||
consumed for the parse to be considered successful. If `trace_mode ==
|
||||
trace::on`, a verbose trace of the parse will be streamed to
|
||||
`std::cout`. */
|
||||
`std::cout`.
|
||||
|
||||
\tparam ErrorHandler Constrained by `error_handler<ErrorHandler,std::ranges::iterator_t<decltype(subrange_of(r))>, std::ranges::sentinel_t<decltype(subrange_of(r))>, GlobalState>`,
|
||||
where `subrange_of` is an implementation detail that: creates
|
||||
subranges out of pointers; trims trailing zeros off of bounded
|
||||
arrays (such as string literals); and transcodes to UTF-32 if the
|
||||
input is non-`char`. */
|
||||
#if BOOST_PARSER_USE_CONCEPTS
|
||||
template<
|
||||
parsable_range_like R,
|
||||
@@ -8170,7 +8212,13 @@ namespace boost { namespace parser {
|
||||
`Callbacks` is expected to be an invocable with the correct overloads
|
||||
required to support all successful rule parses that might occur. If
|
||||
`trace_mode == trace::on`, a verbose trace of the parse will be
|
||||
streamed to `std::cout`. */
|
||||
streamed to `std::cout`.
|
||||
|
||||
\tparam ErrorHandler Constrained by `error_handler<ErrorHandler,std::ranges::iterator_t<decltype(subrange_of(r))>, std::ranges::sentinel_t<decltype(subrange_of(r))>, GlobalState>`,
|
||||
where `subrange_of` is an implementation detail that: creates
|
||||
subranges out of pointers; trims trailing zeros off of bounded
|
||||
arrays (such as string literals); and transcodes to UTF-32 if the
|
||||
input is non-`char`. */
|
||||
#if BOOST_PARSER_USE_CONCEPTS
|
||||
template<
|
||||
parsable_range_like R,
|
||||
@@ -8297,7 +8345,13 @@ namespace boost { namespace parser {
|
||||
`Callbacks` is expected to be an invocable with the correct overloads
|
||||
required to support all successful rule parses that might occur. If
|
||||
`trace_mode == trace::on`, a verbose trace of the parse will be
|
||||
streamed to `std::cout`. */
|
||||
streamed to `std::cout`.
|
||||
|
||||
\tparam ErrorHandler Constrained by `error_handler<ErrorHandler,std::ranges::iterator_t<decltype(subrange_of(r))>, std::ranges::sentinel_t<decltype(subrange_of(r))>, GlobalState>`,
|
||||
where `subrange_of` is an implementation detail that: creates
|
||||
subranges out of pointers; trims trailing zeros off of bounded
|
||||
arrays (such as string literals); and transcodes to UTF-32 if the
|
||||
input is non-`char`. */
|
||||
#if BOOST_PARSER_USE_CONCEPTS
|
||||
template<
|
||||
parsable_range_like R,
|
||||
|
||||
@@ -495,9 +495,13 @@ namespace boost { namespace parser {
|
||||
|
||||
/** Report that the error described in `message` occurred at `location`,
|
||||
using the context's error handler. */
|
||||
template<typename Iter, typename Context>
|
||||
#if BOOST_PARSER_USE_CONCEPTS
|
||||
template<std::forward_iterator I, typename Context>
|
||||
#else
|
||||
template<typename I, typename Context>
|
||||
#endif
|
||||
void _report_error(
|
||||
Context const & context, std::string_view message, Iter location);
|
||||
Context const & context, std::string_view message, I location);
|
||||
|
||||
/** Report that the error described in `message` occurred at
|
||||
`_where(context).begin()`, using the context's error handler. */
|
||||
@@ -506,9 +510,13 @@ namespace boost { namespace parser {
|
||||
|
||||
/** Report that the warning described in `message` occurred at `location`,
|
||||
using the context's error handler. */
|
||||
template<typename Iter, typename Context>
|
||||
#if BOOST_PARSER_USE_CONCEPTS
|
||||
template<std::forward_iterator I, typename Context>
|
||||
#else
|
||||
template<typename I, typename Context>
|
||||
#endif
|
||||
void _report_warning(
|
||||
Context const & context, std::string_view message, Iter location);
|
||||
Context const & context, std::string_view message, I location);
|
||||
|
||||
/** Report that the warning described in `message` occurred at
|
||||
`_where(context).begin()`, using the context's error handler. */
|
||||
|
||||
@@ -193,7 +193,12 @@ namespace boost::parser {
|
||||
|
||||
/** Produces a range of subranges of a given range `base`. Each subrange
|
||||
is either a subrange of `base` that does not match the given parser
|
||||
`parser`, or is the given replacement for a match, `replacement`. */
|
||||
`parser`, or is the given replacement for a match, `replacement`.
|
||||
|
||||
In addition to the template parameter constraints, `V` and
|
||||
`ReplacementV` must be ranges of `char`, or must have the same UTF
|
||||
format, and `V` and `ReplacementV` must meet the same compatibility
|
||||
requirements as described in `std::ranges::join_view`. */
|
||||
template<
|
||||
#if BOOST_PARSER_USE_CONCEPTS
|
||||
std::ranges::viewable_range V,
|
||||
|
||||
@@ -289,7 +289,7 @@ namespace boost::parser {
|
||||
|
||||
/** Produces a sequence of subranges of the underlying sequence of type
|
||||
`V`. Each subrange is a nonoverlapping match of the given parser,
|
||||
using a skip-parser if provided. */
|
||||
using a skip-parser if provided. */
|
||||
template<
|
||||
#if BOOST_PARSER_USE_CONCEPTS
|
||||
std::ranges::viewable_range V,
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace boost::parser {
|
||||
|
||||
/** Produces a sequence of subranges of the underlying sequence of type
|
||||
`V`. the underlying sequence is split into subranges delimited by
|
||||
matches of the given parser, possibly using a given skip-parser. */
|
||||
matches of the given parser, possibly using a given skip-parser. */
|
||||
template<
|
||||
#if BOOST_PARSER_USE_CONCEPTS
|
||||
std::ranges::viewable_range V,
|
||||
|
||||
@@ -24,7 +24,11 @@ namespace boost::parser {
|
||||
|
||||
#else
|
||||
|
||||
/** A view that produces UTF-8 from an given sequence of UTF. */
|
||||
/** A view that produces UTF-8 from an given sequence of UTF.
|
||||
|
||||
\tparam V Constrained by `std::ranges::view<V>`. Additionally, the
|
||||
value type of `V` must be `char`, `wchar_t`, `char8_t`, `char16_t`, or
|
||||
`char32_t`. */
|
||||
#if BOOST_PARSER_DETAIL_TEXT_USE_CONCEPTS || defined(BOOST_PARSER_DOXYGEN)
|
||||
template<detail::text::utf_range V>
|
||||
requires std::ranges::view<V>
|
||||
@@ -44,7 +48,11 @@ namespace boost::parser {
|
||||
{}
|
||||
};
|
||||
|
||||
/** A view that produces UTF-16 from an given sequence of UTF. */
|
||||
/** A view that produces UTF-16 from an given sequence of UTF.
|
||||
|
||||
\tparam V Constrained by `std::ranges::view<V>`. Additionally, the
|
||||
value type of `V` must be `char`, `wchar_t`, `char8_t`, `char16_t`, or
|
||||
`char32_t`. */
|
||||
#if BOOST_PARSER_DETAIL_TEXT_USE_CONCEPTS || defined(BOOST_PARSER_DOXYGEN)
|
||||
template<detail::text::utf_range V>
|
||||
requires std::ranges::view<V>
|
||||
@@ -64,7 +72,11 @@ namespace boost::parser {
|
||||
{}
|
||||
};
|
||||
|
||||
/** A view that produces UTF-32 from an given sequence of UTF. */
|
||||
/** A view that produces UTF-32 from an given sequence of UTF.
|
||||
|
||||
\tparam V Constrained by `std::ranges::view<V>`. Additionally, the
|
||||
value type of `V` must be `char`, `wchar_t`, `char8_t`, `char16_t`, or
|
||||
`char32_t`. */
|
||||
#if BOOST_PARSER_DETAIL_TEXT_USE_CONCEPTS || defined(BOOST_PARSER_DOXYGEN)
|
||||
template<detail::text::utf_range V>
|
||||
requires std::ranges::view<V>
|
||||
|
||||
@@ -316,7 +316,13 @@ namespace boost::parser {
|
||||
/** Produces a range of subranges of a given range `base`. Each subrange
|
||||
is either a subrange of `base` that does not match the given parser
|
||||
`parser`, or is `f(*boost::parser::parse(match, parser))`, where `f`
|
||||
is the given invocable and `match` is the matching subrange. */
|
||||
is the given invocable and `match` is the matching subrange.
|
||||
|
||||
In addition to the template parameter constraints, `F` must be
|
||||
invocable with the attribute type of `Parser`; `V` and the range type
|
||||
produced by `F`, "`Rf`" must be ranges of `char`, or must have the
|
||||
same UTF format; and `V` and `Rf` must meet the same compatibility
|
||||
requirements as described in `std::ranges::join_view`. */
|
||||
template<
|
||||
#if BOOST_PARSER_USE_CONCEPTS
|
||||
std::ranges::viewable_range V,
|
||||
|
||||
Reference in New Issue
Block a user