Files
scc/libs/pproc/include/pproc_expand.h
zzy c46578736a feat(ast): 添加复合表达式和初始化器解析支持
重构AST表达式枚举,将COMPOUND_LITERAL重命名为COMPOUND,
更新相关结构体定义以支持复合字面量的左右表达式向量表示。

添加lvalue表达式类型用于左值处理,实现完整的初始化器解析功能,
包括大括号初始化列表、成员访问和数组下标的处理逻辑。

更新表达式解析器为基于优先级的递归下降解析,修复变量声明中
初始化表达式的内存泄漏问题。

完善类型限定符和存储类说明符的重复检查机制,增强语法分析的准确性。
2026-03-12 21:14:08 +08:00

40 lines
1.3 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;
scc_pos_t call_pos;
cbool need_rescan;
cbool need_parse_defined;
cbool need_keep_org_pos;
} scc_pproc_expand_t;
static inline scc_lexer_tok_ring_t
scc_lexer_array_to_ring(scc_lexer_tok_vec_t *move_array) {
scc_lexer_tok_ring_t ret;
scc_ring_by_buffer(ret, move_array->data, move_array->size);
scc_vec_init(*move_array);
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,
cbool need_keep_org_pos);
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, cbool need_keep_org_pos);
#endif /* __SCC_PPROC_EXPAND_H__ */