- 实现了 # 和 ## 预处理器操作符的功能 - 添加了 token 深拷贝和移动函数以支持宏展开 - 修改预处理器展开逻辑以正确处理宏参数替换 - 增加了宏参数分割时对空白字符的处理 fix: 修复预处理器宏展开中的内存管理和逻辑错误 - 修正了宏展开集合的数据结构初始化方式 - 修复了函数式宏调用时括号匹配的判断逻辑 - 改进了宏参数解析过程中空白字符的处理 - 解决了 token 在宏展开过程中的所有权管理问题 chore: 为 justfile 添加文件统计命令并优化构建配置 - 新增 count-file 命令用于统计代码文件数量 - 调整了输出文件的默认命名规则 - 优化了词法分析器 token 释放时的字段重置逻辑
27 lines
663 B
C
27 lines
663 B
C
#ifndef __SCC_PPROC_EXPAND_H__
|
|
#define __SCC_PPROC_EXPAND_H__
|
|
|
|
#include <pproc_macro.h>
|
|
#include <scc_core.h>
|
|
#include <scc_core_ring.h>
|
|
#include <scc_lexer.h>
|
|
|
|
typedef struct {
|
|
scc_pproc_macro_table_t *macro_table;
|
|
scc_pproc_macro_table_t *expanded_set;
|
|
scc_lexer_tok_ring_t *input;
|
|
scc_lexer_tok_vec_t output;
|
|
int need_rescan;
|
|
} scc_pproc_expand_t;
|
|
|
|
static inline scc_lexer_tok_ring_t
|
|
scc_lexer_array_to_ring(scc_lexer_tok_vec_t *array) {
|
|
scc_lexer_tok_ring_t ret;
|
|
scc_ring_by_buffer(ret, array->data, array->size);
|
|
return ret;
|
|
}
|
|
|
|
void scc_pproc_expand_macro(scc_pproc_expand_t *expand_ctx);
|
|
|
|
#endif /* __SCC_PPROC_EXPAND_H__ */
|