summaryrefslogtreecommitdiffhomepage
path: root/include/CompilerKit/AST.h
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/AST.h
parent7fd421a88005d9a3636284c7a15628111fdf41c3 (diff)
feat: CompilerKit: Refactor NECTI_ symbols to NECTAR_.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'include/CompilerKit/AST.h')
-rw-r--r--include/CompilerKit/AST.h19
1 files changed, 12 insertions, 7 deletions
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.