2010-07-01 15:41:06 +00:00
|
|
|
#ifndef COMPILER_EXCEPTION_H_INCLUDED
|
|
|
|
#define COMPILER_EXCEPTION_H_INCLUDED
|
|
|
|
|
|
|
|
#include <exception>
|
|
|
|
|
|
|
|
namespace Compiler
|
|
|
|
{
|
|
|
|
/// \brief Exception: Error while parsing the source
|
|
|
|
|
2010-06-27 17:20:21 +00:00
|
|
|
class SourceException : public std::exception
|
2010-07-01 15:41:06 +00:00
|
|
|
{
|
2010-07-21 08:57:21 +00:00
|
|
|
public:
|
2020-10-10 10:08:27 +00:00
|
|
|
|
|
|
|
const char *what() const noexcept override { return "Compile error";}
|
2010-07-01 15:41:06 +00:00
|
|
|
///< Return error message
|
2010-06-27 17:20:21 +00:00
|
|
|
};
|
2010-07-01 15:41:06 +00:00
|
|
|
|
|
|
|
/// \brief Exception: File error
|
|
|
|
|
2010-06-28 09:38:21 +00:00
|
|
|
class FileException : public SourceException
|
2010-06-27 17:20:21 +00:00
|
|
|
{
|
2010-07-21 08:57:21 +00:00
|
|
|
public:
|
2020-10-10 10:08:27 +00:00
|
|
|
|
2020-10-22 21:57:53 +00:00
|
|
|
const char *what() const noexcept override { return "Can't read file"; }
|
2010-07-01 15:41:06 +00:00
|
|
|
///< Return error message
|
2010-06-27 17:20:21 +00:00
|
|
|
};
|
2010-07-01 15:41:06 +00:00
|
|
|
|
|
|
|
/// \brief Exception: EOF condition encountered
|
|
|
|
|
2010-06-28 09:38:21 +00:00
|
|
|
class EOFException : public SourceException
|
2020-10-10 10:08:27 +00:00
|
|
|
{
|
2010-07-21 08:57:21 +00:00
|
|
|
public:
|
2020-10-10 10:08:27 +00:00
|
|
|
|
2020-10-22 21:57:53 +00:00
|
|
|
const char *what() const noexcept override { return "End of file"; }
|
2010-07-01 15:41:06 +00:00
|
|
|
///< Return error message
|
2010-06-27 17:20:21 +00:00
|
|
|
};
|
2010-07-01 15:41:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|