feat: 添加预处理器宏定义的字符串化和连接操作支持

- 实现了 # 和 ## 预处理器操作符的功能
- 添加了 token 深拷贝和移动函数以支持宏展开
- 修改预处理器展开逻辑以正确处理宏参数替换
- 增加了宏参数分割时对空白字符的处理

fix: 修复预处理器宏展开中的内存管理和逻辑错误

- 修正了宏展开集合的数据结构初始化方式
- 修复了函数式宏调用时括号匹配的判断逻辑
- 改进了宏参数解析过程中空白字符的处理
- 解决了 token 在宏展开过程中的所有权管理问题

chore: 为 justfile 添加文件统计命令并优化构建配置

- 新增 count-file 命令用于统计代码文件数量
- 调整了输出文件的默认命名规则
- 优化了词法分析器 token 释放时的字段重置逻辑
This commit is contained in:
zzy
2026-02-19 11:20:01 +08:00
parent c86071416d
commit 08a60e6e8a
9 changed files with 332 additions and 81 deletions

View File

@@ -22,8 +22,6 @@ void scc_pproc_macro_drop(scc_pproc_macro_t *macro) {
if (!macro)
return;
scc_cstring_free(&macro->name);
// 释放参数列表
for (usize i = 0; i < macro->params.size; ++i) {
scc_lexer_tok_drop(&scc_vec_at(macro->params, i));
@@ -36,6 +34,8 @@ void scc_pproc_macro_drop(scc_pproc_macro_t *macro) {
}
scc_vec_free(macro->replaces);
scc_cstring_free(&macro->name);
scc_free(macro);
}