Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Struct default_error_handler

boost::parser::default_error_handler

Synopsis

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


struct default_error_handler {

  // public member functions
  default_error_handler() = default;
  template<typename Iter, typename Sentinel> 
    error_handler_result 
    operator()(Iter, Sentinel, parse_error< Iter > const &) const;
  template<typename Context, typename Iter> 
    void diagnose(diagnostic_kind, std::string_view, Context const &, Iter) const;
  template<typename Context> 
    void diagnose(diagnostic_kind, std::string_view, Context const &) const;
};

Description

The error handler used when the user does not specify a custom one. This error handler prints warnings and errors to std::cerr, and does not have an associcated filename.

default_error_handler public member functions

  1. default_error_handler() = default;
  2. template<typename Iter, typename Sentinel> 
      error_handler_result 
      operator()(Iter first, Sentinel last, parse_error< Iter > const & e) const;

    Handles a parse_error exception thrown during parsing. A formatted parse-expectation failure is printed to std::cerr. Always returns error_handler_result::fail.

  3. template<typename Context, typename Iter> 
      void diagnose(diagnostic_kind kind, std::string_view message, 
                    Context const & context, Iter it) const;

    Prints message to std::cerr. The diagnostic is printed with the given kind, indicating the location as being at it. This must be called within a parser semantic action, providing the parse context.

  4. template<typename Context> 
      void diagnose(diagnostic_kind kind, std::string_view message, 
                    Context const & context) const;

    Prints message to std::cerr. The diagnostic is printed with the given kind, at no particular location. This must be called within a parser semantic action, providing the parse context.


PrevUpHomeNext