feat(parser): 实现赋值表达式和常量表达式解析功能
- 添加 scc_parse_assignment_expression 函数用于解析赋值表达式 - 添加 scc_parser_constant_expression 函数用于解析常量表达式 - 修改 cast 表达式解析逻辑,修复类型转换解析问题 - 改进错误处理机制,使用 SCC_ERROR 替代 LOG_ERROR 并提供准确位置信息 - 移除未使用的变量声明,优化代码结构 refactor(ast): 调整类型定义中的 typedef 类型存储结构 - 将 scc_ast_type 中的 underlying 字段改为 decl 字段 - 更新相关初始化函数以适配新的字段名称 - 修复枚举类型初始化时缺失的 decl 字段设置 feat(ast): 添加类型转换、sizeof 和 alignof 表达式的初始化函数 - 实现 scc_ast_expr_cast_init 用于初始化类型转换表达式 - 实现 scc_ast_expr_sizeof_init 用于初始化 sizeof 表达式 - 实现 scc_ast_expr_alignof_init 用于初始化 alignof 表达式 - 完善表达式类型的支持 chore(parser): 增加语义分析回调接口和位置获取工具函数 - 添加 scc_parse_decl_sema、scc_parse_type_sema 等语义分析辅助函数 - 提供 scc_parser_got_current_pos 函数获取当前解析位置 - 增强错误报告的准确性 refactor(dump): 完善 AST 转储功能,支持 break 和 continue 语句 - 为 SCC_AST_STMT_BREAK 和 SCC_AST_STMT_CONTINUE 添加转储支持 - 优化转储函数的分支处理结构
This commit is contained in:
@@ -34,25 +34,29 @@ static_assert(sizeof(cbool) == 1, "cbool size must 1");
|
||||
|
||||
#else
|
||||
/* clang-format off */
|
||||
typedef __scc_i8 i8;
|
||||
typedef __scc_i16 i16;
|
||||
typedef __scc_i32 i32;
|
||||
typedef __scc_i64 i64;
|
||||
typedef __scc_u8 u8;
|
||||
typedef __scc_u16 u16;
|
||||
typedef __scc_u32 u32;
|
||||
typedef __scc_u64 u64;
|
||||
|
||||
typedef __scc_isize isize;
|
||||
typedef __scc_usize usize;
|
||||
typedef __scc_isize pdiff;
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef __scc_f32 f32;
|
||||
typedef __scc_f64 f64;
|
||||
typedef int8_t i8;
|
||||
typedef int16_t i16;
|
||||
typedef int32_t i32;
|
||||
typedef int64_t i64;
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
typedef uint64_t u64;
|
||||
|
||||
typedef __scc_bool cbool;
|
||||
/// void / null
|
||||
#define null __scc_null
|
||||
typedef intptr_t isize;
|
||||
typedef uintptr_t usize;
|
||||
typedef ptrdiff_t pdiff;
|
||||
|
||||
typedef float f32;
|
||||
typedef double f64;
|
||||
|
||||
typedef bool cbool;
|
||||
|
||||
/* clang-format on */
|
||||
#endif
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __SCC__ // FIXME it will be remove
|
||||
typedef void *FILE;
|
||||
#endif
|
||||
|
||||
void *scc_pal_malloc(size_t size) { return malloc(size); }
|
||||
|
||||
void *scc_pal_calloc(size_t count, size_t size) { return calloc(count, size); }
|
||||
|
||||
Reference in New Issue
Block a user