feat(ast): 更新AST字面量表示方式

更新AST定义以使用词素字符串代替常量值,
并修改AST转储功能以正确显示字面量内容。

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

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

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

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

修正文件打开失败时的错误码返回值,确保调用方能正确处理异常情况。
This commit is contained in:
zzy
2026-02-19 15:56:05 +08:00
parent 27a87d17ab
commit a52ff33e30
9 changed files with 156 additions and 27 deletions

View File

@@ -84,13 +84,13 @@ int scc_sstream_init(scc_sstream_t *stream, const char *fname, int ring_size) {
scc_file_t file = scc_fopen(fname, SCC_FILE_READ);
if (file == null) {
LOG_ERROR("Failed to open file: %s", fname);
return 0;
return 1;
}
usize fsize = scc_fsize(file);
if (fsize == 0) {
LOG_WARN("file size is 0");
scc_fclose(file);
return 0;
return 2;
}
char *buffer = (char *)scc_malloc(fsize);
scc_memset(buffer, 0, fsize);