Files
scc/libs/pproc/include/pproc_expand.h
zzy 60cdfd2c33 feat(pproc): 修改宏展开器以支持连续函数式宏调用
修改了预处理器宏展开功能,将输出类型从环形缓冲区改为向量,
并实现了对连续函数式宏调用的支持。现在可以正确处理像
g(z) -> f(x * (z)) 这样的宏替换场景,其中标识符可能被重新
定义为新的函数式宏。

BREAKING CHANGE: 函数签名 scc_pproc_expand_by_vec 的输出参数
从 scc_lexer_tok_ring_t* 改为 scc_lexer_tok_vec_t*
2026-03-01 14:23:17 +08:00

36 lines
1.2 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;
cbool need_rescan;
cbool need_parse_defined;
} 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_vec_t *output,
cbool need_parse_defined);
#endif /* __SCC_PPROC_EXPAND_H__ */