From 2a16b53aaf4b38f5e63ce69c96df65b24e26b82b Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Tue, 23 Dec 2025 09:39:34 +0100 Subject: wip: cppfront: Implementing C++ part of the frontend. Signed-off-by: Amlal El Mahrouss --- include/CompilerKit/AST.h | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'include/CompilerKit/AST.h') diff --git a/include/CompilerKit/AST.h b/include/CompilerKit/AST.h index a1957a4..2d63a1f 100644 --- a/include/CompilerKit/AST.h +++ b/include/CompilerKit/AST.h @@ -82,17 +82,24 @@ struct SyntaxKeyword { }; struct SyntaxLeafList final { - struct SyntaxLeaf final { - // \brief User data type. - Int32 fUserType{0U}; - // \brief User data buffer. + struct SyntaxLeaf; + + struct SyntaxLeaf { + using Ptr = SyntaxLeaf*; + using Reference = SyntaxLeaf&; + using ConstReference = const SyntaxLeaf&; + + /// \brief User data type. + Int32 fUserType{}; + + /// \brief User data buffer. SyntaxKeyword fUserData{{}, KeywordKind::kKeywordKindInvalid}; - // \brief User data value + /// \brief User data value STLString fUserValue{}; - // \brief Next user data on list. - struct SyntaxLeaf* fNext{nullptr}; + /// \brief Next user data on list. + Ptr fNext{nullptr}; }; using ArrayType = std::vector; @@ -147,7 +154,7 @@ class ICompilerFrontend { //! @brief Compile a syntax tree ouf of the text. //! Also takes the source file name for metadata. /// =========================================================== /// - virtual SyntaxLeafList::SyntaxLeaf Compile(STLString text, STLString file) { return {}; } + virtual SyntaxLeafList::SyntaxLeaf Compile(STLString& text, const STLString& file) { return {}; } /// =========================================================== /// //! @brief What language are we dealing with? @@ -162,4 +169,3 @@ class ICompilerFrontend { } // namespace CompilerKit #include - -- cgit v1.2.3