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
|
|
|
{
|
2022-09-22 18:26:05 +00:00
|
|
|
public:
|
|
|
|
const char* what() const noexcept override { return "Compile error"; }
|
|
|
|
///< 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
|
|
|
{
|
2022-09-22 18:26:05 +00:00
|
|
|
public:
|
|
|
|
const char* what() const noexcept override { return "Can't read file"; }
|
|
|
|
///< 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
|
|
|
{
|
2022-09-22 18:26:05 +00:00
|
|
|
public:
|
|
|
|
const char* what() const noexcept override { return "End of file"; }
|
|
|
|
///< Return error message
|
2010-06-27 17:20:21 +00:00
|
|
|
};
|
2010-07-01 15:41:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|