summaryrefslogtreecommitdiffhomepage
path: root/include/CompilerKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-12-22 15:33:46 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-12-22 15:33:46 +0100
commit999dc83cac37efc109da4d562a8a75d1f6fc7c86 (patch)
treee240f01cb9a00f67e0b94a8e7d139c2b41b294ec /include/CompilerKit
parent7fd421a88005d9a3636284c7a15628111fdf41c3 (diff)
feat: CompilerKit: Refactor NECTI_ symbols to NECTAR_.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'include/CompilerKit')
-rw-r--r--include/CompilerKit/AE.h2
-rw-r--r--include/CompilerKit/AST.h19
-rw-r--r--include/CompilerKit/CodeGenerator.h16
-rw-r--r--include/CompilerKit/Detail/PreConfig.h10
-rw-r--r--include/CompilerKit/ErrorID.h20
-rw-r--r--include/CompilerKit/ErrorOr.h2
-rw-r--r--include/CompilerKit/Macros.h8
-rw-r--r--include/CompilerKit/Ref.h4
-rw-r--r--include/CompilerKit/Utilities/Compiler.h4
-rw-r--r--include/CompilerKit/Utilities/DLL.h2
10 files changed, 46 insertions, 41 deletions
diff --git a/include/CompilerKit/AE.h b/include/CompilerKit/AE.h
index 3475460..e81ca64 100644
--- a/include/CompilerKit/AE.h
+++ b/include/CompilerKit/AE.h
@@ -103,7 +103,7 @@ class AEReadableProtocol final {
explicit AEReadableProtocol() = default;
~AEReadableProtocol() = default;
- NECTI_COPY_DELETE(AEReadableProtocol)
+ NECTAR_COPY_DELETE(AEReadableProtocol)
/**
* @brief Read AE Record headers.
diff --git a/include/CompilerKit/AST.h b/include/CompilerKit/AST.h
index a1819b1..579689d 100644
--- a/include/CompilerKit/AST.h
+++ b/include/CompilerKit/AST.h
@@ -12,7 +12,7 @@
#define CK_COMPILER_FRONTEND : public ::CompilerKit::ICompilerFrontend
namespace CompilerKit {
-inline static auto kInvalidFrontend = "(null)";
+inline static constexpr auto kInvalidFrontend = "(null)";
struct SyntaxLeafList;
struct SyntaxLeafList;
@@ -22,7 +22,8 @@ struct SyntaxKeyword;
/// @note we want to do that to separate keywords.
/// =========================================================== ///
-enum KeywordKind {
+/// \brief The type of keyword we are dealing with.
+enum struct KeywordKind {
kKeywordKindReserved = 0,
kKeywordKindNamespace = 100,
kKeywordKindFunctionStart,
@@ -71,9 +72,13 @@ enum KeywordKind {
/// =========================================================== ///
struct SyntaxKeyword {
SyntaxKeyword(const STLString& name, KeywordKind kind) : fKeywordName(name), fKeywordKind(kind) {}
+ ~SyntaxKeyword() = default;
+ SyntaxKeyword() = delete;
- STLString fKeywordName{""};
- KeywordKind fKeywordKind{kKeywordKindInvalid};
+ NECTAR_COPY_DEFAULT(SyntaxKeyword);
+
+ STLString fKeywordName{};
+ KeywordKind fKeywordKind{KeywordKind::kKeywordKindInvalid};
};
struct SyntaxLeafList final {
@@ -81,10 +86,10 @@ struct SyntaxLeafList final {
// \brief User data type.
Int32 fUserType{0U};
// \brief User data buffer.
- SyntaxKeyword fUserData{"", kKeywordKindInvalid};
+ SyntaxKeyword fUserData{{}, KeywordKind::kKeywordKindInvalid};
// \brief User data value
- STLString fUserValue{""};
+ STLString fUserValue{};
// \brief Next user data on list.
struct SyntaxLeaf* fNext{nullptr};
@@ -131,7 +136,7 @@ class ICompilerFrontend {
explicit ICompilerFrontend() = default;
virtual ~ICompilerFrontend() = default;
- NECTI_COPY_DEFAULT(ICompilerFrontend)
+ NECTAR_COPY_DEFAULT(ICompilerFrontend)
/// =========================================================== ///
/// NOTE: cast this to your user defined ast.
diff --git a/include/CompilerKit/CodeGenerator.h b/include/CompilerKit/CodeGenerator.h
index 8bee7b5..3dbbc1e 100644
--- a/include/CompilerKit/CodeGenerator.h
+++ b/include/CompilerKit/CodeGenerator.h
@@ -29,7 +29,7 @@ class AssemblyFactory final {
explicit AssemblyFactory() = default;
~AssemblyFactory() = default;
- NECTI_COPY_DEFAULT(AssemblyFactory);
+ NECTAR_COPY_DEFAULT(AssemblyFactory);
public:
enum {
@@ -61,7 +61,7 @@ class IAssembly {
explicit IAssembly() = default;
virtual ~IAssembly() = default;
- NECTI_COPY_DEFAULT(IAssembly);
+ NECTAR_COPY_DEFAULT(IAssembly);
virtual UInt32 Arch() noexcept { return AssemblyFactory::kArchAMD64; }
@@ -139,7 +139,7 @@ class IAssemblyEncoder {
explicit IAssemblyEncoder() = default;
virtual ~IAssemblyEncoder() = default;
- NECTI_COPY_DEFAULT(IAssemblyEncoder);
+ NECTAR_COPY_DEFAULT(IAssemblyEncoder);
virtual STLString CheckLine(STLString line, STLString file) = 0;
virtual bool WriteLine(STLString line, STLString file) = 0;
@@ -157,7 +157,7 @@ class EncoderAMD64 final : public IAssemblyEncoder {
explicit EncoderAMD64() = default;
~EncoderAMD64() override = default;
- NECTI_COPY_DEFAULT(EncoderAMD64);
+ NECTAR_COPY_DEFAULT(EncoderAMD64);
virtual STLString CheckLine(STLString line, STLString file) override;
virtual bool WriteLine(STLString line, STLString file) override;
@@ -177,7 +177,7 @@ class EncoderARM64 final : public IAssemblyEncoder {
explicit EncoderARM64() = default;
~EncoderARM64() override = default;
- NECTI_COPY_DEFAULT(EncoderARM64);
+ NECTAR_COPY_DEFAULT(EncoderARM64);
virtual STLString CheckLine(STLString line, STLString file) override;
virtual bool WriteLine(STLString line, STLString file) override;
@@ -193,7 +193,7 @@ class Encoder64x0 final : public IAssemblyEncoder {
explicit Encoder64x0() = default;
~Encoder64x0() override = default;
- NECTI_COPY_DEFAULT(Encoder64x0);
+ NECTAR_COPY_DEFAULT(Encoder64x0);
virtual STLString CheckLine(STLString line, STLString file) override;
virtual bool WriteLine(STLString line, STLString file) override;
@@ -209,7 +209,7 @@ class Encoder32x0 final : public IAssemblyEncoder {
explicit Encoder32x0() = default;
~Encoder32x0() override = default;
- NECTI_COPY_DEFAULT(Encoder32x0);
+ NECTAR_COPY_DEFAULT(Encoder32x0);
virtual STLString CheckLine(STLString line, STLString file) override;
virtual bool WriteLine(STLString line, STLString file) override;
@@ -225,7 +225,7 @@ class EncoderPowerPC final : public IAssemblyEncoder {
explicit EncoderPowerPC() = default;
~EncoderPowerPC() override = default;
- NECTI_COPY_DEFAULT(EncoderPowerPC);
+ NECTAR_COPY_DEFAULT(EncoderPowerPC);
virtual STLString CheckLine(STLString line, STLString file) override;
virtual bool WriteLine(STLString line, STLString file) override;
diff --git a/include/CompilerKit/Detail/PreConfig.h b/include/CompilerKit/Detail/PreConfig.h
index dc96377..b70bb6d 100644
--- a/include/CompilerKit/Detail/PreConfig.h
+++ b/include/CompilerKit/Detail/PreConfig.h
@@ -95,25 +95,25 @@
#define kAsmFileExtsMax (7U)
-#define NECTI_MODULE(name) extern "C" int name(int argc, char** argv)
+#define NECTAR_MODULE(name) extern "C" int name(int argc, char** argv)
#ifdef MSVC
#pragma scalar_storage_order big - endian
#endif // ifdef MSVC
-#define NECTI_COPY_DELETE(KLASS) \
+#define NECTAR_COPY_DELETE(KLASS) \
KLASS& operator=(const KLASS&) = delete; \
KLASS(const KLASS&) = delete;
-#define NECTI_COPY_DEFAULT(KLASS) \
+#define NECTAR_COPY_DEFAULT(KLASS) \
KLASS& operator=(const KLASS&) = default; \
KLASS(const KLASS&) = default;
-#define NECTI_MOVE_DELETE(KLASS) \
+#define NECTAR_MOVE_DELETE(KLASS) \
KLASS& operator=(KLASS&&) = delete; \
KLASS(KLASS&&) = delete;
-#define NECTI_MOVE_DEFAULT(KLASS) \
+#define NECTAR_MOVE_DEFAULT(KLASS) \
KLASS& operator=(KLASS&&) = default; \
KLASS(KLASS&&) = default;
diff --git a/include/CompilerKit/ErrorID.h b/include/CompilerKit/ErrorID.h
index e2ec164..383336c 100644
--- a/include/CompilerKit/ErrorID.h
+++ b/include/CompilerKit/ErrorID.h
@@ -17,13 +17,13 @@
/// @brief Error IDs for CompilerKit.
/// =========================================================== ///
-#define NECTI_SUCCESS 0
-#define NECTI_EXEC_ERROR -30
-#define NECTI_FILE_NOT_FOUND -31
-#define NECTI_DIR_NOT_FOUND -32
-#define NECTI_FILE_EXISTS -33
-#define NECTI_TOO_LONG -34
-#define NECTI_INVALID_DATA -35
-#define NECTI_UNIMPLEMENTED -36
-#define NECTI_FAT_ERROR -37
-#define NECTI_INVALID_ARCH -38
+#define NECTAR_SUCCESS 0
+#define NECTAR_EXEC_ERROR -30
+#define NECTAR_FILE_NOT_FOUND -31
+#define NECTAR_DIR_NOT_FOUND -32
+#define NECTAR_FILE_EXISTS -33
+#define NECTAR_TOO_LONG -34
+#define NECTAR_INVALID_DATA -35
+#define NECTAR_UNIMPLEMENTED -36
+#define NECTAR_FAT_ERROR -37
+#define NECTAR_INVALID_ARCH -38
diff --git a/include/CompilerKit/ErrorOr.h b/include/CompilerKit/ErrorOr.h
index ae1bd84..6fe3288 100644
--- a/include/CompilerKit/ErrorOr.h
+++ b/include/CompilerKit/ErrorOr.h
@@ -42,7 +42,7 @@ class ErrorOr final {
ErrorT Error() { return mId; }
- bool HasError() { return mId != NECTI_SUCCESS; }
+ bool HasError() { return mId != NECTAR_SUCCESS; }
explicit operator bool() { return mRef; }
diff --git a/include/CompilerKit/Macros.h b/include/CompilerKit/Macros.h
index 8c112c6..ccba8f7 100644
--- a/include/CompilerKit/Macros.h
+++ b/include/CompilerKit/Macros.h
@@ -9,19 +9,19 @@
#ifndef _NECTAR_MACROS_H_
#define _NECTAR_MACROS_H_
-#define NECTI_COPY_DELETE(KLASS) \
+#define NECTAR_COPY_DELETE(KLASS) \
KLASS& operator=(const KLASS&) = delete; \
KLASS(const KLASS&) = delete;
-#define NECTI_COPY_DEFAULT(KLASS) \
+#define NECTAR_COPY_DEFAULT(KLASS) \
KLASS& operator=(const KLASS&) = default; \
KLASS(const KLASS&) = default;
-#define NECTI_MOVE_DELETE(KLASS) \
+#define NECTAR_MOVE_DELETE(KLASS) \
KLASS& operator=(KLASS&&) = delete; \
KLASS(KLASS&&) = delete;
-#define NECTI_MOVE_DEFAULT(KLASS) \
+#define NECTAR_MOVE_DEFAULT(KLASS) \
KLASS& operator=(KLASS&&) = default; \
KLASS(KLASS&&) = default;
diff --git a/include/CompilerKit/Ref.h b/include/CompilerKit/Ref.h
index 4063508..3cdac83 100644
--- a/include/CompilerKit/Ref.h
+++ b/include/CompilerKit/Ref.h
@@ -28,7 +28,7 @@ class StrongRef {
}
}
- NECTI_COPY_DEFAULT(StrongRef)
+ NECTAR_COPY_DEFAULT(StrongRef)
using Type = T;
@@ -65,7 +65,7 @@ class WeakRef final : public StrongRef<T> {
WeakRef() = delete;
~WeakRef() = default;
- NECTI_COPY_DEFAULT(WeakRef)
+ NECTAR_COPY_DEFAULT(WeakRef)
public:
using Type = T;
diff --git a/include/CompilerKit/Utilities/Compiler.h b/include/CompilerKit/Utilities/Compiler.h
index 7a79787..dd9dbfc 100644
--- a/include/CompilerKit/Utilities/Compiler.h
+++ b/include/CompilerKit/Utilities/Compiler.h
@@ -51,7 +51,7 @@ inline void print_error(STLString reason, STLString file) noexcept {
kStdErr << reason << kBlank << std::endl;
- if (kAcceptableErrors > kErrorLimit) std::exit(NECTI_EXEC_ERROR);
+ if (kAcceptableErrors > kErrorLimit) std::exit(NECTAR_EXEC_ERROR);
++kAcceptableErrors;
}
@@ -116,6 +116,6 @@ inline void drvi_crash_handler(std::int32_t id) {
std::cout << std::endl;
- std::exit(NECTI_EXEC_ERROR);
+ std::exit(NECTAR_EXEC_ERROR);
}
} // namespace CompilerKit::Detail
diff --git a/include/CompilerKit/Utilities/DLL.h b/include/CompilerKit/Utilities/DLL.h
index ea6789d..130ccb0 100644
--- a/include/CompilerKit/Utilities/DLL.h
+++ b/include/CompilerKit/Utilities/DLL.h
@@ -51,7 +51,7 @@ class DLLLoader final {
return *this;
}
- NECTI_COPY_DELETE(DLLLoader)
+ NECTAR_COPY_DELETE(DLLLoader)
DLLLoader() = default;
~DLLLoader() { this->Destroy(); }