summaryrefslogtreecommitdiffhomepage
path: root/dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-04-14 14:33:11 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-04-14 14:33:11 +0200
commit6a348bd8899d3c00f4ac13becef91872fcbe8072 (patch)
tree61a0d9dd4ebc84bb41e4d993917f672d86e44b03 /dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc
parent09edd92af071cab2a88967a3db5f93a5fd568e1a (diff)
cxxdrv: Add whitespace cleanup and initial support for class/struct parsing
Diffstat (limited to 'dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc')
-rw-r--r--dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc14
1 files changed, 12 insertions, 2 deletions
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<std::pair<LibCompiler::CompilerKeyword, std::size_t>> 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");
}
/////////////////////////////////////////////////////////////////////////////////////////