feat(parser): 改进解析器错误处理和表达式解析逻辑

- 在初始化解析中添加缺失的赋值操作符检查
- 改进后缀表达式解析逻辑,处理嵌套情况
- 添加数组下标初始化的赋值操作符验证
- 修复主表达式解析中的返回语句处理

refactor(pproc): 优化预处理器宏展开和位置追踪

- 添加token复制函数来保持原始位置信息
- 重构宏展开函数参数传递方式
- 修复字符串化参数的位置信息处理
- 改进可变参数宏的处理逻辑

test(parser): 增加标签语句和字符串字面量测试用例

- 添加返回语句with复合字面量的测试
- 增加标签继续语句的测试用例
- 添加字符串连接的解析测试

test(pproc): 添加预处理器位置追踪测试

- 增加双重宏定义位置追踪测试
- 添加带参数宏定义位置追踪测试
- 增加字符串化操作位置追踪测试

docs: 更新代码中的宏定义和注释

- 修正未定义标识符的拼写错误
- 添加必要的头文件包含
- 改进错误消息提示文本
This commit is contained in:
zzy
2026-03-13 13:48:55 +08:00
parent 2d1032c363
commit c99f64708e
14 changed files with 260 additions and 60 deletions

View File

@@ -211,4 +211,8 @@ static inline char *scc_cstring_move_cstr(scc_cstring_t *str) {
return ret;
}
static inline scc_cstring_t scc_cstring_move(scc_cstring_t *str) {
return scc_cstring_from_cstr(scc_cstring_move_cstr(str));
}
#endif /* __SCC_CORE_STR_H__ */

View File

@@ -58,6 +58,10 @@ typedef double f64;
typedef bool cbool;
#ifndef null
#define null NULL
#endif
/* clang-format on */
#endif