12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #ifndef QLOW_ERROR_REPORTING
- #define QLOW_ERROR_REPORTING
- #include "Logging.h"
- namespace qlow
- {
- struct CodePosition;
-
- class CompileError;
-
- class SyntaxError;
- }
- /*!
- * \brief bison-compatible location struct
- */
- struct qlow::CodePosition
- {
- const char* filename = "";
- int first_line;
- int last_line;
- int first_column;
- int last_column;
- };
- class qlow::CompileError
- {
- protected:
- CodePosition where;
- public:
- inline CompileError(const CodePosition& where) :
- where{ where }
- {
- }
-
- virtual ~CompileError(void);
- virtual void print(Logger& logger) const = 0;
-
- void underlineError(Logger& logger) const;
- };
- class qlow::SyntaxError : public CompileError
- {
- public:
- inline SyntaxError(const CodePosition& where) :
- CompileError{ where }
- {
- }
-
- virtual void print(Logger&) const override;
- };
- #endif // QLOW_ERROR_REPORTING
|