Files
scc/libs/pproc/include/pproc_expand.h
zzy a52ff33e30 feat(ast): 更新AST字面量表示方式
更新AST定义以使用词素字符串代替常量值,
并修改AST转储功能以正确显示字面量内容。

BREAKING CHANGE: AST表达式结构体中literal成员从value改为lexme字段。

refactor(pproc): 重构宏展开和文件包含逻辑

将宏展开函数重构为独立接口,实现文件包含处理逻辑,
改进预处理器的状态管理机制。

fix(sstream): 修复文件流初始化错误码返回

修正文件打开失败时的错误码返回值,确保调用方能正确处理异常情况。
2026-02-19 15:56:05 +08:00

34 lines
1.1 KiB
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);
void scc_pproc_expand_by_src(scc_pproc_macro_table_t *macro_table,
scc_lexer_tok_ring_t *input,
scc_lexer_tok_ring_t *output,
const scc_pproc_macro_t *macro);
void scc_pproc_expand_by_vec(scc_pproc_macro_table_t *macro_table,
scc_lexer_tok_vec_t *input,
scc_lexer_tok_ring_t *output);
#endif /* __SCC_PPROC_EXPAND_H__ */