diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2026-03-18 21:41:51 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2026-03-18 21:41:51 +0100 |
| commit | 5480f17a96af8868de5fbab9892d8f23d9ea627d (patch) | |
| tree | 3370e833578e1d1dc590631d1ac66020fec2c9fa /src/CompilerKit | |
| parent | b8db61d6514afdec98bc8edbc22ceeed189b8309 (diff) | |
[FIX] Syntax checker fixes and codegenerator improvements.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'src/CompilerKit')
| -rw-r--r-- | src/CompilerKit/src/CodeGenerator+AssemblyFactory.cpp | 2 | ||||
| -rw-r--r-- | src/CompilerKit/src/Frontends/NectarCompiler+Chk.cpp | 12 |
2 files changed, 8 insertions, 6 deletions
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; } } |
