compiler 模块注释完善:Doxygen 风格(Lexer/Parser/Linker/Typecheck/Project/MachineConfig/TypeInfo/Codec/Codegen/Stb/main 共 21 个文件)

This commit is contained in:
2026-08-21 23:29:15 +08:00
parent fff7aef968
commit b0aebe264e
21 changed files with 1332 additions and 341 deletions
+16
View File
@@ -3,6 +3,9 @@
* @brief 语言类型元数据(machine.toml 别名 + 内建基元解析)
* @author
* @date 2026-08-21
*
* @details type_meta 实现:先按名称(大小写不敏感)命中配置类型行,
* 再由 base 解析出内建基元,合成 TypeMeta。
*/
#include "compiler/TypeInfo.h"
@@ -13,6 +16,11 @@ namespace compiler {
namespace {
/**
* @brief 转小写。
* @param s 输入串
* @return 全小写副本(逐字符 tolower,逐字节安全)
*/
std::string lower(const std::string& s) {
std::string out = s;
for (char& ch : out) {
@@ -23,6 +31,14 @@ namespace {
} // namespace
/**
* @brief 按语言类型名查元数据。
* @param cfg 机器配置(类型表来源)
* @param name 语言类型名
* @return 对应 TypeMeta;未找到返回空 TypeMetaoperator bool 为 false
* @details 比较前两侧都转小写(配置名大写 BOOL/INT/TIMELinker type_name 小写);
* 命中配置行后再用 base 解析内建基元,两者都命中才算有效。
*/
TypeMeta type_meta(const MachineConfig& cfg, const std::string& name) {
TypeMeta m;
const std::string key = lower(name);