From 663fe390703133010c1aef1a8cc3f9e3d148cd40 Mon Sep 17 00:00:00 2001 From: PuqiAR Date: Tue, 17 Feb 2026 14:13:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BC=BA=E5=A4=B1=E7=9A=84?= =?UTF-8?q?=20doxy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Core/Core.hpp | 10 +++++++++- src/Core/CoreIO.cpp | 7 +++++++ src/Core/CoreIO.hpp | 7 +++++++ src/Core/CoreInfos.hpp | 7 +++++++ src/Core/RuntimeTime.cpp | 7 +++++++ src/Core/RuntimeTime.hpp | 7 +++++++ src/Core/SourceLocations.hpp | 7 +++++++ src/Parser/Parser.hpp | 8 ++++++-- src/Parser/ParserTest.cpp | 16 ++++++++-------- 9 files changed, 65 insertions(+), 11 deletions(-) diff --git a/src/Core/Core.hpp b/src/Core/Core.hpp index 2d6b761..595393f 100644 --- a/src/Core/Core.hpp +++ b/src/Core/Core.hpp @@ -1,5 +1,13 @@ +/*! + @file src/Core/Core.hpp + @brief Core总合集 + @author PuqiAR (im@puqiar.top) + @date 2026-02-14 +*/ + #pragma once #include #include -#include \ No newline at end of file +#include +#include \ No newline at end of file diff --git a/src/Core/CoreIO.cpp b/src/Core/CoreIO.cpp index f1ca6b1..c4fce9a 100644 --- a/src/Core/CoreIO.cpp +++ b/src/Core/CoreIO.cpp @@ -1,3 +1,10 @@ +/*! + @file src/Core/CoreIO.cpp + @brief 标准输入输出链接 + @author PuqiAR (im@puqiar.top) + @date 2026-02-14 +*/ + #include #include diff --git a/src/Core/CoreIO.hpp b/src/Core/CoreIO.hpp index 3b5e337..9332621 100644 --- a/src/Core/CoreIO.hpp +++ b/src/Core/CoreIO.hpp @@ -1,3 +1,10 @@ +/*! + @file src/Core/CoreIO.hpp + @brief 标准输入输出链接定义 + @author PuqiAR (im@puqiar.top) + @date 2026-02-14 +*/ + #pragma once #include diff --git a/src/Core/CoreInfos.hpp b/src/Core/CoreInfos.hpp index 07cefe3..e81e4a5 100644 --- a/src/Core/CoreInfos.hpp +++ b/src/Core/CoreInfos.hpp @@ -1,3 +1,10 @@ +/*! + @file src/Core/CoreInfos.hpp + @brief 核心系统信息 + @author PuqiAR (im@puqiar.top) + @date 2026-02-14 +*/ + #pragma once #include diff --git a/src/Core/RuntimeTime.cpp b/src/Core/RuntimeTime.cpp index 422473a..ae1bf0c 100644 --- a/src/Core/RuntimeTime.cpp +++ b/src/Core/RuntimeTime.cpp @@ -1,3 +1,10 @@ +/*! + @file src/Core/RuntimeTime.cpp + @brief 系统时间库实现(steady_clock) + @author PuqiAR (im@puqiar.top) + @date 2026-02-14 +*/ + #include #include diff --git a/src/Core/RuntimeTime.hpp b/src/Core/RuntimeTime.hpp index 0a69530..b33fc39 100644 --- a/src/Core/RuntimeTime.hpp +++ b/src/Core/RuntimeTime.hpp @@ -1,3 +1,10 @@ +/*! + @file src/Core/RuntimeTime.hpp + @brief 系统时间库定义 + @author PuqiAR (im@puqiar.top) + @date 2026-02-14 +*/ + #pragma once #include diff --git a/src/Core/SourceLocations.hpp b/src/Core/SourceLocations.hpp index b72b51e..c6a81b8 100644 --- a/src/Core/SourceLocations.hpp +++ b/src/Core/SourceLocations.hpp @@ -1,3 +1,10 @@ +/*! + @file src/Core/SourceLocations + @brief SourcePosition + SourceLocation定义,全局代码定位 + @author PuqiAR (im@puqiar.top) + @date 2026-02-14 +*/ + #pragma once #include diff --git a/src/Parser/Parser.hpp b/src/Parser/Parser.hpp index c87331c..3f25173 100644 --- a/src/Parser/Parser.hpp +++ b/src/Parser/Parser.hpp @@ -74,7 +74,7 @@ namespace Fig } return buffer.back(); } - + Token peekToken(size_t lookahead = 1) { assert(!isEOF && "peekToken: eof but called peekToken"); @@ -141,6 +141,7 @@ namespace Fig ), fileName, "[internal parser]", magic_enum::enum_name(state).data()); } + /* Expressions */ Result parseLiteralExpr(); // 当前token为literal时调用 Result parseIdentiExpr(); // 当前token为Identifier调用 @@ -150,9 +151,12 @@ namespace Fig std::unordered_set getTerminators(); // 返回当前state的终止条件(终止符) bool shouldTerminate(); // 通过state判断该不该终止表达式解析 - public: Result parseExpression(BindingPower = 0); + /* Statements */ + + public: + DynArray parseAll(); }; }; // namespace Fig \ No newline at end of file diff --git a/src/Parser/ParserTest.cpp b/src/Parser/ParserTest.cpp index 4db3de3..68b8566 100644 --- a/src/Parser/ParserTest.cpp +++ b/src/Parser/ParserTest.cpp @@ -18,12 +18,12 @@ int main() Lexer lexer(source, fileName); Parser parser(lexer, srcManager, fileName); - const auto &result = parser.parseExpression(); - if (!result) - { - ReportError(result.error(), srcManager); - return 1; - } - Expr *expr = *result; - std::cout << expr->toString() << '\n'; + // const auto &result = parser.parseExpression(); + // if (!result) + // { + // ReportError(result.error(), srcManager); + // return 1; + // } + // Expr *expr = *result; + // std::cout << expr->toString() << '\n'; } \ No newline at end of file