mirror of
https://github.com/boostorg/spirit.git
synced 2026-01-19 04:42:11 +00:00
doc: Reflect the correct signature of error handlers
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
[/==============================================================================
|
||||
Copyright (C) 2001-2018 Joel de Guzman
|
||||
Copyright (C) 2025 Nana Sakisaka
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -128,9 +129,10 @@ our `on_success` handler:
|
||||
|
||||
struct annotate_position
|
||||
{
|
||||
template <typename T, typename Iterator, typename Context>
|
||||
inline void on_success(Iterator const& first, Iterator const& last
|
||||
, T& ast, Context const& context)
|
||||
template <std::forward_iterator It, std::sentinel_for<It> Se, typename T, typename Context>
|
||||
void on_success(
|
||||
It const& first, Se const& last, T& ast, Context const& context
|
||||
) const
|
||||
{
|
||||
auto& position_cache = x3::get<position_cache_tag>(context).get();
|
||||
position_cache.annotate(ast, first, last);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[/==============================================================================
|
||||
Copyright (C) 2001-2018 Joel de Guzman
|
||||
Copyright (C) 2024 Nana Sakisaka
|
||||
Copyright (C) 2024-2025 Nana Sakisaka
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -129,10 +129,12 @@ Here's our `on_error` handler:
|
||||
|
||||
struct error_handler
|
||||
{
|
||||
template <typename Iterator, typename Exception, typename Context>
|
||||
x3::error_handler_result on_error(
|
||||
Iterator& first, Iterator const& last
|
||||
, Exception const& x, Context const& context)
|
||||
template <std::forward_iterator It, std::sentinel_for<It> Se, typename Exception, typename Context>
|
||||
[[nodiscard]] x3::error_handler_result
|
||||
on_error(
|
||||
It const& first, Se const& last,
|
||||
Exception const& x, Context const& context
|
||||
)
|
||||
{
|
||||
auto& error_handler = x3::get<x3::error_handler_tag>(context).get();
|
||||
std::string message = "Error! Expecting: " + x3::which(x) + " here:";
|
||||
|
||||
Reference in New Issue
Block a user