From 6a348bd8899d3c00f4ac13becef91872fcbe8072 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 14 Apr 2025 14:33:11 +0200 Subject: cxxdrv: Add whitespace cleanup and initial support for class/struct parsing --- dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc') diff --git a/dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc b/dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc index 62d1729..a184e45 100644 --- a/dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc +++ b/dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc @@ -230,7 +230,17 @@ Boolean CompilerFrontendCPlusPlus::Compile(std::string text, const std::string file) { if (text.empty()) - return false; + return true; + + // Clean whitespace and tabs + std::string cleanLine = text; + cleanLine.erase(std::remove(cleanLine.begin(), cleanLine.end(), '\t'), cleanLine.end()); + cleanLine.erase(0, cleanLine.find_first_not_of(" \r\n")); + cleanLine.erase(cleanLine.find_last_not_of(" \r\n") + 1); + + // Skip empty, doc, or block comment lines + if (cleanLine.empty() || cleanLine.starts_with("///") || cleanLine.starts_with("//") || cleanLine.starts_with("/*")) + return true; std::size_t index = 0UL; std::vector> keywords_list; @@ -983,7 +993,7 @@ static void cxx_print_help() { kSplashCxx(); kPrintF("%s", "No help available, see:\n"); - kPrintF("%s", "www.zws.zka.com/help/c++lang\n"); + kPrintF("%s", "nekernel.org/docs/cxxdrv\n"); } ///////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3