|
LRDE Tiger Compiler
1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
|
Handle errors in the whole project. More...
#include <error.hh>

Public Member Functions | |
| error () | |
| error (const error &e) | |
| ~error () | |
| error & | operator= (const error &e) |
| Copy an error. | |
Member manipulators. | |
| void | exit () const |
| Throw an exception to exit. | |
| void | exit_on_error () const |
| If the error status is set, throw an exception to exit. | |
| void | ice (const char *file, int line) const |
| Throw an Internal Compiler Error. | |
| void | ice_on_error (const char *file, int line) const |
| void | clear () |
| Reset to no error. | |
Accessors. | |
| operator bool () const | |
| True if an error is recorded. | |
| error_type | status_get () const |
| Get the current status. | |
| const std::ostringstream & | stream_get () const |
| Get the stream associated with the class. | |
Private Attributes | |
| error_type | status_ |
| The current exit status. | |
| std::ostringstream | stream_ |
| The current error message. | |
Filling the error handler. | |
| enum | error_type { success = 0, failure = 1, scan = 2, parse = 3, bind = 4, type = 5 } |
| With what exit status should we end? More... | |
| typedef void(error::* | member_manip_type )() |
| Member manipulator signature. | |
| typedef void(error::* | const_member_manip_type )() const |
| Const member manipulator signature. | |
| template<typename T > | |
| error & | operator<< (const T &t) |
| General method: put the parameter in stream_. | |
| error & | operator<< (error_type e) |
| Set the status if e is lower than the current status. | |
| error & | operator<< (std::ostream &(*f)(std::ostream &)) |
| Accept std::endl etc. | |
| error & | operator<< (const error &rhs) |
| Import errors. | |
| error & | operator<< (member_manip_type f) |
| Hook for member manipulators. | |
| error & | operator<< (const_member_manip_type f) |
| Hooks for const member manipulators. | |
Handle errors in the whole project.
Each task has an error status depending on its exit code described in the enum below.
Several versions of operator<< are used to fill the handler.
A global variable is defined to centralize all the error uses.
| typedef void(error::* misc::error::const_member_manip_type)() const |
Const member manipulator signature.
| typedef void(error::* misc::error::member_manip_type)() |
Member manipulator signature.
| misc::error::error | ( | ) |
| misc::error::error | ( | const error & | e | ) |
| misc::error::~error | ( | ) |
| void misc::error::exit | ( | ) | const |
Throw an exception to exit.
Referenced by astclone::tasks::clone(), exit_on_error(), parse::tasks::parse(), parse::TigerParser::parse_(), and parse::TigerParser::parse_import().
| void misc::error::exit_on_error | ( | ) | const |
If the error status is set, throw an exception to exit.
References exit(), and status_.
Referenced by main(), object::tasks::object_types_compute(), overload::tasks::overfun_bindings_compute(), overload::tasks::overfun_types_compute(), and type::tasks::types_check().
| void misc::error::ice | ( | const char * | file, |
| int | line | ||
| ) | const |
Throw an Internal Compiler Error.
References __Terminate(), and stream_.
Referenced by ice_on_error().
| void misc::error::ice_on_error | ( | const char * | file, |
| int | line | ||
| ) | const |
| misc::error::operator bool | ( | ) | const |
True if an error is recorded.
| error & misc::error::operator<< | ( | const T & | t | ) |
General method: put the parameter in stream_.
References stream_.
| error & misc::error::operator<< | ( | error_type | e | ) |
Set the status if e is lower than the current status.
References status_.
| error & misc::error::operator<< | ( | std::ostream &(*)(std::ostream &) | f | ) |
Accept std::endl etc.
References stream_.
Import errors.
References status_get(), and stream_get().
|
inline |
Hook for member manipulators.
|
inline |
Hooks for const member manipulators.
Copy an error.
References status_, status_get(), stream_, and stream_get().
| error::error_type misc::error::status_get | ( | ) | const |
| const std::ostringstream & misc::error::stream_get | ( | ) | const |
Get the stream associated with the class.
References stream_.
Referenced by operator<<(), misc::operator<<(), and operator=().
|
private |
The current exit status.
Referenced by clear(), exit_on_error(), ice_on_error(), operator<<(), operator=(), and status_get().
|
private |
The current error message.
Referenced by clear(), ice(), operator<<(), operator=(), and stream_get().