bad_expression.qbk 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. [/
  2. Copyright 2006-2007 John Maddock.
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE_1_0.txt or copy at
  5. http://www.boost.org/LICENSE_1_0.txt).
  6. ]
  7. [section:bad_expression bad_expression]
  8. [h4 Synopsis]
  9. #include <boost/pattern_except.hpp>
  10. The class `regex_error` defines the type of objects thrown as exceptions to
  11. report errors during the conversion from a string representing a regular
  12. expression to a finite state machine.
  13. namespace boost{
  14. class regex_error : public std::runtime_error
  15. {
  16. public:
  17. explicit regex_error(const std::string& s, regex_constants::error_type err, std::ptrdiff_t pos);
  18. explicit regex_error(boost::regex_constants::error_type err);
  19. boost::regex_constants::error_type code()const;
  20. std::ptrdiff_t position()const;
  21. };
  22. typedef regex_error bad_pattern; // for backwards compatibility
  23. typedef regex_error bad_expression; // for backwards compatibility
  24. } // namespace boost
  25. [h4 Description]
  26. regex_error(const std::string& s, regex_constants::error_type err, std::ptrdiff_t pos);
  27. regex_error(boost::regex_constants::error_type err);
  28. [*Effects:] Constructs an object of class regex_error.
  29. boost::regex_constants::error_type code()const;
  30. [*Effects:] returns the error code that represents parsing error that occurred.
  31. std::ptrdiff_t position()const;
  32. [*Effects:] returns the location in the expression where parsing stopped.
  33. Footnotes: the choice of `std::runtime_error` as the base class for `regex_error`
  34. is moot; depending upon how the library is used exceptions may be either
  35. logic errors (programmer supplied expressions) or run time errors
  36. (user supplied expressions). The library previously used `bad_pattern`
  37. and `bad_expression` for errors, these have been replaced by the single
  38. class `regex_error` to keep the library in synchronization with the
  39. [tr1].
  40. [endsect]