mirror of
https://github.com/boostorg/parser.git
synced 2026-01-19 04:22:13 +00:00
Add the condition that BOOST_PARSER_USE_CONCEPTS is true to/in place of many
places that used __cpp_lib{concepts,ranges} previously. This is often
necessary when concepts are disabled, since the user might have a broken
implementation of concepts.
This commit is contained in:
@@ -86,7 +86,7 @@
|
||||
# define BOOST_PARSER_USE_CONCEPTS 0
|
||||
#endif
|
||||
|
||||
#if defined(__cpp_lib_ranges)
|
||||
#if defined(__cpp_lib_ranges) && BOOST_PARSER_USE_CONCEPTS
|
||||
# define BOOST_PARSER_SUBRANGE std::ranges::subrange
|
||||
#else
|
||||
# include <boost/parser/subrange.hpp>
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace boost { namespace parser { namespace detail {
|
||||
std::ostream & os,
|
||||
int components = 0);
|
||||
|
||||
#if defined(BOOST_PARSER_DOXYGEN) || defined(__cpp_lib_concepts)
|
||||
#if defined(BOOST_PARSER_DOXYGEN) || BOOST_PARSER_USE_CONCEPTS
|
||||
template<typename Context, typename Parser>
|
||||
void print_parser(
|
||||
Context const & context,
|
||||
|
||||
@@ -323,7 +323,7 @@ namespace boost { namespace parser { namespace detail {
|
||||
detail::print_directive(context, "raw", parser.parser_, os, components);
|
||||
}
|
||||
|
||||
#if defined(BOOST_PARSER_DOXYGEN) || defined(__cpp_lib_concepts)
|
||||
#if defined(BOOST_PARSER_DOXYGEN) || BOOST_PARSER_USE_CONCEPTS
|
||||
template<typename Context, typename Parser>
|
||||
void print_parser(
|
||||
Context const & context,
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#if !defined(BOOST_STL_INTERFACES_DOXYGEN)
|
||||
|
||||
#if defined(__cpp_lib_ranges) && 202202L <= __cpp_lib_ranges
|
||||
#if BOOST_PARSER_USE_CONCEPTS && defined(__cpp_lib_ranges) && \
|
||||
202202L <= __cpp_lib_ranges
|
||||
#define BOOST_PARSER_USE_CPP23_STD_RANGE_ADAPTOR_CLOSURE 1
|
||||
#else
|
||||
#define BOOST_PARSER_USE_CPP23_STD_RANGE_ADAPTOR_CLOSURE 0
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#define BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD 0
|
||||
#endif
|
||||
|
||||
#if defined(__cpp_lib_ranges)
|
||||
#if BOOST_PARSER_USE_CONCEPTS
|
||||
namespace boost::parser::detail { namespace text { namespace detail {
|
||||
inline constexpr auto begin = std::ranges::begin;
|
||||
inline constexpr auto end = std::ranges::end;
|
||||
@@ -36,7 +36,7 @@ namespace boost::parser::detail { namespace text { namespace detail {
|
||||
#include <boost/parser/detail/text/detail/begin_end.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(__cpp_lib_ranges)
|
||||
#if BOOST_PARSER_USE_CONCEPTS
|
||||
# define BOOST_PARSER_DETAIL_TEXT_SUBRANGE std::ranges::subrange
|
||||
#else
|
||||
# include <boost/parser/subrange.hpp>
|
||||
|
||||
@@ -801,7 +801,7 @@ namespace boost::parser::detail { namespace text {
|
||||
|
||||
}}
|
||||
|
||||
#if defined(__cpp_lib_ranges)
|
||||
#if BOOST_PARSER_USE_CONCEPTS && defined(__cpp_lib_ranges)
|
||||
|
||||
namespace std::ranges {
|
||||
#if BOOST_PARSER_DETAIL_TEXT_USE_CONCEPTS
|
||||
|
||||
@@ -4600,7 +4600,7 @@ namespace boost { namespace parser {
|
||||
Parser parser_;
|
||||
};
|
||||
|
||||
#if defined(__cpp_lib_concepts)
|
||||
#if BOOST_PARSER_USE_CONCEPTS
|
||||
template<typename Parser>
|
||||
struct string_view_parser
|
||||
{
|
||||
@@ -5989,7 +5989,7 @@ namespace boost { namespace parser {
|
||||
`parser_interface<P>`. */
|
||||
inline constexpr directive<raw_parser> raw;
|
||||
|
||||
#if defined(BOOST_PARSER_DOXYGEN) || defined(__cpp_lib_concepts)
|
||||
#if defined(BOOST_PARSER_DOXYGEN) || BOOST_PARSER_USE_CONCEPTS
|
||||
/** The `string_view` directive, whose `operator[]` returns a
|
||||
`parser_interface<string_view_parser<P>>` from a given parser of type
|
||||
`parser_interface<P>`. This is only available in C++20 and later. */
|
||||
|
||||
@@ -221,7 +221,7 @@ namespace boost { namespace parser {
|
||||
template<typename Parser>
|
||||
struct raw_parser;
|
||||
|
||||
#if defined(BOOST_PARSER_DOXYGEN) || defined(__cpp_lib_concepts)
|
||||
#if defined(BOOST_PARSER_DOXYGEN) || BOOST_PARSER_USE_CONCEPTS
|
||||
/** Applies the given parser `p` of type `Parser`. Regardless of the
|
||||
attribute produced by `Parser`, this parser's attribute is equivalent
|
||||
to `std::basic_string_view<char_type>` within a semantic action on
|
||||
|
||||
@@ -1219,7 +1219,7 @@ int main()
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__cpp_lib_concepts)
|
||||
#if BOOST_PARSER_USE_CONCEPTS
|
||||
// string_view
|
||||
{
|
||||
{
|
||||
@@ -2805,7 +2805,7 @@ int main()
|
||||
}
|
||||
|
||||
|
||||
#if defined(__cpp_lib_concepts)
|
||||
#if BOOST_PARSER_USE_CONCEPTS
|
||||
// string_view_doc_example
|
||||
{
|
||||
namespace bp = boost::parser;
|
||||
|
||||
@@ -34,8 +34,10 @@ namespace deduction {
|
||||
}
|
||||
#endif
|
||||
|
||||
// MSVC produces hard errors here, so ill_formed does not work.
|
||||
#if defined(__cpp_char8_t) && !defined(_MSC_VER)
|
||||
// MSVC and older Clangs produce hard errors here, so ill_formed does not
|
||||
// work.
|
||||
#if defined(__cpp_char8_t) && !defined(_MSC_VER) && \
|
||||
(!defined(__clang__) || 16 <= __clang__)
|
||||
char const empty_str[] = "";
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -171,7 +171,7 @@ int main()
|
||||
|
||||
PARSE(raw[char_]);
|
||||
|
||||
#if defined(__cpp_lib_concepts)
|
||||
#if BOOST_PARSER_USE_CONCEPTS
|
||||
std::cout << "\n\n"
|
||||
<< "----------------------------------------\n"
|
||||
<< "| string_view[] |\n"
|
||||
|
||||
Reference in New Issue
Block a user