Started implementing Lexer errors

This commit is contained in:
Pasha Bibko
2025-07-20 21:54:37 +01:00
parent 6a0d2fc0a2
commit bb3d8fb13e
7 changed files with 84 additions and 32 deletions

View File

@@ -9,8 +9,10 @@ int main(int argc, char** argv)
// Creates the debug log //
Util::CreateLog("LXC.log");
std::filesystem::path src = "example/example.lx";
// Reads the given file to a string //
Util::ReturnVal fileContents = Util::ReadFile("example/example.lx");
Util::ReturnVal fileContents = Util::ReadFile(src);
if (fileContents.Failed()) _UNLIKELY
{
// Stores the error for easier access //
@@ -34,6 +36,11 @@ int main(int argc, char** argv)
// Stores the error for easier access //
Lexer::LexerError& err = tokens.Error();
// Prints the error to the console //
Util::PrintAs<Util::WHITE>("[LXC] ");
Util::Print(src.filename().string());
Util::PrintAs<Util::LIGHT_RED>(" Error: ");
Util::Stop();
}