From 999dc83cac37efc109da4d562a8a75d1f6fc7c86 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 22 Dec 2025 15:33:46 +0100 Subject: feat: CompilerKit: Refactor NECTI_ symbols to NECTAR_. Signed-off-by: Amlal El Mahrouss --- include/CompilerKit/AST.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'include/CompilerKit/AST.h') 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. -- cgit v1.2.3