refactor(format): 移除SCF格式相关文件

移除了libs/format目录下的所有文件,包括:
- cbuild.toml构建配置文件
- include/scf.h头文件
- include/scf_impl.h实现头文件
- src/scf.c源文件
- tests/test_scf.c测试文件
- tests/test_scf_x64.c x64架构测试文件

这些文件包含了SCF(scc format)格式的完整实现,但现在不再需要。

feat(lexer): 添加布尔字面量数字生成函数

在lexer工具头文件中添加了两个内联函数用于生成布尔值的数字字面量:
- scc_lexer_gen_number_true: 将token类型设为整数字面量,值为"1"
- scc_lexer_gen_number_false: 将token类型设为整数字面量,值为"0"

refactor(lexer): 改进词法分析器错误处理

- 移除了多余的头文件包含
- 更新错误报告方式,使用SCC_ERROR宏替代LEX_ERROR,提供更准确的错误位置信息

refactor(pproc): 更新预处理器扩展器数据结构

- 将need_rescan字段类型从int改为cbool
- 添加need_parse_defined字段用于控制defined操作符解析
- 更新函数签名以支持defined操作符解析参数
This commit is contained in:
zzy
2026-02-26 10:25:45 +08:00
parent d2eaf2247f
commit f56b13da2c
19 changed files with 215 additions and 1023 deletions

View File

@@ -33,15 +33,13 @@ static int switch_file_stack(scc_pproc_t *pp, scc_cstring_t *fname,
goto FOPEN;
}
}
LOG_ERROR("In %s:%d:%d include %c%s%c, the file is not found", org_fname,
pos->line, pos->col, is_system ? '<' : '\"',
scc_cstring_as_cstr(fname), is_system ? '>' : '\"');
SCC_ERROR(*pos, "include file '%s' not found", scc_cstring_as_cstr(fname));
return -1;
FOPEN:
if (scc_vec_size(pp->file_stack) >= pp->config.max_include_depth) {
LOG_FATAL("Include depth is too deep, the include depth is %d, set "
"MAX_INCLUDE_DEPTH is %d",
scc_vec_size(pp->file_stack), pp->config.max_include_depth);
SCC_FATAL(*pos, "include depth exceeds maximum (%d)",
pp->config.max_include_depth);
LOG_FATAL("Include depth is too deep...");
}
scc_pproc_file_t *file = scc_malloc(sizeof(scc_pproc_file_t));
@@ -108,6 +106,7 @@ void scc_pproc_parse_include(scc_pproc_t *pp, scc_lexer_tok_t *include_tok,
scc_cstring_free(&fname);
return;
ERROR:
LOG_ERROR("Invalid include filename need \"FILENAME\" or <FILENAME>");
SCC_ERROR(pos,
"invalid include filename, expected \"FILENAME\" or <FILENAME>");
scc_cstring_free(&line);
}