From 178d62a25056203bb5f05e46720b4b9674810883 Mon Sep 17 00:00:00 2001 From: Zach Laine Date: Sat, 16 Nov 2024 14:28:47 -0600 Subject: [PATCH] Preclude skipper *parse() overloads from token parsing with a static_assert. See #202. --- include/boost/parser/parser.hpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/boost/parser/parser.hpp b/include/boost/parser/parser.hpp index 32719e13..ab2137ad 100644 --- a/include/boost/parser/parser.hpp +++ b/include/boost/parser/parser.hpp @@ -8545,7 +8545,7 @@ namespace boost { namespace parser { template auto get_error_handler_iterator(R & r) { - if constexpr (is_token_iter_v>) { + if constexpr (is_token_iter_v>) { return detail::text::detail::begin(r).range_begin(); } else { return detail::text::detail::begin(r); @@ -9068,6 +9068,9 @@ namespace boost { namespace parser { // clang-format on #endif { + static_assert( + !detail::is_token_iter_v>, + "You cannot use a skipper when parsing tokens."); detail::attr_reset reset(attr); auto r_ = detail::make_input_subrange(r); auto first = r_.begin(); @@ -9172,6 +9175,9 @@ namespace boost { namespace parser { // clang-format on #endif { + static_assert( + !detail::is_token_iter_v>, + "You cannot use a skipper when parsing tokens."); auto r_ = detail::make_input_subrange(r); auto first = r_.begin(); auto const last = r_.end(); @@ -9396,6 +9402,9 @@ namespace boost { namespace parser { // clang-format on #endif { + static_assert( + !detail::is_token_iter_v>, + "You cannot use a skipper when parsing tokens."); auto r_ = detail::make_input_subrange(r); auto first = r_.begin(); auto const last = r_.end();