Skip to content

Commit

Permalink
Preclude skipper *parse() overloads from token parsing with a static_…
Browse files Browse the repository at this point in the history
…assert.

See #202.
  • Loading branch information
tzlaine committed Nov 29, 2024
1 parent e654c9f commit 178d62a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion include/boost/parser/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8545,7 +8545,7 @@ namespace boost { namespace parser {
template<typename R>
auto get_error_handler_iterator(R & r)
{
if constexpr (is_token_iter_v<detail::iterator_t<R>>) {
if constexpr (is_token_iter_v<iterator_t<R>>) {
return detail::text::detail::begin(r).range_begin();
} else {
return detail::text::detail::begin(r);
Expand Down Expand Up @@ -9068,6 +9068,9 @@ namespace boost { namespace parser {
// clang-format on
#endif
{
static_assert(
!detail::is_token_iter_v<detail::iterator_t<R>>,
"You cannot use a skipper when parsing tokens.");
detail::attr_reset reset(attr);
auto r_ = detail::make_input_subrange(r);
auto first = r_.begin();
Expand Down Expand Up @@ -9172,6 +9175,9 @@ namespace boost { namespace parser {
// clang-format on
#endif
{
static_assert(
!detail::is_token_iter_v<detail::iterator_t<R>>,
"You cannot use a skipper when parsing tokens.");
auto r_ = detail::make_input_subrange(r);
auto first = r_.begin();
auto const last = r_.end();
Expand Down Expand Up @@ -9396,6 +9402,9 @@ namespace boost { namespace parser {
// clang-format on
#endif
{
static_assert(
!detail::is_token_iter_v<detail::iterator_t<R>>,
"You cannot use a skipper when parsing tokens.");
auto r_ = detail::make_input_subrange(r);
auto first = r_.begin();
auto const last = r_.end();
Expand Down

0 comments on commit 178d62a

Please sign in to comment.