Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Struct stream_error_handler

boost::parser::stream_error_handler

Synopsis

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


struct stream_error_handler {

  // public member functions
  stream_error_handler();
  stream_error_handler(std::string_view);
  stream_error_handler(std::string_view, std::ostream &);
  stream_error_handler(std::string_view, std::ostream &, std::ostream &);
  stream_error_handler(std::wstring_view);
  stream_error_handler(std::wstring_view, std::ostream &);
  stream_error_handler(std::wstring_view, std::ostream &, std::ostream &);
  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

Prints warnings and errors to the std::ostreams provided by the user, or std::cerr if neither stream is specified. If a filename is provided, that is used to print all diagnostics.

stream_error_handler public member functions

  1. stream_error_handler();
  2. stream_error_handler(std::string_view filename);
  3. stream_error_handler(std::string_view filename, std::ostream & errors);
  4. stream_error_handler(std::string_view filename, std::ostream & errors, 
                         std::ostream & warnings);
  5. stream_error_handler(std::wstring_view filename);

    This overload is Windows-only.

  6. stream_error_handler(std::wstring_view filename, std::ostream & errors);

    This overload is Windows-only.

  7. stream_error_handler(std::wstring_view filename, std::ostream & errors, 
                         std::ostream & warnings);

    This overload is Windows-only.

  8. 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 *err_os_ when err_os_ is non-null, or std::cerr otherwise. Always returns error_handler_result::fail.

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

    Let std::ostream * s = kind == diagnostic_kind::error : err_os_ : warn_os_; prints message to *s when s is non-null, or std::cerr otherwise. 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.

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

    Let std::ostream * s = kind == diagnostic_kind::error : err_os_ : warn_os_; prints message to *s when s is non-null, or std::cerr otherwise. 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