2010-07-01 17:41:06 +02: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 19:20:21 +02:00
|
|
|
class SourceException : public std::exception
|
2010-07-01 17:41:06 +02:00
|
|
|
{
|
2010-07-21 10:57:21 +02:00
|
|
|
public:
|
2020-10-10 12:08:27 +02:00
|
|
|
|
|
|
|
const char *what() const noexcept override { return "Compile error";}
|
2010-07-01 17:41:06 +02:00
|
|
|
///< Return error message
|
2010-06-27 19:20:21 +02:00
|
|
|
};
|
2010-07-01 17:41:06 +02:00
|
|
|
|
|
|
|
/// \brief Exception: File error
|
|
|
|
|
2010-06-28 11:38:21 +02:00
|
|
|
class FileException : public SourceException
|
2010-06-27 19:20:21 +02:00
|
|
|
{
|
2010-07-21 10:57:21 +02:00
|
|
|
public:
|
2020-10-10 12:08:27 +02:00
|
|
|
|
2020-10-22 23:57:53 +02:00
|
|
|
const char *what() const noexcept override { return "Can't read file"; }
|
2010-07-01 17:41:06 +02:00
|
|
|
///< Return error message
|
2010-06-27 19:20:21 +02:00
|
|
|
};
|
2010-07-01 17:41:06 +02:00
|
|
|
|
|
|
|
/// \brief Exception: EOF condition encountered
|
|
|
|
|
2010-06-28 11:38:21 +02:00
|
|
|
class EOFException : public SourceException
|
2020-10-10 12:08:27 +02:00
|
|
|
{
|
2010-07-21 10:57:21 +02:00
|
|
|
public:
|
2020-10-10 12:08:27 +02:00
|
|
|
|
2020-10-22 23:57:53 +02:00
|
|
|
const char *what() const noexcept override { return "End of file"; }
|
2010-07-01 17:41:06 +02:00
|
|
|
///< Return error message
|
2010-06-27 19:20:21 +02:00
|
|
|
};
|
2010-07-01 17:41:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|