• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
8
9[section:bad_expression bad_expression]
10
11[h4 Synopsis]
12
13   #include <boost/pattern_except.hpp>
14
15The class `regex_error` defines the type of objects thrown as exceptions to
16report errors during the conversion from a string representing a regular
17expression to a finite state machine.
18
19   namespace boost{
20
21   class regex_error : public std::runtime_error
22   {
23   public:
24      explicit regex_error(const std::string& s, regex_constants::error_type err, std::ptrdiff_t pos);
25      explicit regex_error(boost::regex_constants::error_type err);
26      boost::regex_constants::error_type code()const;
27      std::ptrdiff_t position()const;
28   };
29
30   typedef regex_error bad_pattern; // for backwards compatibility
31   typedef regex_error bad_expression; // for backwards compatibility
32
33   } // namespace boost
34
35[h4 Description]
36
37   regex_error(const std::string& s, regex_constants::error_type err, std::ptrdiff_t pos);
38   regex_error(boost::regex_constants::error_type err);
39
40[*Effects:] Constructs an object of class regex_error.
41
42   boost::regex_constants::error_type code()const;
43
44[*Effects:] returns the error code that represents parsing error that occurred.
45
46   std::ptrdiff_t position()const;
47
48[*Effects:] returns the location in the expression where parsing stopped.
49
50Footnotes: the choice of `std::runtime_error` as the base class for `regex_error`
51is moot; depending upon how the library is used exceptions may be either
52logic errors (programmer supplied expressions) or run time errors
53(user supplied expressions).  The library previously used `bad_pattern`
54and `bad_expression` for errors, these have been replaced by the single
55class `regex_error` to keep the library in synchronization with the
56[tr1].
57
58[endsect]
59