From 5480f17a96af8868de5fbab9892d8f23d9ea627d Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 18 Mar 2026 21:41:51 +0100 Subject: [FIX] Syntax checker fixes and codegenerator improvements. Signed-off-by: Amlal El Mahrouss --- src/CompilerKit/src/CodeGenerator+AssemblyFactory.cpp | 2 ++ src/CompilerKit/src/Frontends/NectarCompiler+Chk.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src/CompilerKit') diff --git a/src/CompilerKit/src/CodeGenerator+AssemblyFactory.cpp b/src/CompilerKit/src/CodeGenerator+AssemblyFactory.cpp index 04ed2be..e758fdc 100644 --- a/src/CompilerKit/src/CodeGenerator+AssemblyFactory.cpp +++ b/src/CompilerKit/src/CodeGenerator+AssemblyFactory.cpp @@ -34,7 +34,9 @@ Int32 AssemblyFactory::Compile(STLString sourceFile, const Int32& arch) { std::filesystem::remove(compiledUnit); return ret; } catch (...) { + auto ret = this->fMounted->CompileToFormat(compiledUnit, arch); std::filesystem::remove(compiledUnit); + return ret; } return NECTAR_UNIMPLEMENTED; diff --git a/src/CompilerKit/src/Frontends/NectarCompiler+Chk.cpp b/src/CompilerKit/src/Frontends/NectarCompiler+Chk.cpp index cc30592..5c51309 100644 --- a/src/CompilerKit/src/Frontends/NectarCompiler+Chk.cpp +++ b/src/CompilerKit/src/Frontends/NectarCompiler+Chk.cpp @@ -55,16 +55,16 @@ CK_IMPORT_C bool NectarCheckFrontend(CompilerKit::STLString& input) { } } - if (input.starts_with("let ") && !input.ends_with(";")) { - if (input.find(":=") != CompilerKit::STLString::npos) { - Detail::print_error("A declaration must always end with ';'", "check"); + if (input.find("let ") != CompilerKit::STLString::npos && input.ends_with(";")) { + if (input.find(":=") == CompilerKit::STLString::npos) { + Detail::print_error("A declaration must always include with ':='", "check"); return false; } } - if (input.starts_with("const ") && !input.ends_with(";")) { - if (input.find(":=") != CompilerKit::STLString::npos) { - Detail::print_error("A declaration must always end with ';'", "check"); + if (input.find("const ") != CompilerKit::STLString::npos && input.ends_with(";")) { + if (input.find(":=") == CompilerKit::STLString::npos) { + Detail::print_error("A declaration must always end with ':='", "check"); return false; } } -- cgit v1.2.3