Refactored error handling

Now uses base error class which has an abstract function for overiding how it is displayed to the console.
This commit is contained in:
Pasha Bibko
2025-05-05 15:44:59 +01:00
parent a16ce34c8b
commit 616ed1ca21
26 changed files with 340 additions and 243 deletions

View File

@@ -1,5 +1,8 @@
#pragma once
#include <Error.h>
#include <filesystem>
#include <vector>
#include <string>
@@ -21,8 +24,15 @@ namespace std
namespace LX
{
// Error type with index and character to alert the user that LX does not understand that symbol //
struct InvalidCharInSource
struct InvalidCharInSource : public RuntimeError
{
GENERATE_LX_ERROR_REQUIRED_FUNCTION_DECLARATIONS;
InvalidCharInSource(std::streamsize _col, std::streamsize _line, std::streamsize _index, char _invalid);
static std::string* s_Source;
static std::filesystem::path* s_SourceFile;
std::streamsize col;
std::streamsize line;
std::streamsize index;