PrevUpHomeNext

Function template callback_parse

boost::parser::callback_parse

Synopsis

// In header: <boost/parser/parser.hpp>


template<parsable_range R, typename Parser, typename GlobalState, 
         typename ErrorHandler, typename Callbacks> 
  bool callback_parse(R const & r, 
                      parser_interface< Parser, GlobalState, ErrorHandler > const & parser, 
                      Callbacks const & callbacks, 
                      trace trace_mode = trace::off);

Description

Parses r using parser, and returns whether the parse was successful. The entire input range r must be consumed for the parse to be considered successful. When a callback rule r is successful during the parse, one of two things happens: 1) if r has an attribute, callbacks(tag, x) will be called (where tag is decltype(r)::tag_type{}, and x is the attribute produced by r); or 2) if r has no attribute, callbacks(tag) will be called. 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.

Template Parameters:

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.


PrevUpHomeNext